Index: trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 4164)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 4167)
@@ -940,18 +940,23 @@
      *
      * @param ex the exception
-     * @return the plugin; null, if the exception proably wasn't thrown from a plugin
+     * @return the plugin; null, if the exception probably wasn't thrown from a plugin
      */
     private static PluginProxy getPluginCausingException(Throwable ex) {
+        PluginProxy err = null;
+        StackTraceElement[] stack = ex.getStackTrace();
+        /* remember the error position, as multiple plugins may be involved,
+           we search the topmost one */
+        int pos = stack.length;
         for (PluginProxy p : pluginList) {
             String baseClass = p.getPluginInformation().className;
-            int i = baseClass.lastIndexOf(".");
-            baseClass = baseClass.substring(0, i);
-            for (StackTraceElement element : ex.getStackTrace()) {
-                String c = element.getClassName();
-                if (c.startsWith(baseClass))
-                    return p;
-            }
-        }
-        return null;
+            baseClass = baseClass.substring(0, baseClass.lastIndexOf("."));
+            for (int elpos = 0; elpos < pos; ++elpos) {
+                if (stack[elpos].getClassName().startsWith(baseClass)) {
+                    pos = elpos;
+                    err = p;
+                }
+            }
+        }
+        return err;
     }
 
