Index: /trunk/.settings/edu.umd.cs.findbugs.core.prefs
===================================================================
--- /trunk/.settings/edu.umd.cs.findbugs.core.prefs	(revision 4867)
+++ /trunk/.settings/edu.umd.cs.findbugs.core.prefs	(revision 4868)
@@ -1,4 +1,4 @@
 #FindBugs User Preferences
-#Sat Jan 21 17:37:33 CET 2012
+#Tue Jan 24 21:25:31 CET 2012
 cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
 detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
@@ -128,5 +128,5 @@
 effort=max
 excludefilter0=tools/findbugs/josm-filter.xml|true
-filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MT_CORRECTNESS,PERFORMANCE,STYLE|false|16
-filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY|
+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,STYLE|false|16
+filter_settings_neg=NOISE,I18N,SECURITY|
 run_at_full_build=false
Index: /trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 4867)
+++ /trunk/src/org/openstreetmap/josm/actions/PurgeAction.java	(revision 4868)
@@ -221,6 +221,6 @@
                 tr("This operation makes JOSM forget the selected objects.<br> " +
                         "They will be removed from the layer, but <i>not</i> deleted<br> " +
-                "on the server when uploading.")+"</html>",
-                ImageProvider.get("purge"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
+                        "on the server when uploading.")+"</html>",
+                        ImageProvider.get("purge"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
 
         if (!toPurgeAdditionally.isEmpty()) {
@@ -228,12 +228,12 @@
             pnl.add(new JLabel("<html>"+
                     tr("The following dependent objects will be purged<br> " +
-                    "in addition to the selected objects:")+"</html>",
-                    ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
+                            "in addition to the selected objects:")+"</html>",
+                            ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL));
 
             Collections.sort(toPurgeAdditionally, new Comparator<OsmPrimitive>() {
                 public int compare(OsmPrimitive o1, OsmPrimitive o2) {
-                    int type = o1.getType().compareTo(o2.getType());
+                    int type = o2.getType().compareTo(o1.getType());
                     if (type != 0)
-                        return -type;
+                        return type;
                     return (Long.valueOf(o1.getUniqueId())).compareTo(o2.getUniqueId());
                 }
Index: /trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java	(revision 4867)
+++ /trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java	(revision 4868)
@@ -92,7 +92,7 @@
         @Override public double lonToTileX(double lon, int zoom) { return source.lonToTileX(lon,zoom); }
 
-        @Override public double tileYToLat(int y, int zoom) { return tileYToLat(y, zoom); }
-
-        @Override public double tileXToLon(int x, int zoom) { return tileXToLon(x, zoom); }
+        @Override public double tileYToLat(int y, int zoom) { return source.tileYToLat(y, zoom); }
+
+        @Override public double tileXToLon(int x, int zoom) { return source.tileXToLon(x, zoom); }
     }
 
@@ -157,5 +157,5 @@
                         new RenamedSourceDecorator(new OsmTileSource.TilesAtHome(), "Osmarender"),
                         new RenamedSourceDecorator(new OsmTileSource.CycleMap(), "Cyclemap")
-                );
+                        );
             }
         });
@@ -317,9 +317,9 @@
                         Math.min(l2.getLat(), l1.getLat()),
                         LatLon.toIntervalLon(Math.min(l1.getLon(), l2.getLon()))
-                ),
-                new LatLon(
-                        Math.max(l2.getLat(), l1.getLat()),
-                        LatLon.toIntervalLon(Math.max(l1.getLon(), l2.getLon())))
-        );
+                        ),
+                        new LatLon(
+                                Math.max(l2.getLat(), l1.getLat()),
+                                LatLon.toIntervalLon(Math.max(l1.getLon(), l2.getLon())))
+                );
         Bounds oldValue = this.bbox;
         this.bbox = b;
@@ -355,5 +355,5 @@
     public void setBoundingBox(Bounds bbox) {
         if (bbox == null || (bbox.getMin().lat() == 0.0 && bbox.getMin().lon() == 0.0
-        && bbox.getMax().lat() == 0.0 && bbox.getMax().lon() == 0.0)) {
+                && bbox.getMax().lat() == 0.0 && bbox.getMax().lon() == 0.0)) {
             this.bbox = null;
             iSelectionRectStart = null;
@@ -366,5 +366,5 @@
         double minLon = bbox.getMin().lon();
         double maxLon = bbox.getMax().lon();
-        
+
         if (bbox.crosses180thMeridian()) {
             minLon -= 360.0;
@@ -375,5 +375,5 @@
         int x1 = OsmMercator.LonToX(minLon, MAX_ZOOM);
         int x2 = OsmMercator.LonToX(maxLon, MAX_ZOOM);
-        
+
         iSelectionRectStart = new Point(Math.min(x1, x2), Math.min(y1, y2));
         iSelectionRectEnd = new Point(Math.max(x1, x2), Math.max(y1, y2));
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java	(revision 4867)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java	(revision 4868)
@@ -90,5 +90,5 @@
         int result = 1;
         result = prime * result
-        + ((priority == null) ? 0 : priority.hashCode());
+                + ((priority == null) ? 0 : priority.hashCode());
         result = prime * result + ((value == null) ? 0 : value.hashCode());
         return result;
@@ -117,6 +117,5 @@
 
     public int compareTo(AutoCompletionListItem other) {
-        int ret = this.priority.compareTo(other.priority);
-        ret = -ret; // higher priority items come first in the list
+        int ret = other.priority.compareTo(priority); // higher priority items come first in the list
         if (ret != 0)
             return ret;
Index: /trunk/src/org/openstreetmap/josm/io/imagery/OsmosnimkiOffsetServer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/OsmosnimkiOffsetServer.java	(revision 4867)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/OsmosnimkiOffsetServer.java	(revision 4868)
@@ -31,4 +31,6 @@
             String response = rdr.readLine();
             System.out.println(tr("Offset server response: {0}", response));
+            if (response == null)
+                return false;
             if (response.contains("\"offsets_available\": true")) return true;
         } catch (Exception e) {
@@ -46,4 +48,6 @@
             final BufferedReader rdr = new BufferedReader(new InputStreamReader(url.openConnection().getInputStream(), "UTF-8"));
             String s = rdr.readLine();
+            if (s == null)
+                return null;
             int i = s.indexOf(',');
             if (i == -1) return null;
Index: /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 4867)
+++ /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 4868)
@@ -149,16 +149,16 @@
         public InputStream getInputStream(String uriStr) throws IOException {
             File file = getFile(uriStr);
-            try {
-                if (file != null)
+            if (file != null) {
+                try {
                     return new BufferedInputStream(new FileInputStream(file));
-                else if (inZipPath != null) {
-                    ZipEntry entry = zipFile.getEntry(inZipPath);
-                    if (entry != null) {
-                        InputStream is = zipFile.getInputStream(entry);
-                        return is;
-                    }
-                }
-            } catch (FileNotFoundException e) {
-                throw new IOException(tr("File ''{0}'' does not exist.", file.getPath()));
+                } catch (FileNotFoundException e) {
+                    throw new IOException(tr("File ''{0}'' does not exist.", file.getPath()));
+                }
+            } else if (inZipPath != null) {
+                ZipEntry entry = zipFile.getEntry(inZipPath);
+                if (entry != null) {
+                    InputStream is = zipFile.getInputStream(entry);
+                    return is;
+                }
             }
             throw new IOException(tr("Unable to locate file  ''{0}''.", uriStr));
