Changeset 4868 in josm


Ignore:
Timestamp:
2012-01-24T21:28:35+01:00 (12 years ago)
Author:
jttt
Message:

fix some warnings

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33build
        44plugin-check
         5findbugs-josm.xml
  • trunk/.settings/edu.umd.cs.findbugs.core.prefs

    r4838 r4868  
    11#FindBugs User Preferences
    2 #Sat Jan 21 17:37:33 CET 2012
     2#Tue Jan 24 21:25:31 CET 2012
    33cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
    44detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
     
    128128effort=max
    129129excludefilter0=tools/findbugs/josm-filter.xml|true
    130 filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MT_CORRECTNESS,PERFORMANCE,STYLE|false|16
    131 filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY|
     130filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,STYLE|false|16
     131filter_settings_neg=NOISE,I18N,SECURITY|
    132132run_at_full_build=false
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r4064 r4868  
    221221                tr("This operation makes JOSM forget the selected objects.<br> " +
    222222                        "They will be removed from the layer, but <i>not</i> deleted<br> " +
    223                 "on the server when uploading.")+"</html>",
    224                 ImageProvider.get("purge"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
     223                        "on the server when uploading.")+"</html>",
     224                        ImageProvider.get("purge"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
    225225
    226226        if (!toPurgeAdditionally.isEmpty()) {
     
    228228            pnl.add(new JLabel("<html>"+
    229229                    tr("The following dependent objects will be purged<br> " +
    230                     "in addition to the selected objects:")+"</html>",
    231                     ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
     230                            "in addition to the selected objects:")+"</html>",
     231                            ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
    232232
    233233            Collections.sort(toPurgeAdditionally, new Comparator<OsmPrimitive>() {
    234234                public int compare(OsmPrimitive o1, OsmPrimitive o2) {
    235                     int type = o1.getType().compareTo(o2.getType());
     235                    int type = o2.getType().compareTo(o1.getType());
    236236                    if (type != 0)
    237                         return -type;
     237                        return type;
    238238                    return (Long.valueOf(o1.getUniqueId())).compareTo(o2.getUniqueId());
    239239                }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r4860 r4868  
    9292        @Override public double lonToTileX(double lon, int zoom) { return source.lonToTileX(lon,zoom); }
    9393
    94         @Override public double tileYToLat(int y, int zoom) { return tileYToLat(y, zoom); }
    95 
    96         @Override public double tileXToLon(int x, int zoom) { return tileXToLon(x, zoom); }
     94        @Override public double tileYToLat(int y, int zoom) { return source.tileYToLat(y, zoom); }
     95
     96        @Override public double tileXToLon(int x, int zoom) { return source.tileXToLon(x, zoom); }
    9797    }
    9898
     
    157157                        new RenamedSourceDecorator(new OsmTileSource.TilesAtHome(), "Osmarender"),
    158158                        new RenamedSourceDecorator(new OsmTileSource.CycleMap(), "Cyclemap")
    159                 );
     159                        );
    160160            }
    161161        });
     
    317317                        Math.min(l2.getLat(), l1.getLat()),
    318318                        LatLon.toIntervalLon(Math.min(l1.getLon(), l2.getLon()))
    319                 ),
    320                 new LatLon(
    321                         Math.max(l2.getLat(), l1.getLat()),
    322                         LatLon.toIntervalLon(Math.max(l1.getLon(), l2.getLon())))
    323         );
     319                        ),
     320                        new LatLon(
     321                                Math.max(l2.getLat(), l1.getLat()),
     322                                LatLon.toIntervalLon(Math.max(l1.getLon(), l2.getLon())))
     323                );
    324324        Bounds oldValue = this.bbox;
    325325        this.bbox = b;
     
    355355    public void setBoundingBox(Bounds bbox) {
    356356        if (bbox == null || (bbox.getMin().lat() == 0.0 && bbox.getMin().lon() == 0.0
    357         && bbox.getMax().lat() == 0.0 && bbox.getMax().lon() == 0.0)) {
     357                && bbox.getMax().lat() == 0.0 && bbox.getMax().lon() == 0.0)) {
    358358            this.bbox = null;
    359359            iSelectionRectStart = null;
     
    366366        double minLon = bbox.getMin().lon();
    367367        double maxLon = bbox.getMax().lon();
    368        
     368
    369369        if (bbox.crosses180thMeridian()) {
    370370            minLon -= 360.0;
     
    375375        int x1 = OsmMercator.LonToX(minLon, MAX_ZOOM);
    376376        int x2 = OsmMercator.LonToX(maxLon, MAX_ZOOM);
    377        
     377
    378378        iSelectionRectStart = new Point(Math.min(x1, x2), Math.min(y1, y2));
    379379        iSelectionRectEnd = new Point(Math.max(x1, x2), Math.max(y1, y2));
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java

    r3215 r4868  
    9090        int result = 1;
    9191        result = prime * result
    92         + ((priority == null) ? 0 : priority.hashCode());
     92                + ((priority == null) ? 0 : priority.hashCode());
    9393        result = prime * result + ((value == null) ? 0 : value.hashCode());
    9494        return result;
     
    117117
    118118    public int compareTo(AutoCompletionListItem other) {
    119         int ret = this.priority.compareTo(other.priority);
    120         ret = -ret; // higher priority items come first in the list
     119        int ret = other.priority.compareTo(priority); // higher priority items come first in the list
    121120        if (ret != 0)
    122121            return ret;
  • trunk/src/org/openstreetmap/josm/io/imagery/OsmosnimkiOffsetServer.java

    r4240 r4868  
    3131            String response = rdr.readLine();
    3232            System.out.println(tr("Offset server response: {0}", response));
     33            if (response == null)
     34                return false;
    3335            if (response.contains("\"offsets_available\": true")) return true;
    3436        } catch (Exception e) {
     
    4648            final BufferedReader rdr = new BufferedReader(new InputStreamReader(url.openConnection().getInputStream(), "UTF-8"));
    4749            String s = rdr.readLine();
     50            if (s == null)
     51                return null;
    4852            int i = s.indexOf(',');
    4953            if (i == -1) return null;
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r4718 r4868  
    149149        public InputStream getInputStream(String uriStr) throws IOException {
    150150            File file = getFile(uriStr);
    151             try {
    152                 if (file != null)
     151            if (file != null) {
     152                try {
    153153                    return new BufferedInputStream(new FileInputStream(file));
    154                 else if (inZipPath != null) {
    155                     ZipEntry entry = zipFile.getEntry(inZipPath);
    156                     if (entry != null) {
    157                         InputStream is = zipFile.getInputStream(entry);
    158                         return is;
    159                     }
    160                 }
    161             } catch (FileNotFoundException e) {
    162                 throw new IOException(tr("File ''{0}'' does not exist.", file.getPath()));
     154                } catch (FileNotFoundException e) {
     155                    throw new IOException(tr("File ''{0}'' does not exist.", file.getPath()));
     156                }
     157            } else if (inZipPath != null) {
     158                ZipEntry entry = zipFile.getEntry(inZipPath);
     159                if (entry != null) {
     160                    InputStream is = zipFile.getInputStream(entry);
     161                    return is;
     162                }
    163163            }
    164164            throw new IOException(tr("Unable to locate file  ''{0}''.", uriStr));
Note: See TracChangeset for help on using the changeset viewer.