- Timestamp:
- 2016-03-27T04:01:39+02:00 (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r9019 r10055 31 31 import org.openstreetmap.josm.gui.widgets.UrlLabel; 32 32 import org.openstreetmap.josm.plugins.PluginHandler; 33 import org.openstreetmap.josm.tools.BugReportExceptionHandler;34 33 import org.openstreetmap.josm.tools.GBC; 35 34 import org.openstreetmap.josm.tools.ImageProvider; 36 35 import org.openstreetmap.josm.tools.Shortcut; 37 36 import org.openstreetmap.josm.tools.Utils; 37 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 38 38 39 39 /** -
trunk/src/org/openstreetmap/josm/actions/ReportBugAction.java
r8061 r10055 7 7 import java.awt.event.KeyEvent; 8 8 9 import org.openstreetmap.josm.tools.BugReportExceptionHandler;10 import org.openstreetmap.josm.tools.OpenBrowser;11 9 import org.openstreetmap.josm.tools.Shortcut; 12 import org.openstreetmap.josm.tools. Utils;10 import org.openstreetmap.josm.tools.bugreport.BugReportSender; 13 11 14 12 /** … … 18 16 public class ReportBugAction extends JosmAction { 19 17 18 private final String text; 19 20 20 /** 21 * Constructs a new {@code ReportBugAction} .21 * Constructs a new {@code ReportBugAction} that reports the normal status report. 22 22 */ 23 23 public ReportBugAction() { 24 this(ShowStatusReportAction.getReportHeader()); 25 } 26 27 /** 28 * Constructs a new {@link ReportBugAction} for the given debug text. 29 * @param text The text to send 30 */ 31 public ReportBugAction(String text) { 24 32 super(tr("Report bug"), "bug", tr("Report a ticket to JOSM bugtracker"), 25 33 Shortcut.registerShortcut("reportbug", tr("Report a ticket to JOSM bugtracker"), 26 34 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), true); 35 this.text = text; 27 36 } 28 37 29 38 @Override 30 39 public void actionPerformed(ActionEvent e) { 31 reportBug(); 32 } 33 34 /** 35 * Reports a ticket to JOSM bugtracker. 36 */ 37 public static void reportBug() { 38 reportBug(ShowStatusReportAction.getReportHeader()); 39 } 40 41 /** 42 * Reports a ticket to JOSM bugtracker with given status report. 43 * @param report Status report header containing technical, non-personal information 44 */ 45 public static void reportBug(String report) { 46 OpenBrowser.displayUrl(BugReportExceptionHandler.getBugReportUrl( 47 Utils.strip(report)).toExternalForm()); 40 BugReportSender.reportBug(text); 48 41 } 49 42 } -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r9759 r10055 20 20 import java.util.Set; 21 21 22 import javax.swing.JScrollPane;23 24 22 import org.openstreetmap.josm.Main; 25 23 import org.openstreetmap.josm.data.Version; … … 28 26 import org.openstreetmap.josm.data.preferences.Setting; 29 27 import org.openstreetmap.josm.gui.ExtendedDialog; 30 import org.openstreetmap.josm.gui.widgets.JosmTextArea;31 28 import org.openstreetmap.josm.plugins.PluginHandler; 32 29 import org.openstreetmap.josm.tools.PlatformHookUnixoid; 33 30 import org.openstreetmap.josm.tools.Shortcut; 34 import org.openstreetmap.josm.tools.Utils; 31 import org.openstreetmap.josm.tools.bugreport.BugReportSender; 32 import org.openstreetmap.josm.tools.bugreport.DebugTextDisplay; 35 33 36 34 /** … … 184 182 } 185 183 186 JosmTextArea ta = new JosmTextArea(text.toString()); 187 ta.setWrapStyleWord(true); 188 ta.setLineWrap(true); 189 ta.setEditable(false); 190 JScrollPane sp = new JScrollPane(ta); 184 DebugTextDisplay ta = new DebugTextDisplay(text.toString()); 191 185 192 186 ExtendedDialog ed = new ExtendedDialog(Main.parent, … … 194 188 new String[] {tr("Copy to clipboard and close"), tr("Report bug"), tr("Close") }); 195 189 ed.setButtonIcons(new String[] {"copy", "bug", "cancel" }); 196 ed.setContent( sp, false);190 ed.setContent(ta, false); 197 191 ed.setMinimumSize(new Dimension(380, 200)); 198 192 ed.setPreferredSize(new Dimension(700, Main.parent.getHeight()-50)); 199 193 200 194 switch (ed.showDialog().getValue()) { 201 case 1: Utils.copyToClipboard(text.toString()); break;202 case 2: ReportBugAction.reportBug(reportHeader); break;195 case 1: ta.copyToClippboard(); break; 196 case 2: BugReportSender.reportBug(reportHeader); break; 203 197 } 204 198 } -
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r9474 r10055 25 25 import org.openstreetmap.josm.io.OsmApiInitializationException; 26 26 import org.openstreetmap.josm.io.OsmTransferException; 27 import org.openstreetmap.josm.tools.BugReportExceptionHandler;28 27 import org.openstreetmap.josm.tools.ExceptionUtil; 28 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 29 29 30 30 /** -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r10043 r10055 65 65 import org.openstreetmap.josm.plugins.PluginHandler; 66 66 import org.openstreetmap.josm.plugins.PluginInformation; 67 import org.openstreetmap.josm.tools.BugReportExceptionHandler;68 67 import org.openstreetmap.josm.tools.FontsManager; 69 68 import org.openstreetmap.josm.tools.HttpClient; … … 73 72 import org.openstreetmap.josm.tools.PlatformHookWindows; 74 73 import org.openstreetmap.josm.tools.Utils; 74 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 75 75 76 76 import gnu.getopt.Getopt; -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r10041 r10055 70 70 import org.openstreetmap.josm.gui.util.GuiHelper; 71 71 import org.openstreetmap.josm.tools.AudioPlayer; 72 import org.openstreetmap.josm.tools.BugReportExceptionHandler;73 72 import org.openstreetmap.josm.tools.Shortcut; 74 73 import org.openstreetmap.josm.tools.Utils; 74 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 75 75 76 76 /** -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
r8840 r10055 13 13 import org.openstreetmap.josm.gui.progress.ProgressTaskId; 14 14 import org.openstreetmap.josm.io.OsmTransferException; 15 import org.openstreetmap.josm.tools.BugReportExceptionHandler;16 15 import org.openstreetmap.josm.tools.CheckParameterUtil; 16 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 17 17 import org.xml.sax.SAXException; 18 18 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r9059 r10055 56 56 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 57 57 import org.openstreetmap.josm.io.OnlineResource; 58 import org.openstreetmap.josm.tools.BugReportExceptionHandler;59 58 import org.openstreetmap.josm.tools.ImageProvider; 60 59 import org.openstreetmap.josm.tools.OpenBrowser; 60 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 61 61 62 62 /** -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r9521 r10055 51 51 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 52 52 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 53 import org.openstreetmap.josm.tools.BugReportExceptionHandler;54 53 import org.openstreetmap.josm.tools.ImageProvider; 55 54 import org.openstreetmap.josm.tools.Utils; 55 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 56 56 57 57 /** -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetHeaderDownloadTask.java
r9059 r10055 21 21 import org.openstreetmap.josm.io.OsmServerChangesetReader; 22 22 import org.openstreetmap.josm.io.OsmTransferException; 23 import org.openstreetmap.josm.tools.BugReportExceptionHandler;24 23 import org.openstreetmap.josm.tools.CheckParameterUtil; 25 24 import org.openstreetmap.josm.tools.ExceptionUtil; 25 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 26 26 import org.xml.sax.SAXException; 27 27 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryTask.java
r9059 r10055 26 26 import org.openstreetmap.josm.io.OsmTransferCanceledException; 27 27 import org.openstreetmap.josm.io.OsmTransferException; 28 import org.openstreetmap.josm.tools.BugReportExceptionHandler;29 28 import org.openstreetmap.josm.tools.CheckParameterUtil; 30 29 import org.openstreetmap.josm.tools.ExceptionUtil; 30 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 31 31 import org.xml.sax.SAXException; 32 32 -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r10053 r10055 282 282 283 283 /** 284 * Constr cuts a new {@code LatLonViewer}.284 * Constructs a new {@code LatLonViewer}. 285 285 * @param model a model 286 286 * @param role the role for this viewer. -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r9078 r10055 24 24 import org.openstreetmap.josm.gui.MapView; 25 25 import org.openstreetmap.josm.gui.layer.Layer; 26 import org.openstreetmap.josm.tools.BugReportExceptionHandler;27 26 import org.openstreetmap.josm.tools.Predicate; 28 27 import org.openstreetmap.josm.tools.Utils; 29 28 import org.openstreetmap.josm.tools.WindowGeometry; 29 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 30 30 31 31 /** -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r9624 r10055 63 63 import org.openstreetmap.josm.plugins.PluginInformation; 64 64 import org.openstreetmap.josm.plugins.PluginProxy; 65 import org.openstreetmap.josm.tools.BugReportExceptionHandler;66 65 import org.openstreetmap.josm.tools.CheckParameterUtil; 67 66 import org.openstreetmap.josm.tools.GBC; 68 67 import org.openstreetmap.josm.tools.ImageProvider; 68 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 69 69 70 70 /** -
trunk/src/org/openstreetmap/josm/plugins/PluginProxy.java
r8953 r10055 8 8 import org.openstreetmap.josm.gui.download.DownloadSelection; 9 9 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 10 import org.openstreetmap.josm.tools. BugReportExceptionHandler;10 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 11 11 12 12 /** -
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 */ -
trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.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.junit.Assert.assertEquals; … … 32 32 33 33 /** 34 * Test method for {@link org.openstreetmap.josm.tools. BugReportExceptionHandler#getBugReportUrl(java.lang.String)}.34 * Test method for {@link org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler#getBugReportUrl(java.lang.String)}. 35 35 * @throws IOException if any I/O error occurs 36 36 */
Note:
See TracChangeset
for help on using the changeset viewer.