You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/08/07 22:27:33 UTC

svn commit: r683702 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java

Author: ivaynberg
Date: Thu Aug  7 13:27:33 2008
New Revision: 683702

URL: http://svn.apache.org/viewvc?rev=683702&view=rev
Log:
prevent possible npe when interface is passed in

Modified:
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java?rev=683702&r1=683701&r2=683702&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java Thu Aug  7 13:27:33 2008
@@ -122,7 +122,7 @@
 	 * @return The string resource value or null if resource not found
 	 */
 	public String loadStringResource(Class clazz, final String key, final Locale locale,
-			final String style)
+		final String style)
 	{
 		if (clazz == null)
 		{
@@ -130,8 +130,9 @@
 		}
 
 		// Load the properties associated with the path
-		IPropertiesFactory propertiesFactory = Application.get().getResourceSettings()
-				.getPropertiesFactory();
+		IPropertiesFactory propertiesFactory = Application.get()
+			.getResourceSettings()
+			.getPropertiesFactory();
 
 		while (true)
 		{
@@ -140,7 +141,7 @@
 
 			// Iterator over all the combinations
 			ResourceNameIterator iter = new ResourceNameIterator(path, style, locale,
-					"properties,xml");
+				"properties,xml");
 			while (iter.hasNext())
 			{
 				String newPath = (String)iter.next();
@@ -170,6 +171,12 @@
 
 			// Move to the next superclass
 			clazz = clazz.getSuperclass();
+
+			if (clazz == null)
+			{
+				// nothing more to search, done
+				break;
+			}
 		}
 
 		// not found
@@ -278,13 +285,13 @@
 
 		// Stop at all html markup base classes
 		if (clazz.equals(WebPage.class) || clazz.equals(WebMarkupContainer.class) ||
-				clazz.equals(WebComponent.class))
+			clazz.equals(WebComponent.class))
 		{
 			return true;
 		}
 
 		// Stop at all wicket base classes
 		return clazz.equals(Page.class) || clazz.equals(MarkupContainer.class) ||
-				clazz.equals(Component.class);
+			clazz.equals(Component.class);
 	}
 }