Ignore:
Timestamp:
2018-09-03T20:31:50+02:00 (6 years ago)
Author:
donvip
Message:

fix warnings

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  
    99org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
    1010org.eclipse.jdt.core.compiler.compliance=1.8
     11org.eclipse.jdt.core.compiler.doc.comment.support=enabled
    1112org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
    1213org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
     
    3233org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
    3334org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
     35org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
     36org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
     37org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
     38org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
     39org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
    3440org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
    3541org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
     
    3844org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
    3945org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
     46org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
     47org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
     48org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
     49org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
     50org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
     51org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
     52org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
     53org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
    4054org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
    4155org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
  • applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java

    r34502 r34617  
    88import java.io.ByteArrayOutputStream;
    99import java.io.IOException;
     10import java.net.MalformedURLException;
    1011import java.net.URL;
    1112import java.nio.charset.StandardCharsets;
     
    3435import org.openstreetmap.josm.io.GpxWriter;
    3536import org.openstreetmap.josm.io.OsmApi;
     37import org.openstreetmap.josm.io.OsmTransferException;
    3638import org.openstreetmap.josm.spi.preferences.Config;
    3739import org.openstreetmap.josm.tools.GBC;
    3840import org.openstreetmap.josm.tools.HttpClient;
    3941import org.openstreetmap.josm.tools.HttpClient.Response;
     42import org.openstreetmap.josm.tools.Logging;
    4043
    4144/**
     
    202205    /**
    203206     * 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
    208213     */
    209214    private void upload(String description, String tags, String visi, GpxData gpxData, ProgressMonitor progressMonitor) throws IOException {
     
    270275     * This function sets up the upload URL and logs in using the username and password given
    271276     * in the preferences.
    272      * @param int The length of the content to be sent to the server
     277     * @param contentLength The length of the content to be sent to the server
    273278     * @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 {
    276283
    277284        // Upload URL
     
    295302     * It also posts the result (or errors) to OutputDisplay.
    296303
    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) {
    300308        String returnMsg = c.getResponseMessage();
    301309        final boolean success = returnMsg.equals("OK");
     
    350358    /**
    351359     * 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
    354363     */
    355364    private String getProgressText(int cur, ProgressMonitor progressMonitor) {
    356365        int max = progressMonitor.getTicksCount();
    357         int percent = Math.round(cur * 100 / max);
     366        int percent = (cur * 100 / max);
    358367        // FIXME method kept because of translated string
    359368        return tr("Uploading GPX track: {0}% ({1} of {2})",
     
    363372    /**
    364373     * Nicely calculates given bytes into MB, kB and B (with units)
    365      * @param int Bytes
     374     * @param bytes Bytes
    366375     * @return String
    367376     */
     
    370379                    // Rounds to 2 decimal places
    371380                    ? new DecimalFormat("0.00")
    372                         .format((double)Math.round(bytes/(1000*10))/100) + " MB"
     381                        .format((double)(bytes/(1000*10))/100) + " MB"
    373382                    : (bytes > 1000
    374                         ? Math.round(bytes/1000) + " kB"
     383                        ? (bytes/1000) + " kB"
    375384                        : bytes + " B"));
    376385    }
     
    379388     * Checks for common errors and displays them in OutputDisplay if it finds any.
    380389     * Returns whether errors have been found or not.
    381      * @param String GPX track description
    382      * @param GpxData the GPX data to upload
     390     * @param description GPX track description
     391     * @param gpxData the GPX data to upload
    383392     * @return boolean true if errors have been found
    384393     */
     
    443452    /**
    444453     * 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
    448458     */
    449459    private void writeField(ByteArrayOutputStream baos, String name, String value) throws IOException {
     
    458468    /**
    459469     * 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
    463474     */
    464475    private void writeGpxFile(ByteArrayOutputStream baos, String name, GpxData gpxData) throws IOException {
     
    482493    /**
    483494     * Writes a String to the given ByteArrayOutputStream
    484      * @param ByteArrayOutputStream
    485      * @param String
     495     * @param baos output stream
     496     * @param s string
    486497     */
    487498    private void writeString(ByteArrayOutputStream baos, String s) {
    488499        try {
    489500            baos.write(s.getBytes(StandardCharsets.UTF_8));
    490         } catch(Exception e) {}
     501        } catch(Exception e) {
     502            Logging.error(e);
     503        }
    491504    }
    492505
    493506    /**
    494507     * Writes a newline to the given ByteArrayOutputStream
    495      * @param ByteArrayOutputStream
     508     * @param baos output stream
    496509     */
    497510    private void writeLineEnd(ByteArrayOutputStream baos) {
     
    501514    /**
    502515     * Writes a boundary line to the given ByteArrayOutputStream
    503      * @param ByteArrayOutputStream
     516     * @param baos output stream
    504517     */
    505518    private void writeBoundary(ByteArrayOutputStream baos) {
Note: See TracChangeset for help on using the changeset viewer.