Commits

musachy  committed eff3d9e

XW-710 Upgrade to OGNL 2.7.3

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@2022e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 205f980

Comments (0)

Files changed (5)

File core/src/main/java/com/opensymphony/xwork2/ognl/accessor/CompoundRootAccessor.java

  */
 public class CompoundRootAccessor implements PropertyAccessor, MethodAccessor, ClassResolver {
 
+    /**
+     * Used by OGNl to generate bytecode
+     */
+    public String getSourceAccessor(OgnlContext context, Object target, Object index) {
+        return null;
+    }
+
+    /**
+     * Used by OGNl to generate bytecode
+     */
+    public String getSourceSetter(OgnlContext context, Object target, Object index) {
+        return null;  
+    }
+
     private final static Logger LOG = LoggerFactory.getLogger(CompoundRootAccessor.class);
     private static Map invalidMethods = new HashMap();
 

File core/src/main/java/com/opensymphony/xwork2/ognl/accessor/ObjectProxyPropertyAccessor.java

 import ognl.OgnlException;
 import ognl.OgnlRuntime;
 import ognl.PropertyAccessor;
+import ognl.OgnlContext;
 
 import java.util.Map;
 
  * @author Gabe
  */
 public class ObjectProxyPropertyAccessor implements PropertyAccessor {
+
+    /**
+     * Used by OGNl to generate bytecode
+     */
+    public String getSourceAccessor(OgnlContext context, Object target, Object index) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    /**
+     * Used by OGNl to generate bytecode
+     */
+    public String getSourceSetter(OgnlContext context, Object target, Object index) {
+        return null;  
+    }
+
     public Object getProperty(Map context, Object target, Object name) throws OgnlException {
         ObjectProxy proxy = (ObjectProxy) target;
         setupContext(context, proxy);

File core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java

         assertEquals(foo.getBar().getTitle(), "i am barbaz");
     }
 
-    public void testExceptionForUnmatchedGetterAndSetterWithThrowPropertyException() {
+    public void testNoExceptionForUnmatchedGetterAndSetterWithThrowPropertyException() {
         Map<String, Object> props = new HashMap<String, Object>();
         props.put("myIntegerProperty", new Integer(1234));
 
         TestObject testObject = new TestObject();
 
-        try {
-            ognlUtil.setProperties(props, testObject, true);
-            fail("should rise IllegalAccessException because of Wrong getter method");
-        } catch (Exception e) {
-            //expected
-        }
+        //this used to fail in OGNL versions < 2.7
+        ognlUtil.setProperties(props, testObject, true);
+        assertEquals(1234, props.get("myIntegerProperty"));
     }
 
     public void testExceptionForWrongPropertyNameWithThrowPropertyException() {

File core/src/test/java/com/opensymphony/xwork2/ognl/OgnlValueStackTest.java

         BadJavaBean bean = new BadJavaBean();
         vs.push(bean);
 
-        try {
-            vs.setValue("count", "1", true);
-            fail("Expected an exception for mismatched getter and setter");
-        } catch (XWorkException e) {
-            //expected
-        }
+        //this used to fail in OGNl versdion < 2.7
+        vs.setValue("count", "1", true);
+        assertEquals("1", bean.getCount());
 
         try {
             vs.setValue("count2", "a", true);
         BadJavaBean bean = new BadJavaBean();
         vs.push(bean);
 
-        try {
-            vs.setValue("count", "1", true);
-            fail("Expected an exception for mismatched getter and setter");
-        } catch (XWorkException e) {
-            //expected
-        }
+        //this used to fail in OGNl versdion < 2.7
+        vs.setValue("count", "1", true);
+        assertEquals("1", bean.getCount());
 
         try {
             vs.setValue("count2", "a", true);
         <currentVersion>${pom.version}</currentVersion>
         <struts2.springPlatformVersion>2.5.6</struts2.springPlatformVersion>
         <asm.version>3.1</asm.version>
-        <ognl.version>2.6.11</ognl.version>
+        <ognl.version>2.7.3</ognl.version>
     </properties>
 
     <profiles>
             <version>2.4</version>
         </dependency>
         <dependency>
-            <groupId>opensymphony</groupId>
+            <groupId>ognl</groupId>
             <artifactId>ognl</artifactId>
             <version>${ognl.version}</version>
         </dependency>