Ignore:
Timestamp:
2015-10-10T01:40:42+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib - minor performance improvements:

  • Method passes constant String of length 1 to character overridden method
  • Method needlessly boxes a boolean constant
  • Method uses iterator().next() on a List to get the first item
  • Method converts String to boxed primitive using excessive boxing
  • Method converts String to primitive using excessive boxing
  • Method creates array using constants
  • Class defines List based fields but uses them like Sets
Location:
trunk/src/org/openstreetmap/josm/io
Files:
30 edited

Legend:

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

    r8788 r8846  
    4848        boolean done = false;
    4949        GpxData result = null;
    50         String url = "trackpoints?bbox="+b.getMinLon()+","+b.getMinLat()+","+b.getMaxLon()+","+b.getMaxLat()+"&page=";
     50        String url = "trackpoints?bbox="+b.getMinLon()+','+b.getMinLat()+','+b.getMaxLon()+','+b.getMaxLat()+"&page=";
    5151        for (int i = 0; !done; ++i) {
    5252            progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * 5000, (i + 1) * 5000));
     
    123123     */
    124124    protected String getRequestForBbox(double lon1, double lat1, double lon2, double lat2) {
    125         return "map?bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2;
     125        return "map?bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2;
    126126    }
    127127
     
    190190        CheckParameterUtil.ensureThat(noteLimit <= 10000, "Requested note limit is over API hard limit of 10000.");
    191191        CheckParameterUtil.ensureThat(daysClosed >= -1, "Requested note limit is less than -1.");
    192         String url = "notes?limit=" + noteLimit + "&closed=" + daysClosed + "&bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2;
     192        String url = "notes?limit=" + noteLimit + "&closed=" + daysClosed + "&bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2;
    193193        try {
    194194            InputStream is = getInputStream(url, progressMonitor.createSubTaskMonitor(1, false));
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r8840 r8846  
    289289            while (entries.hasMoreElements()) {
    290290                ZipEntry entry = entries.nextElement();
    291                 if (entry.getName().endsWith("." + extension)) {
     291                if (entry.getName().endsWith('.' + extension)) {
    292292                    /* choose any file with correct extension. When more than
    293293                        one file, prefer the one which matches namepart */
     
    415415            if (ifModifiedSince != null && con.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
    416416                if (Main.isDebugEnabled()) {
    417                     Main.debug("304 Not Modified ("+urlStr+")");
     417                    Main.debug("304 Not Modified ("+urlStr+')');
    418418                }
    419419                if (localFile == null)
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r8540 r8846  
    4545    private static final String GPL_WARNING = "<html><font color='red' size='-2'>"
    4646        + tr("Note: GPL is not compatible with the OSM license. Do not upload GPL licensed tracks.") + "</html>";
     47
     48    private static final String[] LICENSES = {
     49            "Creative Commons By-SA",
     50            "Open Database License (ODbL)",
     51            "public domain",
     52            "GNU Lesser Public License (LGPL)",
     53            "BSD License (MIT/X11)"};
     54
     55    private static final String[] URLS = {
     56            "https://creativecommons.org/licenses/by-sa/3.0",
     57            "http://opendatacommons.org/licenses/odbl/1.0",
     58            "public domain",
     59            "https://www.gnu.org/copyleft/lesser.html",
     60            "http://www.opensource.org/licenses/bsd-license.php"};
    4761
    4862    /**
     
    292306            @Override
    293307            public void actionPerformed(ActionEvent e) {
    294                 final String[] licenses = {
    295                         "Creative Commons By-SA",
    296                         "Open Database License (ODbL)",
    297                         "public domain",
    298                         "GNU Lesser Public License (LGPL)",
    299                         "BSD License (MIT/X11)"};
    300                 JList<String> l = new JList<>(licenses);
    301                 l.setVisibleRowCount(licenses.length);
     308                JList<String> l = new JList<>(LICENSES);
     309                l.setVisibleRowCount(LICENSES.length);
    302310                l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    303311                int answer = JOptionPane.showConfirmDialog(
     
    310318                if (answer != JOptionPane.OK_OPTION || l.getSelectedIndex() == -1)
    311319                    return;
    312                 final String[] urls = {
    313                         "https://creativecommons.org/licenses/by-sa/3.0",
    314                         "http://opendatacommons.org/licenses/odbl/1.0",
    315                         "public domain",
    316                         "https://www.gnu.org/copyleft/lesser.html",
    317                         "http://www.opensource.org/licenses/bsd-license.php"};
    318320                String license = "";
    319321                for (int i : l.getSelectedIndices()) {
     
    322324                        break;
    323325                    }
    324                     license += license.isEmpty() ? urls[i] : ", "+urls[i];
     326                    license += license.isEmpty() ? URLS[i] : ", "+URLS[i];
    325327                }
    326328                copyright.setText(license);
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r8840 r8846  
    178178                    break;
    179179                case "email":
    180                     data.put(META_AUTHOR_EMAIL, atts.getValue("id") + "@" + atts.getValue("domain"));
     180                    data.put(META_AUTHOR_EMAIL, atts.getValue("id") + '@' + atts.getValue("domain"));
    181181                }
    182182                break;
     
    549549                if (e instanceof SAXParseException) {
    550550                    SAXParseException spe = (SAXParseException) e;
    551                     message += " " + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber());
     551                    message += ' ' + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber());
    552552                }
    553553                Main.warn(message);
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r8461 r8846  
    135135                String[] tmp = data.getString(META_AUTHOR_EMAIL).split("@");
    136136                if (tmp.length == 2) {
    137                     inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+"\"");
     137                    inline("email", "id=\"" + tmp[0] + "\" domain=\""+tmp[1]+'\"');
    138138                }
    139139            }
     
    146146        if (attr.containsKey(META_COPYRIGHT_LICENSE)
    147147                || attr.containsKey(META_COPYRIGHT_YEAR)) {
    148             openAtt("copyright", "author=\""+ data.get(META_COPYRIGHT_AUTHOR) +"\"");
     148            openAtt("copyright", "author=\""+ data.get(META_COPYRIGHT_AUTHOR) +'\"');
    149149            if (attr.containsKey(META_COPYRIGHT_YEAR)) {
    150150                simpleTag("year", (String) data.get(META_COPYRIGHT_YEAR));
     
    171171        if (bounds != null) {
    172172            String b = "minlat=\"" + bounds.getMinLat() + "\" minlon=\"" + bounds.getMinLon() +
    173             "\" maxlat=\"" + bounds.getMaxLat() + "\" maxlon=\"" + bounds.getMaxLon() + "\"";
     173            "\" maxlat=\"" + bounds.getMaxLat() + "\" maxlon=\"" + bounds.getMaxLon() + '\"';
    174174            inline("bounds", b);
    175175        }
     
    222222
    223223    private void open(String tag) {
    224         out.print(indent + "<" + tag + ">");
     224        out.print(indent + '<' + tag + '>');
    225225        indent += "  ";
    226226    }
    227227
    228228    private void openAtt(String tag, String attributes) {
    229         out.println(indent + "<" + tag + " " + attributes + ">");
     229        out.println(indent + '<' + tag + ' ' + attributes + '>');
    230230        indent += "  ";
    231231    }
    232232
    233233    private void inline(String tag, String attributes) {
    234         out.println(indent + "<" + tag + " " + attributes + "/>");
     234        out.println(indent + '<' + tag + ' ' + attributes + "/>");
    235235    }
    236236
    237237    private void close(String tag) {
    238238        indent = indent.substring(2);
    239         out.print(indent + "</" + tag + ">");
     239        out.print(indent + "</" + tag + '>');
    240240    }
    241241
     
    253253            open(tag);
    254254            out.print(encode(content));
    255             out.println("</" + tag + ">");
     255            out.println("</" + tag + '>');
    256256            indent = indent.substring(2);
    257257        }
     
    263263    private void gpxLink(GpxLink link) {
    264264        if (link != null) {
    265             openAtt("link", "href=\"" + link.uri + "\"");
     265            openAtt("link", "href=\"" + link.uri + '\"');
    266266            simpleTag("text", link.text);
    267267            simpleTag("type", link.type);
     
    290290        if (pnt != null) {
    291291            LatLon c = pnt.getCoor();
    292             String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + "\"";
     292            String coordAttr = "lat=\"" + c.lat() + "\" lon=\"" + c.lon() + '\"';
    293293            if (pnt.attr.isEmpty()) {
    294294                inline(type, coordAttr);
  • trunk/src/org/openstreetmap/josm/io/JpgImporter.java

    r8540 r8846  
    3636     */
    3737    public static final ExtensionFileFilter FILE_FILTER_WITH_FOLDERS = new ExtensionFileFilter(
    38             "jpg,jpeg", "jpg", tr("Image Files") + " (*.jpg, "+ tr("folder")+")");
     38            "jpg,jpeg", "jpg", tr("Image Files") + " (*.jpg, "+ tr("folder")+')');
    3939
    4040    /**
  • trunk/src/org/openstreetmap/josm/io/MessageNotifier.java

    r8840 r8846  
    7171                            panel.add(new JLabel(trn("You have {0} unread message.", "You have {0} unread messages.", unread, unread)),
    7272                                    GBC.eol());
    73                             panel.add(new UrlLabel(Main.getBaseUserUrl() + "/" + userInfo.getDisplayName() + "/inbox",
     73                            panel.add(new UrlLabel(Main.getBaseUserUrl() + '/' + userInfo.getDisplayName() + "/inbox",
    7474                                    tr("Click here to see your inbox.")), GBC.eol());
    7575                            panel.setOpaque(false);
     
    9797        } else if (!isRunning() && interval > 0 && isUserEnoughIdentified()) {
    9898            task = EXECUTOR.scheduleAtFixedRate(WORKER, 0, interval * 60, TimeUnit.SECONDS);
    99             Main.info("Message notifier active (checks every "+interval+" minute"+(interval > 1 ? "s" : "")+")");
     99            Main.info("Message notifier active (checks every "+interval+" minute"+(interval > 1 ? "s" : "")+')');
    100100        }
    101101    }
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r8734 r8846  
    351351        // Run the fetchers
    352352        for (int i = 0; i < jobs.size() && !isCanceled(); i++) {
    353             progressMonitor.subTask(msg + "... " + progressMonitor.getTicks() + "/" + progressMonitor.getTicksCount());
     353            progressMonitor.subTask(msg + "... " + progressMonitor.getTicks() + '/' + progressMonitor.getTicksCount());
    354354            try {
    355355                FetchResult result = ecs.take().get();
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r8840 r8846  
    378378            initialize(monitor);
    379379            // normal mode (0.6 and up) returns new object version.
    380             ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/" + osm.getId(), toXml(osm, true), monitor);
     380            ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+'/' + osm.getId(), toXml(osm, true), monitor);
    381381            osm.setOsmId(osm.getId(), Integer.parseInt(ret.trim()));
    382382            osm.setChangesetId(getChangeset().getId());
     
    623623            try {
    624624                url = new URL(new URL(getBaseUrl()), urlSuffix);
    625                 Main.info(requestMethod + " " + url + "... ");
     625                Main.info(requestMethod + ' ' + url + "... ");
    626626                Main.debug(requestBody);
    627627                // fix #5369, see http://www.tikalk.com/java/forums/httpurlconnection-disable-keep-alive
  • trunk/src/org/openstreetmap/josm/io/OsmConnection.java

    r8840 r8846  
    9595            String username = response.getUsername() == null ? "" : response.getUsername();
    9696            String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword());
    97             token = username + ":" + password;
     97            token = username + ':' + password;
    9898            try {
    9999                ByteBuffer bytes = encoder.encode(CharBuffer.wrap(token));
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r8291 r8846  
    8686            // a truncated file.  That can destroy lots of work.
    8787            if (file.exists()) {
    88                 tmpFile = new File(file.getPath() + "~");
     88                tmpFile = new File(file.getPath() + '~');
    8989                Utils.copyFile(file, tmpFile);
    9090            }
  • trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java

    r8347 r8846  
    4040            if (locator == null)
    4141                return "";
    42             return "(" + locator.getLineNumber() + "," + locator.getColumnNumber() + ")";
     42            return "(" + locator.getLineNumber() + ',' + locator.getColumnNumber() + ')';
    4343        }
    4444
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r8836 r8846  
    562562            if (getLocation() == null)
    563563                return msg;
    564             msg += " " + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());
     564            msg += ' ' + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());
    565565            int offset = getLocation().getCharacterOffset();
    566566            if (offset > -1) {
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r8840 r8846  
    152152            try {
    153153                if (reason != null && !reason.isEmpty()) {
    154                     Main.info("GET " + url + " (" + reason + ")");
     154                    Main.info("GET " + url + " (" + reason + ')');
    155155                } else {
    156156                    Main.info("GET " + url);
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r8840 r8846  
    7171        long minutes_left = ms_left / MSECS_PER_MINUTE;
    7272        long seconds_left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE;
    73         String time_left_str = Long.toString(minutes_left) + ":";
     73        String time_left_str = Long.toString(minutes_left) + ':';
    7474        if (seconds_left < 10) {
    75             time_left_str += "0";
     75            time_left_str += '0';
    7676        }
    7777        return time_left_str + Long.toString(seconds_left);
  • trunk/src/org/openstreetmap/josm/io/OsmWriter.java

    r8565 r8846  
    185185            if (n.getCoor() != null) {
    186186                out.print(" lat='"+LatLon.cDdHighPecisionFormatter.format(n.getCoor().lat())+
    187                           "' lon='"+LatLon.cDdHighPecisionFormatter.format(n.getCoor().lon())+"'");
     187                          "' lon='"+LatLon.cDdHighPecisionFormatter.format(n.getCoor().lon())+'\'');
    188188            }
    189189            addTags(n, "node", true);
     
    226226    public void visit(Changeset cs) {
    227227        out.print("  <changeset ");
    228         out.print(" id='"+cs.getId()+"'");
     228        out.print(" id='"+cs.getId()+'\'');
    229229        if (cs.getUser() != null) {
    230             out.print(" user='"+cs.getUser().getName() +"'");
    231             out.print(" uid='"+cs.getUser().getId() +"'");
     230            out.print(" user='"+cs.getUser().getName() +'\'');
     231            out.print(" uid='"+cs.getUser().getId() +'\'');
    232232        }
    233233        if (cs.getCreatedAt() != null) {
    234             out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) +"'");
     234            out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) +'\'');
    235235        }
    236236        if (cs.getClosedAt() != null) {
    237             out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) +"'");
    238         }
    239         out.print(" open='"+ (cs.isOpen() ? "true" : "false") +"'");
     237            out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) +'\'');
     238        }
     239        out.print(" open='"+ (cs.isOpen() ? "true" : "false") +'\'');
    240240        if (cs.getMin() != null) {
    241             out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
    242             out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
     241            out.print(" min_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
     242            out.print(" min_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
    243243        }
    244244        if (cs.getMax() != null) {
    245             out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
    246             out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +"'");
     245            out.print(" max_lon='"+ cs.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
     246            out.print(" max_lat='"+ cs.getMin().latToString(CoordinateFormat.DECIMAL_DEGREES) +'\'');
    247247        }
    248248        out.println(">");
     
    268268                        "' v='"+XmlWriter.encode(e.getValue())+ "' />");
    269269            }
    270             out.println("  </" + tagname + ">");
     270            out.println("  </" + tagname + '>');
    271271        } else if (tagOpen) {
    272272            out.println(" />");
    273273        } else {
    274             out.println("  </" + tagname + ">");
     274            out.println("  </" + tagname + '>');
    275275        }
    276276    }
     
    283283        out.print("  <"+tagname);
    284284        if (osm.getUniqueId() != 0) {
    285             out.print(" id='"+ osm.getUniqueId()+"'");
     285            out.print(" id='"+ osm.getUniqueId()+'\'');
    286286        } else
    287287            throw new IllegalStateException(tr("Unexpected id 0 for osm primitive found"));
     
    295295                }
    296296                if (action != null) {
    297                     out.print(" action='"+action+"'");
     297                    out.print(" action='"+action+'\'');
    298298                }
    299299            }
    300300            if (!osm.isTimestampEmpty()) {
    301                 out.print(" timestamp='"+DateUtils.fromTimestamp(osm.getRawTimestamp())+"'");
     301                out.print(" timestamp='"+DateUtils.fromTimestamp(osm.getRawTimestamp())+'\'');
    302302            }
    303303            // user and visible added with 0.4 API
    304304            if (osm.getUser() != null) {
    305305                if (osm.getUser().isLocalUser()) {
    306                     out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'");
     306                    out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+'\'');
    307307                } else if (osm.getUser().isOsmUser()) {
    308308                    // uid added with 0.6
    309                     out.print(" uid='"+ osm.getUser().getId()+"'");
    310                     out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+"'");
     309                    out.print(" uid='"+ osm.getUser().getId()+'\'');
     310                    out.print(" user='"+XmlWriter.encode(osm.getUser().getName())+'\'');
    311311                }
    312312            }
    313             out.print(" visible='"+osm.isVisible()+"'");
     313            out.print(" visible='"+osm.isVisible()+'\'');
    314314        }
    315315        if (osm.getVersion() != 0) {
    316             out.print(" version='"+osm.getVersion()+"'");
     316            out.print(" version='"+osm.getVersion()+'\'');
    317317        }
    318318        if (this.changeset != null && this.changeset.getId() != 0) {
    319             out.print(" changeset='"+this.changeset.getId()+"'");
     319            out.print(" changeset='"+this.changeset.getId()+'\'');
    320320        } else if (osm.getChangesetId() > 0 && !osm.isNew()) {
    321             out.print(" changeset='"+osm.getChangesetId()+"'");
     321            out.print(" changeset='"+osm.getChangesetId()+'\'');
    322322        }
    323323    }
  • trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java

    r8788 r8846  
    5050            String realQuery = completeOverpassQuery(overpassQuery);
    5151            return "interpreter?data=" + Utils.encodeUrl(realQuery)
    52                     + "&bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2;
     52                    + "&bbox=" + lon1 + ',' + lat1 + ',' + lon2 + ',' + lat2;
    5353        }
    5454    }
    5555
    5656    private String completeOverpassQuery(String query) {
    57         int firstColon = query.indexOf(";");
     57        int firstColon = query.indexOf(';');
    5858        if (firstColon == -1) {
    5959            return "[bbox];" + query;
  • trunk/src/org/openstreetmap/josm/io/auth/DefaultAuthenticator.java

    r8510 r8846  
    5555            if (response == null || response.isCanceled())
    5656                return null;
    57             credentialsTried.put(getRequestorType(), true);
     57            credentialsTried.put(getRequestorType(), Boolean.TRUE);
    5858            return new PasswordAuthentication(response.getUsername(), response.getPassword());
    5959        } catch (CredentialsAgentException e) {
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r8510 r8846  
    149149                    try {
    150150                        bounds = new ImageryBounds(
    151                                 atts.getValue("min-lat") + "," +
    152                                         atts.getValue("min-lon") + "," +
    153                                         atts.getValue("max-lat") + "," +
     151                                atts.getValue("min-lat") + ',' +
     152                                        atts.getValue("min-lon") + ',' +
     153                                        atts.getValue("max-lat") + ',' +
    154154                                        atts.getValue("max-lon"), ",");
    155155                    } catch (IllegalArgumentException e) {
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r8650 r8846  
    121121                final String getCapabilitiesQuery = "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities";
    122122                if (getCapabilitiesUrl.getQuery() == null) {
    123                     getCapabilitiesUrl = new URL(serviceUrlStr + "?" + getCapabilitiesQuery);
     123                    getCapabilitiesUrl = new URL(serviceUrlStr + '?' + getCapabilitiesQuery);
    124124                } else if (!getCapabilitiesUrl.getQuery().isEmpty() && !getCapabilitiesUrl.getQuery().endsWith("&")) {
    125                     getCapabilitiesUrl = new URL(serviceUrlStr + "&" + getCapabilitiesQuery);
     125                    getCapabilitiesUrl = new URL(serviceUrlStr + '&' + getCapabilitiesQuery);
    126126                } else {
    127127                    getCapabilitiesUrl = new URL(serviceUrlStr + getCapabilitiesQuery);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r8510 r8846  
    109109            command = command.substring(1);
    110110        }
    111         String commandWithSlash = "/" + command;
     111        String commandWithSlash = '/' + command;
    112112        if (handlers.get(commandWithSlash) != null) {
    113113            Main.info("RemoteControl: ignoring duplicate command " + command
     
    116116            if (!silent) {
    117117                Main.info("RemoteControl: adding command \"" +
    118                     command + "\" (handled by " + handler.getSimpleName() + ")");
     118                    command + "\" (handled by " + handler.getSimpleName() + ')');
    119119            }
    120120            handlers.put(commandWithSlash, handler);
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r8510 r8846  
    8181
    8282        // Parse the arguments
    83         Main.info("Adding node at (" + lat + ", " + lon + ")");
     83        Main.info("Adding node at (" + lat + ", " + lon + ')');
    8484
    8585        // Create a new node
     
    118118            lon = Double.parseDouble(args.get("lon"));
    119119        } catch (NumberFormatException e) {
    120             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
     120            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
    121121        }
    122122        if (!Main.main.hasEditLayer()) {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r8540 r8846  
    106106                allCoordinates.add(new LatLon(lat, lon));
    107107            } catch (NumberFormatException e) {
    108                 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
     108                throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
    109109            }
    110110        }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/FeaturesHandler.java

    r8510 r8846  
    3333                   buf.append(", ");
    3434               }
    35                String info = RequestProcessor.getHandlerInfoAsJSON("/"+s);
     35               String info = RequestProcessor.getHandlerInfoAsJSON('/'+s);
    3636               if (info != null) {
    3737                   buf.append(info);
     
    4848        contentType = "application/json";
    4949        if (args.containsKey("jsonp")) {
    50             content = args.get("jsonp") + " && " + args.get("jsonp") + "(" + content + ")";
     50            content = args.get("jsonp") + " && " + args.get("jsonp") + '(' + content + ')';
    5151        }
    5252    }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r8811 r8846  
    274274            maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("right")));
    275275        } catch (NumberFormatException e) {
    276             throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
     276            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e);
    277277        }
    278278
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r8510 r8846  
    224224            if (value == null || value.isEmpty()) {
    225225                error = true;
    226                 Main.warn("'" + myCommand + "' remote control request must have '" + key + "' parameter");
     226                Main.warn('\'' + myCommand + "' remote control request must have '" + key + "' parameter");
    227227                missingKeys.add(key);
    228228            }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/VersionHandler.java

    r8444 r8846  
    2323        contentType = "application/json";
    2424        if (args.containsKey("jsonp")) {
    25             content = args.get("jsonp") + " && " + args.get("jsonp") + "(" + content + ")";
     25            content = args.get("jsonp") + " && " + args.get("jsonp") + "(" + content + ')';
    2626        }
    2727    }
  • trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java

    r8540 r8846  
    106106        List<SessionReader.LayerDependency> deps = support.getLayerDependencies();
    107107        if (!deps.isEmpty()) {
    108             Layer layer = deps.iterator().next().getLayer();
     108            Layer layer = deps.get(0).getLayer();
    109109            if (layer instanceof GpxLayer) {
    110110                gpxLayer = (GpxLayer) layer;
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r8803 r8846  
    4949            AbstractTileSourceLayer tsLayer = (AbstractTileSourceLayer) layer;
    5050            if (attributes.containsKey("automatic-downloading")) {
    51                 tsLayer.autoLoad = Boolean.valueOf(attributes.get("automatic-downloading"));
     51                tsLayer.autoLoad = Boolean.parseBoolean(attributes.get("automatic-downloading"));
    5252            }
    5353
    5454            if (attributes.containsKey("automatically-change-resolution")) {
    55                 tsLayer.autoZoom = Boolean.valueOf(attributes.get("automatically-change-resolution"));
     55                tsLayer.autoZoom = Boolean.parseBoolean(attributes.get("automatically-change-resolution"));
    5656            }
    5757
    5858            if (attributes.containsKey("show-errors")) {
    59                 tsLayer.showErrors = Boolean.valueOf(attributes.get("show-errors"));
     59                tsLayer.showErrors = Boolean.parseBoolean(attributes.get("show-errors"));
    6060            }
    6161        }
  • trunk/src/org/openstreetmap/josm/io/session/MarkerSessionImporter.java

    r8509 r8846  
    4949                List<SessionReader.LayerDependency> deps = support.getLayerDependencies();
    5050                if (!deps.isEmpty()) {
    51                     Layer layer = deps.iterator().next().getLayer();
     51                    Layer layer = deps.get(0).getLayer();
    5252                    if (layer instanceof GpxLayer) {
    5353                        gpxLayer = (GpxLayer) layer;
Note: See TracChangeset for help on using the changeset viewer.