Changeset 10055 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-03-27T04:01:39+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools/bugreport
- Files:
-
- 3 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java
r10049 r10055 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.tools; 2 package org.openstreetmap.josm.tools.bugreport; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 16 16 import java.util.zip.GZIPOutputStream; 17 17 18 import javax.swing.JButton; 18 19 import javax.swing.JCheckBox; 19 20 import javax.swing.JLabel; 20 21 import javax.swing.JOptionPane; 21 22 import javax.swing.JPanel; 22 import javax.swing.JScrollPane;23 23 import javax.swing.SwingUtilities; 24 24 25 25 import org.openstreetmap.josm.Main; 26 import org.openstreetmap.josm.actions.ReportBugAction; 26 27 import org.openstreetmap.josm.actions.ShowStatusReportAction; 27 28 import org.openstreetmap.josm.data.Version; … … 29 30 import org.openstreetmap.josm.gui.preferences.plugin.PluginPreference; 30 31 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 31 import org.openstreetmap.josm.gui.widgets.JosmTextArea;32 32 import org.openstreetmap.josm.gui.widgets.UrlLabel; 33 33 import org.openstreetmap.josm.plugins.PluginDownloadTask; 34 34 import org.openstreetmap.josm.plugins.PluginHandler; 35 import org.openstreetmap.josm.tools.Base64; 36 import org.openstreetmap.josm.tools.GBC; 37 import org.openstreetmap.josm.tools.WikiReader; 35 38 36 39 /** … … 194 197 private static void askForBugReport(final Throwable e) { 195 198 try { 196 final int maxlen = 6000;197 199 StringWriter stack = new StringWriter(); 198 200 e.printStackTrace(new PrintWriter(stack)); 199 201 200 202 String text = ShowStatusReportAction.getReportHeader() + stack.getBuffer().toString(); 201 String urltext = text.replaceAll("\r", ""); 202 if (urltext.length() > maxlen) { 203 urltext = urltext.substring(0, maxlen); 204 int idx = urltext.lastIndexOf('\n'); 205 // cut whole line when not loosing too much 206 if (maxlen-idx < 200) { 207 urltext = urltext.substring(0, idx+1); 208 } 209 urltext += "...<snip>...\n"; 210 } 203 text = text.replaceAll("\r", ""); 211 204 212 205 JPanel p = new JPanel(new GridBagLayout()); … … 220 213 "file a bug report in our bugtracker using this link:")), 221 214 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 222 p.add( getBugReportUrlLabel(urltext), GBC.eop().insets(8, 0, 0, 0));215 p.add(new JButton(new ReportBugAction(text)), GBC.eop().insets(8, 0, 0, 0)); 223 216 p.add(new JMultilineLabel( 224 217 tr("There the error information provided below should already be " + … … 232 225 233 226 // Wiki formatting for manual copy-paste 234 text = "{{{\n"+text+"}}}";235 236 if ( Utils.copyToClipboard(text)) {227 DebugTextDisplay textarea = new DebugTextDisplay(text); 228 229 if (textarea.copyToClippboard()) { 237 230 p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), 238 231 GBC.eop().fill(GridBagConstraints.HORIZONTAL)); 239 232 } 240 233 241 JosmTextArea info = new JosmTextArea(text, 18, 60); 242 info.setCaretPosition(0); 243 info.setEditable(false); 244 p.add(new JScrollPane(info), GBC.eop().fill()); 234 p.add(textarea, GBC.eop().fill()); 245 235 246 236 for (Component c: p.getComponents()) { … … 265 255 266 256 /** 267 * Replies the URL to create a JOSM bug report with the given debug text 257 * Replies the URL to create a JOSM bug report with the given debug text. GZip is used to reduce the length of the parameter. 268 258 * @param debugText The debug text to provide us 269 259 * @return The URL to create a JOSM bug report with the given debug text 260 * @see BugReportSender#reportBug(String) if you want to send long debug texts along. 270 261 * @since 5849 271 262 */
Note:
See TracChangeset
for help on using the changeset viewer.