Index: /trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java	(revision 10063)
+++ /trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java	(revision 10064)
@@ -35,4 +35,5 @@
  *
  * @author imi
+ * @since 40
  */
 public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler {
@@ -183,51 +184,55 @@
     private static void askForBugReport(final Throwable e) {
         try {
-            StringWriter stack = new StringWriter();
-            e.printStackTrace(new PrintWriter(stack));
-
-            String text = ShowStatusReportAction.getReportHeader() + stack.getBuffer().toString();
-            text = text.replaceAll("\r", "");
-
-            JPanel p = new JPanel(new GridBagLayout());
-            p.add(new JMultilineLabel(
-                    tr("You have encountered an error in JOSM. Before you file a bug report " +
-                            "make sure you have updated to the latest version of JOSM here:")),
-                            GBC.eol().fill(GridBagConstraints.HORIZONTAL));
-            p.add(new UrlLabel(Main.getJOSMWebsite(), 2), GBC.eop().insets(8, 0, 0, 0));
-            p.add(new JMultilineLabel(
-                    tr("You should also update your plugins. If neither of those help please " +
-                            "file a bug report in our bugtracker using this link:")),
-                            GBC.eol().fill(GridBagConstraints.HORIZONTAL));
-            p.add(new JButton(new ReportBugAction(text)), GBC.eop().insets(8, 0, 0, 0));
-            p.add(new JMultilineLabel(
-                    tr("There the error information provided below should already be " +
-                            "filled in for you. Please include information on how to reproduce " +
-                            "the error and try to supply as much detail as possible.")),
-                            GBC.eop().fill(GridBagConstraints.HORIZONTAL));
-            p.add(new JMultilineLabel(
-                    tr("Alternatively, if that does not work you can manually fill in the information " +
-                            "below at this URL:")), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
-            p.add(new UrlLabel(Main.getJOSMWebsite()+"/newticket", 2), GBC.eop().insets(8, 0, 0, 0));
-
-            // Wiki formatting for manual copy-paste
-            DebugTextDisplay textarea = new DebugTextDisplay(text);
-
-            if (textarea.copyToClippboard()) {
-                p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")),
-                        GBC.eop().fill(GridBagConstraints.HORIZONTAL));
-            }
-
-            p.add(textarea, GBC.eop().fill());
-
-            for (Component c: p.getComponents()) {
-                if (c instanceof JMultilineLabel) {
-                    ((JMultilineLabel) c).setMaxWidth(400);
-                }
-            }
-
+            JPanel p = buildPanel(e);
             JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE);
         } catch (Exception e1) {
             Main.error(e1);
         }
+    }
+
+    static JPanel buildPanel(final Throwable e) {
+        StringWriter stack = new StringWriter();
+        e.printStackTrace(new PrintWriter(stack));
+
+        String text = ShowStatusReportAction.getReportHeader() + stack.getBuffer().toString();
+        text = text.replaceAll("\r", "");
+
+        JPanel p = new JPanel(new GridBagLayout());
+        p.add(new JMultilineLabel(
+                tr("You have encountered an error in JOSM. Before you file a bug report " +
+                        "make sure you have updated to the latest version of JOSM here:")),
+                        GBC.eol().fill(GridBagConstraints.HORIZONTAL));
+        p.add(new UrlLabel(Main.getJOSMWebsite(), 2), GBC.eop().insets(8, 0, 0, 0));
+        p.add(new JMultilineLabel(
+                tr("You should also update your plugins. If neither of those help please " +
+                        "file a bug report in our bugtracker using this link:")),
+                        GBC.eol().fill(GridBagConstraints.HORIZONTAL));
+        p.add(new JButton(new ReportBugAction(text)), GBC.eop().insets(8, 0, 0, 0));
+        p.add(new JMultilineLabel(
+                tr("There the error information provided below should already be " +
+                        "filled in for you. Please include information on how to reproduce " +
+                        "the error and try to supply as much detail as possible.")),
+                        GBC.eop().fill(GridBagConstraints.HORIZONTAL));
+        p.add(new JMultilineLabel(
+                tr("Alternatively, if that does not work you can manually fill in the information " +
+                        "below at this URL:")), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
+        p.add(new UrlLabel(Main.getJOSMWebsite()+"/newticket", 2), GBC.eop().insets(8, 0, 0, 0));
+
+        // Wiki formatting for manual copy-paste
+        DebugTextDisplay textarea = new DebugTextDisplay(text);
+
+        if (textarea.copyToClippboard()) {
+            p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")),
+                    GBC.eop().fill(GridBagConstraints.HORIZONTAL));
+        }
+
+        p.add(textarea, GBC.eop().fill());
+
+        for (Component c: p.getComponents()) {
+            if (c instanceof JMultilineLabel) {
+                ((JMultilineLabel) c).setMaxWidth(400);
+            }
+        }
+        return p;
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java	(revision 10063)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java	(revision 10064)
@@ -2,9 +2,12 @@
 package org.openstreetmap.josm.tools.bugreport;
 
+import static org.junit.Assert.assertNotNull;
+
 import org.junit.Before;
+import org.junit.Test;
 import org.openstreetmap.josm.JOSMFixture;
 
 /**
- * Bug report unit tests.
+ * Unit tests of {@link BugReportExceptionHandler} class.
  */
 public class BugReportExceptionHandlerTest {
@@ -17,3 +20,11 @@
         JOSMFixture.createUnitTestFixture().init();
     }
+
+    /**
+     * Unit test for {@link BugReportExceptionHandler#buildPanel} method.
+     */
+    @Test
+    public void testBuildPanel() {
+        assertNotNull(BugReportExceptionHandler.buildPanel(new Exception()));
+    }
 }
