Hi,

if a JPF plugin is missing a plugin.xml file, the JPF runtime returns null as a plugin location. This special case is not handled by the TaskRegistrar which passes the null location to the PluginLoader which in turn crashes with an inconclusive NPE (see for example this post [1]).

The attached patch filters null locations and emits a warning if a null location is encountered. The patch applies to current trunk.

Bye
Igor
diff --git a/core/src/org/openstreetmap/osmosis/core/TaskRegistrar.java 
b/core/src/org/openstreetmap/osmosis/core/TaskRegistrar.java
index 17d5323..6875569 100644
--- a/core/src/org/openstreetmap/osmosis/core/TaskRegistrar.java
+++ b/core/src/org/openstreetmap/osmosis/core/TaskRegistrar.java
@@ -279,7 +279,14 @@ public class TaskRegistrar {
                        try {
                                for (int i = 0; i < plugins.length; i++) {
                                        LOG.finest("Found plugin " + 
plugins[i].getAbsolutePath());
-                                       
locations.add(StandardPluginLocation.create(plugins[i]));
+                                       PluginLocation location = 
StandardPluginLocation.create(plugins[i]);
+
+                                       if (location != null) {
+                                               locations.add(location);
+                                       } else {
+                                               LOG.warning("JPF Plugin " + 
plugins[i].getAbsolutePath()
+                                                               + " is 
malformed and cannot be loaded.");
+                                       }
                                }
                        } catch (MalformedURLException e) {
                                throw new OsmosisRuntimeException("Cannot 
create plugin location " + pluginDir.getAbsolutePath(), e);
_______________________________________________
osmosis-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/osmosis-dev

Reply via email to