[josm-dev] patch for JOSM runtime error on MacOS
A Morris
aledmorris2 at gmail.com
Sat Aug 23 21:01:11 BST 2008
I am trying to run the latest SVN revision of JOSM in eclipse on a
Mac. The code builds, but does not run; it hangs inside the native
method Object.wait() in ElemStyleHandler. The offending line is:
curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
I note that the file 'misc/no_icon.png' (which it is trying to load)
does not exist anywhere in my filesystem. (Actually neither does
'amenity.png').
I have applied the following patch which seems to have fixed the
problem on my system (the hang, that is, not the fact that icons seem
to be missing):
=== modified file
'src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java'
--- old/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
2008-08-16 22:26:23 +0000
+++ new/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
2008-08-23 19:48:37 +0000
@@ -109,14 +109,21 @@
/*
icon not found, using default */
System.out.println("Mappaint: Icon " + atts.getValue(count) + " not
found, using default icon");
path =
getClass().getResource(MapPaintStyles.getInternalImageDir()+"misc/no_icon.png");
-
curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
+ }
+ if (path == null) {
+ /*
default icon not found */
+
System.out.println("Mappaint: Default icon not found, using 'amenity'
icon");
+ path =
getClass().getResource(MapPaintStyles.getInternalImageDir()+"incomming/amenity.png");
+ }
+ if (path == null) {
+
System.out.println("Mappaint: 'amenity' icon not found, giving up");
+ curIcon = null;
} else {
curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
}
}
- catch (Exception e){
- URL path =
getClass().getResource(MapPaintStyles.getInternalImageDir()+"incomming/amenity.png");
- curIcon = new
ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
+ catch (Exception e) {
+
System.out.println("Mappaint: Exception while loading icon " +
atts.getValue(count));
}
} else if
(atts.getQName(count).equals("annotate")) {
curIconAnnotate =
Boolean.parseBoolean (atts.getValue(count));
Cheers, Aled.
More information about the josm-dev
mailing list