You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/05/07 19:03:54 UTC

svn commit: r535928 - /incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java

Author: ehillenius
Date: Mon May  7 10:03:50 2007
New Revision: 535928

URL: http://svn.apache.org/viewvc?view=rev&rev=535928
Log:
throw exception with message rather than NPE

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java?view=diff&rev=535928&r1=535927&r2=535928
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java Mon May  7 10:03:50 2007
@@ -81,11 +81,19 @@
 	 */
 	private Reader getTemplateReader()
 	{
-		final String template = getTemplateResource().asString();
+		final IStringResourceStream resource = getTemplateResource();
+		if (resource == null)
+		{
+			throw new IllegalArgumentException(
+					"getTemplateResource must return a resource");
+		}
+
+		final String template = resource.asString();
 		if (template != null)
 		{
 			return new StringReader(template);
 		}
+
 		return null;
 	}