Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64390

org.acegisecurity.util.FieldUtils.setProtectedFieldValue is not compatable with the old code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • 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.

            teilo James Nord
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: