Changeset 10062 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-03-28T00:22:42+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java
r10055 r10062 7 7 import java.awt.GridBagConstraints; 8 8 import java.awt.GridBagLayout; 9 import java.io.ByteArrayOutputStream;10 9 import java.io.IOException; 11 10 import java.io.PrintWriter; 12 11 import java.io.StringWriter; 13 import java.net.URL;14 import java.nio.ByteBuffer;15 import java.nio.charset.StandardCharsets;16 import java.util.zip.GZIPOutputStream;17 12 18 13 import javax.swing.JButton; … … 33 28 import org.openstreetmap.josm.plugins.PluginDownloadTask; 34 29 import org.openstreetmap.josm.plugins.PluginHandler; 35 import org.openstreetmap.josm.tools.Base64;36 30 import org.openstreetmap.josm.tools.GBC; 37 31 import org.openstreetmap.josm.tools.WikiReader; … … 154 148 155 149 /** 156 * Handles the given throwable object157 * @param t The throwable object158 */159 public void handle(Throwable t) {160 handleException(t);161 }162 163 /**164 150 * Handles the given exception 165 151 * @param e the exception … … 253 239 return handlingInProgress; 254 240 } 255 256 /**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.258 * @param debugText The debug text to provide us259 * @return The URL to create a JOSM bug report with the given debug text260 * @see BugReportSender#reportBug(String) if you want to send long debug texts along.261 * @since 5849262 */263 public static URL getBugReportUrl(String debugText) {264 try (265 ByteArrayOutputStream out = new ByteArrayOutputStream();266 GZIPOutputStream gzip = new GZIPOutputStream(out)267 ) {268 gzip.write(debugText.getBytes(StandardCharsets.UTF_8));269 gzip.finish();270 271 return new URL(Main.getJOSMWebsite()+"/josmticket?" +272 "gdata="+Base64.encode(ByteBuffer.wrap(out.toByteArray()), true));273 } catch (IOException e) {274 Main.error(e);275 return null;276 }277 }278 279 /**280 * Replies the URL label to create a JOSM bug report with the given debug text281 * @param debugText The debug text to provide us282 * @return The URL label to create a JOSM bug report with the given debug text283 * @since 5849284 */285 public static UrlLabel getBugReportUrlLabel(String debugText) {286 URL url = getBugReportUrl(debugText);287 if (url != null) {288 return new UrlLabel(url.toString(), Main.getJOSMWebsite()+"/josmticket?...", 2);289 }290 return null;291 }292 241 }
Note:
See TracChangeset
for help on using the changeset viewer.