Class BugReportSender
- java.lang.Object
-
- java.lang.Thread
-
- org.openstreetmap.josm.tools.bugreport.BugReportSender
-
- All Implemented Interfaces:
java.lang.Runnable
public class BugReportSender extends java.lang.Thread
This class handles sending the bug report to JOSM website.Currently, we try to open a browser window for the user that displays the bug report.
- Since:
- 10055
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBugReportSender.BugReportSenderExceptionstatic interfaceBugReportSender.BugReportSendingHandlerCalled during bug submission to JOSM bugtracker.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringerrorMessagestatic BugReportSender.BugReportSendingHandlerFALLBACK_BUGREPORT_SENDING_HANDLERThe fallback bug report sending handler if none is set.private static BugReportSender.BugReportSendingHandlerhandlerprivate java.lang.StringstatusText
-
Constructor Summary
Constructors Modifier Constructor Description protectedBugReportSender(java.lang.String statusText)Creates a new sender.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetErrorMessage()Returns the error message that could have occurred during bug sending.private static java.lang.StringgetJOSMTicketURL()private java.lang.StringpasteDebugText()Sends the debug text to the server.static BugReportSenderreportBug(java.lang.String statusText)Opens the bug report window on the JOSM server.private static java.lang.StringretrieveDebugToken(org.w3c.dom.Document document)voidrun()static voidsetBugReportSendingHandler(BugReportSender.BugReportSendingHandler bugReportSendingHandler)Sets theBugReportSender.BugReportSendingHandlerfor bug report sender.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
FALLBACK_BUGREPORT_SENDING_HANDLER
public static final BugReportSender.BugReportSendingHandler FALLBACK_BUGREPORT_SENDING_HANDLER
The fallback bug report sending handler if none is set.- Since:
- 12790
-
handler
private static volatile BugReportSender.BugReportSendingHandler handler
-
statusText
private final java.lang.String statusText
-
errorMessage
private java.lang.String errorMessage
-
-
Constructor Detail
-
BugReportSender
protected BugReportSender(java.lang.String statusText)
Creates a new sender.- Parameters:
statusText- The status text to send.
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
pasteDebugText
private java.lang.String pasteDebugText() throws BugReportSender.BugReportSenderException
Sends the debug text to the server.- Returns:
- The token which was returned by the server. We need to pass this on to the ticket system.
- Throws:
BugReportSender.BugReportSenderException- if sending the report failed.
-
getJOSMTicketURL
private static java.lang.String getJOSMTicketURL()
-
retrieveDebugToken
private static java.lang.String retrieveDebugToken(org.w3c.dom.Document document) throws javax.xml.xpath.XPathExpressionException, BugReportSender.BugReportSenderException
- Throws:
javax.xml.xpath.XPathExpressionExceptionBugReportSender.BugReportSenderException
-
getErrorMessage
public final java.lang.String getErrorMessage()
Returns the error message that could have occurred during bug sending.- Returns:
- the error message, or
nullif successful
-
reportBug
public static BugReportSender reportBug(java.lang.String statusText)
Opens the bug report window on the JOSM server.- Parameters:
statusText- The status text to send along to the server.- Returns:
- bug report sender started thread
-
setBugReportSendingHandler
public static void setBugReportSendingHandler(BugReportSender.BugReportSendingHandler bugReportSendingHandler)
Sets theBugReportSender.BugReportSendingHandlerfor bug report sender.- Parameters:
bugReportSendingHandler- the handler in charge of completing the bug report submission and handle errors. Must not be null- Since:
- 12790
-
-