Index: trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java	(revision 3363)
+++ trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java	(revision 3365)
@@ -517,12 +517,20 @@
     private static void extractExif(ImageEntry e) {
 
+        int deg;
+        double min, sec;
+        double lon, lat;
+        Metadata metadata = null;
+        Directory dir = null;
+        
         try {
-            int deg;
-            double min, sec;
-            double lon, lat;
-
-            Metadata metadata = JpegMetadataReader.readMetadata(e.getFile());
-            Directory dir = metadata.getDirectory(GpsDirectory.class);
-
+            metadata = JpegMetadataReader.readMetadata(e.getFile());
+            dir = metadata.getDirectory(GpsDirectory.class);
+        } catch (CompoundException p) {
+            e.setExifCoor(null);
+            e.setPos(null);
+            return;
+        }
+        
+        try {
             // longitude
 
@@ -553,27 +561,40 @@
             }
 
-
-            // compass direction value
-
-            Rational direction = null;
-            
-            try {
-                direction = dir.getRational(GpsDirectory.TAG_GPS_IMG_DIRECTION);
-            } catch (CompoundException p) {
-                direction = null;
-            }
-
             // Store values
 
             e.setExifCoor(new LatLon(lat, lon));
             e.setPos(e.getExifCoor());
-            if (direction != null) {
-                e.setExifImgDir(direction.doubleValue());
-            }
 
         } catch (CompoundException p) {
-            e.setExifCoor(null);
-            e.setPos(null);
-        }
+            // Try to read lon/lat as double value (Nonstandard, created by some cameras -> #5220)
+            try {
+                Double longitude = dir.getDouble(GpsDirectory.TAG_GPS_LONGITUDE);
+                Double latitude = dir.getDouble(GpsDirectory.TAG_GPS_LATITUDE);
+                if (longitude == null || latitude == null)
+                    throw new CompoundException("");
+
+                // Store values
+
+                e.setExifCoor(new LatLon(latitude, longitude));
+                e.setPos(e.getExifCoor());
+            } catch (CompoundException ex) {
+                e.setExifCoor(null);
+                e.setPos(null);
+            }
+        }
+
+        // compass direction value
+
+        Rational direction = null;
+        
+        try {
+            direction = dir.getRational(GpsDirectory.TAG_GPS_IMG_DIRECTION);
+        } catch (CompoundException p) {
+            direction = null;
+        }
+        if (direction != null) {
+            e.setExifImgDir(direction.doubleValue());
+        }
+
     }
 
@@ -605,5 +626,4 @@
 
     public void checkPreviousNextButtons() {
-        //        System.err.println("showing image " + currentPhoto);
         ImageViewerDialog.setNextEnabled(currentPhoto < data.size() - 1);
         ImageViewerDialog.setPreviousEnabled(currentPhoto > 0);
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 3363)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 3365)
@@ -204,5 +204,7 @@
         osmWriter.footer();
         osmWriter.out.flush();
-        return swriter.toString();
+        String s = swriter.toString();
+        System.err.println("OsmApi/toXml:\n"+s+"_|");
+        return s;
     }
 
Index: trunk/src/org/openstreetmap/josm/io/OsmChangeBuilder.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmChangeBuilder.java	(revision 3363)
+++ trunk/src/org/openstreetmap/josm/io/OsmChangeBuilder.java	(revision 3365)
@@ -130,5 +130,7 @@
 
     public String getDocument() {
-        return swriter.toString();
+        String s = swriter.toString();
+        System.err.println("OsmChangeBuilder/getDocument:\n"+s+"_|");
+        return s;
     }
 }
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 3363)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 3365)
@@ -88,5 +88,6 @@
     /**
      * Like {@link #get(String)}, but does not throw and return <code>null</code> in case of nothing
-     * is found. Use this, if the image to retrieve is optional.
+     * is found. Use this, if the image to retrieve is optional. Nevertheless a warning will
+     * be printed on the console if the image could not be found.
      */
     public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name) {
@@ -94,4 +95,14 @@
     }
 
+    /**
+     * The full path of the image is either a url (starting with http://)
+     * or something like
+     *   dirs.get(i)+"/"+subdir+"/"+name+".png".
+     * @param dirs      Directories to look.
+     * @param id        An id used for caching. Id is not used for cache if name starts with http://. (URL is unique anyway.)
+     * @param subdir    Subdirectory the image lies in.
+     * @param name      The name of the image. If it contains no '.', a png extension is added.
+     * @param archive   A zip file where the image is located.
+     */
     public static ImageIcon getIfAvailable(Collection<String> dirs, String id, String subdir, String name, File archive) {
         if (name == null)
