harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r767526 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/Statement.java test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java
Date Wed, 22 Apr 2009 14:02:36 GMT
Author: tellison
Date: Wed Apr 22 14:02:36 2009
New Revision: 767526

URL: http://svn.apache.org/viewvc?rev=767526&view=rev
Log:
Apply fix for HARMONY-6159 ([classlib][beans] java.beans.Statement.execute() throws java.lang.IllegalAccessException
while RI doesn't)

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java?rev=767526&r1=767525&r2=767526&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java
Wed Apr 22 14:02:36 2009
@@ -215,7 +215,9 @@
 					result = action.run();
 				}
             } else {
-                Method method = findMethod(theTarget.getClass(), theMethodName, theArguments,
false);
+                Method method = findMethod(theTarget.getClass(), theMethodName,
+                        theArguments, false);
+                method.setAccessible(true);
                 result = method.invoke(theTarget, theArguments);
             }
         } catch (InvocationTargetException ite) {

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java?rev=767526&r1=767525&r2=767526&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/StatementTest.java
Wed Apr 22 14:02:36 2009
@@ -20,6 +20,7 @@
 import java.beans.DefaultPersistenceDelegate;
 import java.beans.Statement;
 import java.util.Arrays;
+import java.util.TreeMap;
 import java.util.Vector;
 
 import junit.framework.Test;
@@ -1018,6 +1019,33 @@
                 TInspectorCluster.OFFSPRING_OBJECT_LIST);
     }
 
+    public void test_Statement_Execute() throws Exception {
+        MockTreeMapInnerClass innerTreeMap = new MockTreeMapInnerClass();
+        Statement statement = new Statement(innerTreeMap, "get",
+                new Object[] { "key" });
+        statement.execute();
+        assertEquals("value", innerTreeMap.getReturnValue());
+        innerTreeMap.reset();
+    }
+
+    class MockTreeMapInnerClass extends TreeMap {
+
+        private Object returnValue = null;
+
+        public Object getReturnValue() {
+            return returnValue;
+        }
+
+        public void reset() {
+            returnValue = null;
+        }
+
+        @Override
+        public Object get(Object key) {
+            return returnValue = "value";
+        }
+    }
+
     /*
      * Super class of MockObject.
      */



Mime
View raw message