Issue Details (XML | Word | Printable)

Key: RVM-452
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: David Grove
Reporter: Andreas Sewe
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
RVM

Off-by-one error in "VMField.checkReadAccess" and "VM.checkWriteAccess"

Created: 23/Apr/08 09:30 AM   Updated: 23/Apr/08 03:12 PM
Component/s: Runtime
Affects Version/s: 2.9.2
Fix Version/s: 2.9.3

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

Environment:
prototype-opt Jikes RVM 2.9.2+svn (r14123) using GNU Classpath 0.97.1


Sub-Tasks  All   Open   

 Description  « Hide
In both "java.lang.reflect.VMField.checkReadAccess" and "java.lang.reflect.VMField.checkWriteAccess" there is an off-by-one error: the parameter to "VM_Class.getClassFromStackFrame" ought to be 3, not 2. This is exemplified by the following stack trace, taken from "TestFieldReflection" (part of the "basic" test suite):

Values:java.lang.IllegalAccessException: Access to < SystemAppCL, Ltest/org/jikesrvm/basic/core/reflect/TestFieldReflection$TypeWithDifferentAccessModifiers; >.mbyte B is denied to java.lang.reflect.Field
at .<invisible method>(Unknown Source:0)
at java.lang.VMThrowable.fillInStackTrace(VMThrowable.java:49)
at java.lang.Throwable.fillInStackTrace(Throwable.java:498)
at java.lang.Throwable.<init>(Throwable.java:159)
at java.lang.Exception.<init>(Exception.java:78)
at java.lang.IllegalAccessException.<init>(IllegalAccessException.java:97)
at java.lang.reflect.JikesRVMSupport.checkAccess(JikesRVMSupport.java:147)
at java.lang.reflect.VMField.checkReadAccess(VMField.java:245)
at java.lang.reflect.VMField.get(VMField.java:57)
at java.lang.reflect.Field.get(Field.java:261)
at test.org.jikesrvm.basic.core.reflect.TestFieldReflection.printFields(TestFieldReflection.java:128)
at test.org.jikesrvm.basic.core.reflect.TestFieldReflection.testFieldReflection(TestFieldReflection.java:75)
at test.org.jikesrvm.basic.core.reflect.TestFieldReflection.testFieldReflection(TestFieldReflection.java:69)
at test.org.jikesrvm.basic.core.reflect.TestFieldReflection.main(TestFieldReflection.java:61)

Here, "test.org.jikesrvm.basic.core.reflect.TestFieldReflection" ought to be considered the accessing class.

FWIW, tracking this rather minor error down was made hard by the fact that the "diffCompareFiles" macro in "build/tests.xml" does not report failures correctly if the "execution" property is not set properly, e.g., during a "tiny" test-run.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
David Grove added a comment - 23/Apr/08 12:39 PM
Confirmed that: (1) we are failing this test and (2) the test harness is not properly detecting it.

Nice catch; thanks!


David Grove added a comment - 23/Apr/08 03:12 PM
fixed in r14154.