You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/07/27 12:15:36 UTC

svn commit: r1151416 - /pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java

Author: noelgrandin
Date: Wed Jul 27 10:15:35 2011
New Revision: 1151416

URL: http://svn.apache.org/viewvc?rev=1151416&view=rev
Log:
throw a nicer and more informative exception when the client specifies a resource that does not exist

Modified:
    pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java

Modified: pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1151416&r1=1151415&r2=1151416&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java Wed Jul 27 10:15:35 2011
@@ -571,8 +571,12 @@ public class BXMLSerializer implements S
             throw new IllegalArgumentException("resourceName is null.");
         }
 
-        return readObject(baseType.getResource(resourceName),
-            localize ? new Resources(baseType.getName()) : null);
+        // throw a nice error so the user knows which resource did not load
+        URL location = baseType.getResource(resourceName);
+        if (location == null) {
+            throw new IllegalArgumentException("could not find resource " + resourceName);
+        }
+        return readObject(location, localize ? new Resources(baseType.getName()) : null);
     }
 
     /**