1. opensymphony
  2. ognl

Commits

jkuh...@d4b077e3-5828-0410-b394-cb2b42183085  committed 5a37e6b

Fixes regression of string concatenations in OGNL-48.

  • Participants
  • Parent commits 8c04b61
  • Branches default

Comments (0)

Files changed (2)

File src/java/ognl/ASTAdd.java

View file
  • Ignore whitespace
                             && !ASTMethod.class.isInstance(_children[i])
                             && !ASTSequence.class.isInstance(_children[i])
                             && !ASTChain.class.isInstance(_children[i])
-                            && !NumericExpression.class.isAssignableFrom(_children[i].getClass())) {
+                            && !NumericExpression.class.isAssignableFrom(_children[i].getClass())
+                                && !ASTStaticField.class.isInstance(_children[i])
+                                && !ASTStaticMethod.class.isInstance(_children[i])) {
 
                             if (lastType != null && String.class.isAssignableFrom(lastType.getGetterClass()))  {
                                 //System.out.println("Input expr >>" + expr + "<<");

File src/test/java/org/ognl/test/NullStringCatenationTest.java

View file
  • Ignore whitespace
 
 public class NullStringCatenationTest extends OgnlTestCase {
 
+    public static final String MESSAGE = "blarney";
+
     private static Root ROOT = new Root();
 
     private static Object[][] TESTS = {
             {ROOT, "(true ? 'tabHeader' : '') + (false ? 'tabHeader' : '')", "tabHeader"},
             {ROOT, "theInt == 0 ? '5%' : theInt + '%'", "6%"},
             {ROOT, "'width:' + width + ';'", "width:238px;" },
-            {ROOT, "theLong + '_' + index", "4_1"} 
+            {ROOT, "theLong + '_' + index", "4_1"},
+            {ROOT, "'javascript:' + @org.ognl.test.NullStringCatenationTest@MESSAGE", "javascript:blarney" }
     };
 
     /*