Ignore:
Timestamp:
2023-08-09T15:30:01+02:00 (10 months ago)
Author:
taylor.smock
Message:

Fix #22832: Code cleanup and some simplification, documentation fixes (patch by gaben)

There should not be any functional changes in this patch; it is intended to do
the following:

  • Simplify and cleanup code (example: Arrays.asList(item) -> Collections.singletonList(item))
  • Fix typos in documentation (which also corrects the documentation to match what actually happens, in some cases)
Location:
trunk/src/org/openstreetmap/josm/io
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java

    r18208 r18801  
    265265     * <code>d</code> d is a date relative to the current time zone.
    266266     *
    267      * @param d the date . Must not be null.
     267     * @param d the date. Must not be null.
    268268     * @return the restricted changeset query
    269269     * @throws IllegalArgumentException if d is null
     
    570570         * see <a href="http://wiki.openstreetmap.org/wiki/API_v0.6#Query:_GET_.2Fapi.2F0.6.2Fchangesets">OSM API</a>.
    571571         *
    572          * Example for an query string:<br>
     572         * Example for a query string:<br>
    573573         * <pre>
    574574         *    uid=1234&amp;open=true
  • trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java

    r18663 r18801  
    6060     * is defined <strong>at startup</strong>. It has no effect if the property is set
    6161     * later by the application.
    62      *
    63      * We therefore read the property at class loading time and remember it's value.
     62     * <p>
     63     * We therefore read the property at class loading time and remember its value.
    6464     */
    6565    private static boolean jvmWillUseSystemProxies;
  • trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java

    r18623 r18801  
    105105    /**
    106106     * Postprocesses the diff result read and parsed from the server.
    107      *
     107     * <p>
    108108     * Uploaded objects are assigned their new id (if they got assigned a new
    109109     * id by the server), their new version (if the version was incremented),
  • trunk/src/org/openstreetmap/josm/io/IGpxReader.java

    r18179 r18801  
    3333
    3434    /**
    35      * Returns the number of coordinates that have been successfuly read.
    36      * @return the number of coordinates that have been successfuly read
     35     * Returns the number of coordinates that have been successfully read.
     36     * @return the number of coordinates that have been successfully read
    3737     * @since 18179
    3838     */
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r18779 r18801  
    809809                    errorHeader = response.getHeaderField("Error");
    810810                    Logging.error("Error header: " + errorHeader);
    811                 } else if (retCode != HttpURLConnection.HTTP_OK && responseBody.length() > 0) {
     811                } else if (retCode != HttpURLConnection.HTTP_OK && !responseBody.isEmpty()) {
    812812                    Logging.error("Error body: " + responseBody);
    813813                }
     
    815815
    816816                errorHeader = errorHeader == null ? null : errorHeader.trim();
    817                 String errorBody = responseBody.length() == 0 ? null : responseBody.trim();
     817                String errorBody = responseBody.isEmpty() ? null : responseBody.trim();
    818818                switch(retCode) {
    819819                case HttpURLConnection.HTTP_OK:
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r18695 r18801  
    487487
    488488    /**
    489      * Exception thrown after user cancelation.
     489     * Exception thrown after user cancellation.
    490490     */
    491491    private static final class OsmParsingCanceledException extends XmlStreamParsingException implements ImportCancelException {
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r18780 r18801  
    509509                        }
    510510                        // TODO should we handle also POST?
    511                         if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && !"".equals(getMapUrl)) {
     511                        if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && !getMapUrl.isEmpty()) {
    512512                            try {
    513513                                String query = new URL(getMapUrl).getQuery();
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r18211 r18801  
    160160
    161161    /**
    162      * Returns usage examples for the given command. To be overriden only my handlers that define several commands.
     162     * Returns usage examples for the given command. To be overridden only my handlers that define several commands.
    163163     * @param cmd The command asked
    164164     * @return Usage examples for the given command
     
    203203        if (GLOBAL_CONFIRMATION.get()) {
    204204            // Ensure dialog box does not exceed main window size
    205             Integer maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth()*0.6);
     205            int maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth() * 0.6);
    206206            String message = "<html><div>" + getPermissionMessage() +
    207207                    "<br/>" + tr("Do you want to allow this?") + "</div></html>";
     
    357357        DownloadParams result = new DownloadParams();
    358358        if (args != null) {
    359             result = result
    360                 .withNewLayer(isLoadInNewLayer())
    361                 .withLayerName(args.get("layer_name"))
    362                 .withLocked(get("layer_locked"))
    363                 .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL))
    364                 .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL));
     359            result.withNewLayer(isLoadInNewLayer())
     360                    .withLayerName(args.get("layer_name"))
     361                    .withLocked(get("layer_locked"))
     362                    .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL))
     363                    .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL));
    365364        }
    366365        return result;
     
    498497
    499498    /**
    500      * Handler that takes an URL as parameter.
     499     * Handler that takes a URL as a parameter.
    501500     */
    502501    public abstract static class RawURLParseRequestHandler extends RequestHandler {
Note: See TracChangeset for help on using the changeset viewer.