Commits

Anonymous committed 9dade2a

Fixes OGNL-77. ASTAdd wasn't setting the context type before returning.

Comments (0)

Files changed (4)

   </component>
   <component name="ChangeListManager">
     <list default="true" name="Default" comment="">
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ObjectPropertyAccessor.java" afterPath="$PROJECT_DIR$/src/java/ognl/ObjectPropertyAccessor.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/ASTAdd.java" afterPath="$PROJECT_DIR$/src/java/ognl/ASTAdd.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java" afterPath="$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/OGNL.iws" afterPath="$PROJECT_DIR$/OGNL.iws" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/ArrayElementsTest.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/ArrayElementsTest.java" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Root.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Root.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java" />
     </list>
   </component>
   <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
     <option name="referencePos" value="0" />
     <option name="showLabels" value="true" />
   </component>
-  <component name="RunManager" selected="JUnit.IndexedPropertyTest">
-    <tempConfiguration default="false" name="IndexedPropertyTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+  <component name="RunManager" selected="JUnit.PropertyTest">
+    <tempConfiguration default="false" name="PropertyTest" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
       <pattern value="org.ognl.test.*" />
       <module name="OGNL" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
       <option name="ALTERNATIVE_JRE_PATH" value="/usr/local/jdk1.6.0_02" />
       <option name="PACKAGE_NAME" value="org.ognl.test" />
-      <option name="MAIN_CLASS_NAME" value="org.ognl.test.IndexedPropertyTest" />
+      <option name="MAIN_CLASS_NAME" value="org.ognl.test.PropertyTest" />
       <option name="METHOD_NAME" value="" />
       <option name="TEST_OBJECT" value="class" />
       <option name="VM_PARAMETERS" value="" />
     <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
     <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Fixes OGNL-76. ObjectPropertyAccessor was incorrectly trying to generate an array property reference in the setter code (ie java.lang.Object[].class) - which is of course invalid.  Changed to use the OgnlOps.toArray() style parameter conversion." />
+    <option name="LAST_COMMIT_MESSAGE" value="Fixes OGNL-77. ASTAdd wasn't setting the context type before returning." />
     <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
     <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
     <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
     <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
     <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
-    <MESSAGE value="Added new getRootExpressionClass() to compiler interface so that other compiler impls can handle special corner cases (like operating on previously javassist'ed classes)" />
     <MESSAGE value="ASTTest had been quietly failing since the last set of changes. Not good for performance..." />
     <MESSAGE value="Fixes OGNL-50. Boolean literals within ASTAnd expressions were failing compilation (stupid ass javassist) unless surrounded with ( )." />
     <MESSAGE value="-) Fix for OGNL-52. Added a synchronized() block around the method object being invoked to prevent failures with the accessible flag being turned on/off temporarily. &#10;&#10;-) Added new unit test but failed to verify OGNL-51." />
     <MESSAGE value="Fixes OGNL-74. Used a 1.5 only jre feature of Integer.valueOf(int)" />
     <MESSAGE value="Fixes OGNL-75." />
     <MESSAGE value="Fixes OGNL-76. ObjectPropertyAccessor was incorrectly trying to generate an array property reference in the setter code (ie java.lang.Object[].class) - which is of course invalid.  Changed to use the OgnlOps.toArray() style parameter conversion." />
+    <MESSAGE value="Fixes OGNL-77. ASTAdd wasn't setting the context type before returning." />
   </component>
   <component name="XPathView.XPathProjectComponent">
     <history />
     <option name="myLastEditedConfigurable" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="jar:///usr/local/jdk1.5.0_11/src.zip!/java/math/BigInteger.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="927" column="29" selection-start="33828" selection-end="33828" vertical-scroll-proportion="0.33333334">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/ListPropertyAccessor.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="265" column="77" selection-start="10490" selection-end="10490" vertical-scroll-proportion="0.7324841">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ASTPropertyTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="199" column="116" selection-start="6876" selection-end="6876" vertical-scroll-proportion="0.59697735">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/OgnlRuntime.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="52" column="13" selection-start="2341" selection-end="2341" vertical-scroll-proportion="0.17632242">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Indexed.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="63" column="4" selection-start="2414" selection-end="2414" vertical-scroll-proportion="0.40302268">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/IndexedPropertyTest.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="37" column="22" selection-start="1901" selection-end="1901" vertical-scroll-proportion="0.08816121">
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="553" column="0" selection-start="19853" selection-end="19853" vertical-scroll-proportion="0.27036104">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/java/ognl/OgnlOps.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="514" column="4" selection-start="18417" selection-end="18417" vertical-scroll-proportion="0.38371116">
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/Ognl.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="122" column="0" selection-start="5482" selection-end="5482" vertical-scroll-proportion="0.33254716">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/ASTAdd.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="275" column="0" selection-start="12542" selection-end="12542" vertical-scroll-proportion="0.74811083">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="50" column="12" selection-start="2409" selection-end="2409" vertical-scroll-proportion="0.2141058">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Root.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="440" column="1" selection-start="10672" selection-end="10672" vertical-scroll-proportion="0.91183877">
+        <state line="298" column="22" selection-start="8309" selection-end="8309" vertical-scroll-proportion="0.67254406">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Bean2.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="42" column="0" selection-start="1957" selection-end="1957" vertical-scroll-proportion="0.16372795">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/BaseBean.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="26" column="5" selection-start="370" selection-end="370" vertical-scroll-proportion="0.30226701">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/java/ognl/enhance/ExpressionCompiler.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="466" column="22" selection-start="16713" selection-end="16713" vertical-scroll-proportion="0.28967255">
           <folding />
         </state>
       </provider>

src/java/ognl/ASTAdd.java

 
                 if (_getterClass != null && String.class.isAssignableFrom(_getterClass))
                     _getterClass = Object.class;
+            } else {
+
+                context.setCurrentType(_getterClass);
             }
 
             return result;

src/java/ognl/enhance/ExpressionCompiler.java

         if (context.getCurrentType() == null
             || context.getCurrentType().isPrimitive() ||
             Character.class.isAssignableFrom(context.getCurrentType())) {
+            
             pre = pre + " ($w) (";
             post = post + ")";
         }

src/test/java/org/ognl/test/PropertyTest.java

             { MODEL, "(unassignedCopyModel.optionCount > 0 && canApproveCopy) || entry.copy.size() > 0", Boolean.TRUE },
             { ROOT, "flyingMonkey", Boolean.TRUE},
             { ROOT, "expiration == null ? '' : @org.ognl.test.PropertyTest@DATE_FORMAT.format(expiration)", ""},
+            { ROOT, "printDelivery ? 'javascript:toggle(' + bean2.id + ');' : ''", "javascript:toggle(1);"},
     };
 
     public static String formatValue(int millis, boolean b1, boolean b2)