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

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

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      2.271

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            markewaite Mark Waite added a comment -

            Merged towards Jenkins 2.271, planned for release Dec 15, 2020.

            Show
            markewaite Mark Waite added a comment - Merged towards Jenkins 2.271, planned for release Dec 15, 2020.

              People

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

                Dates

                Created:
                Updated:
                Resolved: