Class BugReportSender
- java.lang.Object
-
- java.lang.Thread
-
- org.openstreetmap.josm.tools.bugreport.BugReportSender
-
- All Implemented Interfaces:
Runnable
public class BugReportSender extends 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 class
BugReportSender.BugReportSenderException
static interface
BugReportSender.BugReportSendingHandler
Called during bug submission to JOSM bugtracker.-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private String
errorMessage
static BugReportSender.BugReportSendingHandler
FALLBACK_BUGREPORT_SENDING_HANDLER
The fallback bug report sending handler if none is set.private static BugReportSender.BugReportSendingHandler
handler
private String
statusText
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BugReportSender(String statusText)
Creates a new sender.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getErrorMessage()
Returns the error message that could have occurred during bug sending.private static String
getJOSMTicketURL()
private String
pasteDebugText()
Sends the debug text to the server.static BugReportSender
reportBug(String statusText)
Opens the bug report window on the JOSM server.private static String
retrieveDebugToken(Document document)
void
run()
static void
setBugReportSendingHandler(BugReportSender.BugReportSendingHandler bugReportSendingHandler)
Sets theBugReportSender.BugReportSendingHandler
for 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 String statusText
-
errorMessage
private String errorMessage
-
-
Constructor Detail
-
BugReportSender
protected BugReportSender(String statusText)
Creates a new sender.- Parameters:
statusText
- The status text to send.
-
-
Method Detail
-
pasteDebugText
private 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 String getJOSMTicketURL()
-
retrieveDebugToken
private static String retrieveDebugToken(Document document) throws XPathExpressionException, BugReportSender.BugReportSenderException
-
getErrorMessage
public final String getErrorMessage()
Returns the error message that could have occurred during bug sending.- Returns:
- the error message, or
null
if successful
-
reportBug
public static BugReportSender reportBug(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.BugReportSendingHandler
for bug report sender.- Parameters:
bugReportSendingHandler
- the handler in charge of completing the bug report submission and handle errors. Must not be null- Since:
- 12790
-
-