-
Bug
-
Resolution: Fixed
-
Minor
-
-
2.271
the previous implementaion of `FieldUtils.setProtectedFieldValue` worked for final as well as protected methods.
this is not the case for the new code and it fails with
```
java.lang.IllegalAccessException: Can not set final java.lang.ClassLoader field hudson.PluginManager.uberClassLoader to org.powermock.core.classloader.javassist.JavassistMockClassLoader
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76)
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80)
at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79)
at java.lang.reflect.Field.set(Field.java:764)
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523)
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500)
at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560)
at org.acegisecurity.util.FieldUtils.setProtectedFieldValue(FieldUtils.java:43)
```
the code should be adapted to work with final classes.
Currently only observed in test code - but may as well fix it before it is observed in production code.
- links to
[JENKINS-64390] org.acegisecurity.util.FieldUtils.setProtectedFieldValue is not compatable with the old code
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10005 ] |
Remote Link | New: This issue links to "jenkins #5105 (Web Link)" [ 26355 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Review [ 10005 ] | New: Resolved [ 5 ] |
Status | Original: Resolved [ 5 ] | New: Fixed but Unreleased [ 10203 ] |
Released As | New: 2.271 | |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Resolved [ 5 ] |
Description |
Original:
the previous implementaion of `FiledUtils.setProtectedFieldValue` worked for final as well as protected methods.
this is not the case for the new code and it fails with ``` java.lang.IllegalAccessException: Can not set final java.lang.ClassLoader field hudson.PluginManager.uberClassLoader to org.powermock.core.classloader.javassist.JavassistMockClassLoader at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76) at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80) at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79) at java.lang.reflect.Field.set(Field.java:764) at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523) at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500) at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560) at org.acegisecurity.util.FieldUtils.setProtectedFieldValue(FieldUtils.java:43) ``` the code should be adapted to work with final classes. Currently only observed in test code - but may as well fix it before it is observed in production code. |
New:
the previous implementaion of `FieldUtils.setProtectedFieldValue` worked for final as well as protected methods.
this is not the case for the new code and it fails with ``` java.lang.IllegalAccessException: Can not set final java.lang.ClassLoader field hudson.PluginManager.uberClassLoader to org.powermock.core.classloader.javassist.JavassistMockClassLoader at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:76) at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:80) at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifiedObjectFieldAccessorImpl.java:79) at java.lang.reflect.Field.set(Field.java:764) at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:523) at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:500) at org.apache.commons.lang.reflect.FieldUtils.writeField(FieldUtils.java:560) at org.acegisecurity.util.FieldUtils.setProtectedFieldValue(FieldUtils.java:43) ``` the code should be adapted to work with final classes. Currently only observed in test code - but may as well fix it before it is observed in production code. |