Changeset 34617 in osm for applications/editors/josm/plugins/DirectUpload
- Timestamp:
- 2018-09-03T20:31:50+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/DirectUpload
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/DirectUpload/.settings/org.eclipse.jdt.core.prefs
r32699 r34617 9 9 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 10 10 org.eclipse.jdt.core.compiler.compliance=1.8 11 org.eclipse.jdt.core.compiler.doc.comment.support=enabled 11 12 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning 12 13 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error … … 32 33 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning 33 34 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore 35 org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning 36 org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled 37 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled 38 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled 39 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private 34 40 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore 35 41 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning … … 38 44 org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled 39 45 org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore 46 org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore 47 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled 48 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public 49 org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags 50 org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning 51 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled 52 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled 53 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private 40 54 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 41 55 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -
applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
r34502 r34617 8 8 import java.io.ByteArrayOutputStream; 9 9 import java.io.IOException; 10 import java.net.MalformedURLException; 10 11 import java.net.URL; 11 12 import java.nio.charset.StandardCharsets; … … 34 35 import org.openstreetmap.josm.io.GpxWriter; 35 36 import org.openstreetmap.josm.io.OsmApi; 37 import org.openstreetmap.josm.io.OsmTransferException; 36 38 import org.openstreetmap.josm.spi.preferences.Config; 37 39 import org.openstreetmap.josm.tools.GBC; 38 40 import org.openstreetmap.josm.tools.HttpClient; 39 41 import org.openstreetmap.josm.tools.HttpClient.Response; 42 import org.openstreetmap.josm.tools.Logging; 40 43 41 44 /** … … 202 205 /** 203 206 * This is the actual workhorse that manages the upload. 204 * @param String Description of the GPX track being uploaded 205 * @param String Tags associated with the GPX track being uploaded 206 * @param boolean Shall the GPX track be public 207 * @param GpxData The GPX Data to upload 207 * @param description Description of the GPX track being uploaded 208 * @param tags Tags associated with the GPX track being uploaded 209 * @param visi Shall the GPX track be public 210 * @param gpxData The GPX Data to upload 211 * @param progressMonitor Progress monitor 212 * @throws IOException if any I/O error occurs 208 213 */ 209 214 private void upload(String description, String tags, String visi, GpxData gpxData, ProgressMonitor progressMonitor) throws IOException { … … 270 275 * This function sets up the upload URL and logs in using the username and password given 271 276 * in the preferences. 272 * @param intThe length of the content to be sent to the server277 * @param contentLength The length of the content to be sent to the server 273 278 * @return HttpURLConnection The set up conenction 274 */ 275 private HttpClient setupConnection(int contentLength) throws Exception { 279 * @throws MalformedURLException in case of invalid URL 280 * @throws OsmTransferException if auth header cannot be added 281 */ 282 private HttpClient setupConnection(int contentLength) throws MalformedURLException, OsmTransferException { 276 283 277 284 // Upload URL … … 295 302 * It also posts the result (or errors) to OutputDisplay. 296 303 297 * @param HttpURLConnection The connection to check/finish up 298 */ 299 private boolean finishUpConnection(Response c) throws Exception { 304 * @param c The HTTP connection to check/finish up 305 * @return {@code true} for success 306 */ 307 private boolean finishUpConnection(Response c) { 300 308 String returnMsg = c.getResponseMessage(); 301 309 final boolean success = returnMsg.equals("OK"); … … 350 358 /** 351 359 * Generates the output string displayed in the PleaseWaitDialog. 352 * @param int Bytes already uploaded 353 * @return String Message 360 * @param cur Bytes already uploaded 361 * @param progressMonitor Progress monitor 362 * @return Message 354 363 */ 355 364 private String getProgressText(int cur, ProgressMonitor progressMonitor) { 356 365 int max = progressMonitor.getTicksCount(); 357 int percent = Math.round(cur * 100 / max);366 int percent = (cur * 100 / max); 358 367 // FIXME method kept because of translated string 359 368 return tr("Uploading GPX track: {0}% ({1} of {2})", … … 363 372 /** 364 373 * Nicely calculates given bytes into MB, kB and B (with units) 365 * @param intBytes374 * @param bytes Bytes 366 375 * @return String 367 376 */ … … 370 379 // Rounds to 2 decimal places 371 380 ? new DecimalFormat("0.00") 372 .format((double) Math.round(bytes/(1000*10))/100) + " MB"381 .format((double)(bytes/(1000*10))/100) + " MB" 373 382 : (bytes > 1000 374 ? Math.round(bytes/1000) + " kB"383 ? (bytes/1000) + " kB" 375 384 : bytes + " B")); 376 385 } … … 379 388 * Checks for common errors and displays them in OutputDisplay if it finds any. 380 389 * Returns whether errors have been found or not. 381 * @param StringGPX track description382 * @param GpxData the GPX data to upload390 * @param description GPX track description 391 * @param gpxData the GPX data to upload 383 392 * @return boolean true if errors have been found 384 393 */ … … 443 452 /** 444 453 * Writes textfields (like in webbrowser) to the given ByteArrayOutputStream 445 * @param ByteArrayOutputStream 446 * @param String The name of the "textbox" 447 * @param String The value to write 454 * @param baos output stream 455 * @param name The name of the "textbox" 456 * @param value The value to write 457 * @throws IOException if any I/O error occurs 448 458 */ 449 459 private void writeField(ByteArrayOutputStream baos, String name, String value) throws IOException { … … 458 468 /** 459 469 * Writes gpxData (= file field in webbrowser) to the given ByteArrayOutputStream 460 * @param ByteArrayOutputStream 461 * @param String The name of the "upload field" 462 * @param GpxData The GPX data to upload 470 * @param baos output stream 471 * @param name The name of the "upload field" 472 * @param gpxData The GPX data to upload 473 * @throws IOException if any I/O error occurs 463 474 */ 464 475 private void writeGpxFile(ByteArrayOutputStream baos, String name, GpxData gpxData) throws IOException { … … 482 493 /** 483 494 * Writes a String to the given ByteArrayOutputStream 484 * @param ByteArrayOutputStream485 * @param String495 * @param baos output stream 496 * @param s string 486 497 */ 487 498 private void writeString(ByteArrayOutputStream baos, String s) { 488 499 try { 489 500 baos.write(s.getBytes(StandardCharsets.UTF_8)); 490 } catch(Exception e) {} 501 } catch(Exception e) { 502 Logging.error(e); 503 } 491 504 } 492 505 493 506 /** 494 507 * Writes a newline to the given ByteArrayOutputStream 495 * @param ByteArrayOutputStream508 * @param baos output stream 496 509 */ 497 510 private void writeLineEnd(ByteArrayOutputStream baos) { … … 501 514 /** 502 515 * Writes a boundary line to the given ByteArrayOutputStream 503 * @param ByteArrayOutputStream516 * @param baos output stream 504 517 */ 505 518 private void writeBoundary(ByteArrayOutputStream baos) {
Note:
See TracChangeset
for help on using the changeset viewer.