Changeset 10067 in josm for trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportSender.java
- Timestamp:
- 2016-03-28T14:23:40+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportSender.java
r10055 r10067 49 49 50 50 private final String statusText; 51 private String errorMessage; 51 52 52 53 /** … … 54 55 * @param statusText The status text to send. 55 56 */ 56 p ublicBugReportSender(String statusText) {57 protected BugReportSender(String statusText) { 57 58 super("Bug report sender"); 58 59 this.statusText = statusText; … … 101 102 DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); 102 103 Document document = builder.parse(in); 103 return retri veDebugToken(document);104 return retrieveDebugToken(document); 104 105 } 105 106 } catch (IOException | SAXException | ParserConfigurationException | XPathExpressionException t) { … … 108 109 } 109 110 110 private String getJOSMTicketURL() {111 private static String getJOSMTicketURL() { 111 112 return Main.getJOSMWebsite() + "/josmticket"; 112 113 } 113 114 114 private String retriveDebugToken(Document document) throws XPathExpressionException, BugReportSenderException {115 private static String retrieveDebugToken(Document document) throws XPathExpressionException, BugReportSenderException { 115 116 XPathFactory factory = XPathFactory.newInstance(); 116 117 XPath xpath = factory.newXPath(); … … 134 135 135 136 private void failed(String string) { 137 errorMessage = string; 136 138 SwingUtilities.invokeLater(new Runnable() { 137 139 @Override 138 140 public void run() { 139 JPanel errorPanel = new JPanel(); 140 errorPanel.setLayout(new GridBagLayout()); 141 JPanel errorPanel = new JPanel(new GridBagLayout()); 141 142 errorPanel.add(new JMultilineLabel( 142 143 tr("Opening the bug report failed. Please report manually using this website:")), … … 149 150 } 150 151 }); 152 } 153 154 /** 155 * Returns the error message that could have occured during bug sending. 156 * @return the error message, or {@code null} if successful 157 */ 158 public final String getErrorMessage() { 159 return errorMessage; 151 160 } 152 161 … … 164 173 * Opens the bug report window on the JOSM server. 165 174 * @param statusText The status text to send along to the server. 175 * @return bug report sender started thread 166 176 */ 167 public static void reportBug(String statusText) { 168 new BugReportSender(statusText).start(); 177 public static BugReportSender reportBug(String statusText) { 178 BugReportSender sender = new BugReportSender(statusText); 179 sender.start(); 180 return sender; 169 181 } 170 182 }
Note:
See TracChangeset
for help on using the changeset viewer.