fapifta opened a new pull request, #7135:
URL: https://github.com/apache/ozone/pull/7135

   ## What changes were proposed in this pull request?
   During our internal testing we ran into an exception with Java 17 that 
originates in ChecksumByteBufferImpl.
   The exception:
   
   <pre>java.lang.reflect.InaccessibleObjectException: Unable to make field 
boolean java.nio.ByteBuffer.isReadOnly accessible: module java.base does not 
"opens java.nio" to unnamed module @46d56d67
        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at 
java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
        at 
org.apache.hadoop.ozone.common.ChecksumByteBufferImpl.<clinit>(ChecksumByteBufferImpl.java:51)</pre>
   
   The code has a TODO comment later on:
   <pre>
     // TODO - when we eventually move to a minimum Java version >= 9 this 
method
     //        should be refactored to simply call checksum.update(buffer), as 
the
     //        Checksum interface has been enhanced to allow this since Java 9.
   </pre>
   
   Based on the todo the PR proposes to set the field accessible only if we are 
running on Java 8, and use the Java 9 based solution for anything above Java9 
until the update method is there.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-11392
   
   ## How was this patch tested?
   I tested with different vm versions (8, 9, 11, 17, 22) based on a simple 
method that calls ChecksumByteBufferFactory.crc32Impl().
   The original code fails with an error with 17 and 22, while gives a warning 
about the setAccessible call with 9 and 11, while the patched version does not 
give a warning, and works without any problem on all versions including Java 8.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to