Author: ssolsagl
Date: 2007-01-11 14:25:21 +0100 (Thu, 11 Jan 2007)
New Revision: 4319

Modified:
   
branches/2.8/core-api/src/main/java/no/schibstedsok/searchportal/view/velocity/ChopStringDirective.java
Log:
Check input for null values. This caused the render of the result to fail, 
showing only a few results etc...


Modified: 
branches/2.8/core-api/src/main/java/no/schibstedsok/searchportal/view/velocity/ChopStringDirective.java
===================================================================
--- 
branches/2.8/core-api/src/main/java/no/schibstedsok/searchportal/view/velocity/ChopStringDirective.java
     2007-01-11 13:20:50 UTC (rev 4318)
+++ 
branches/2.8/core-api/src/main/java/no/schibstedsok/searchportal/view/velocity/ChopStringDirective.java
     2007-01-11 13:25:21 UTC (rev 4319)
@@ -61,8 +61,16 @@
         final int argCount = node.jjtGetNumChildren();
         
         if (argCount > 0 && argCount < 4) {
+            
+            final Object nodeValue = node.jjtGetChild(0).value(context);
 
-            final String s = node.jjtGetChild(0).value(context).toString();
+            if(nodeValue == null) {
+                // No need to do anything since the string is empty anyway 
+                writer.write("");
+                return true;
+
+            }
+            final String s = nodeValue.toString();
             
             final int length = argCount > 1
                     ? 
Integer.parseInt(node.jjtGetChild(1).value(context).toString())

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to