[ 
https://issues.apache.org/jira/browse/HADOOP-19726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18029349#comment-18029349
 ] 

ASF GitHub Bot commented on HADOOP-19726:
-----------------------------------------

slfan1989 opened a new pull request, #8029:
URL: https://github.com/apache/hadoop/pull/8029

   <!--
     Thanks for sending a pull request!
       1. If this is your first time, please read our contributor guidelines: 
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
       2. Make sure your PR title starts with JIRA issue id, e.g., 
'HADOOP-17799. Your PR title ...'.
   -->
   
   ### Description of PR
   
   JIRA: HADOOP-19726. [JDK17] Add JDK 17 compile options for 
maven-surefire-plugin in hadoop-tos module.
   
   ### How was this patch tested?
   
   CI
   
   ### For code changes:
   
   - [ ] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   




> Add JDK 17 compile options for maven-surefire-plugin in hadoop-tos module
> -------------------------------------------------------------------------
>
>                 Key: HADOOP-19726
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19726
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: hadoop-tos
>    Affects Versions: 3.5.0
>            Reporter: Shilun Fan
>            Assignee: Shilun Fan
>            Priority: Major
>
> Currently, the {{hadoop-tos}} module does not have the JDK 17 compile options 
> configured for the {{{}maven-surefire-plugin{}}}, which causes the following 
> error during unit test execution:
> {code:java}
> java.lang.IllegalStateException: Failed to set environment variable   at 
> org.apache.hadoop.fs.tosfs.util.TestUtility.setSystemEnv(TestUtility.java:120)
>        at 
> org.apache.hadoop.fs.tosfs.object.ObjectStorageTestBase.setUp(ObjectStorageTestBase.java:59)
>  at java.base/java.lang.reflect.Method.invoke(Method.java:569)   at 
> java.base/java.util.ArrayList.forEach(ArrayList.java:1511)   at 
> java.base/java.util.ArrayList.forEach(ArrayList.java:1511)Caused by: 
> java.lang.reflect.InaccessibleObjectException: Unable to make field private 
> final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: 
> module java.base does not "opens java.util" to unnamed module @69eee410     
> 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.fs.tosfs.util.TestUtility.setSystemEnv(TestUtility.java:116)
>        ... 4 more
>  {code}
> This error occurs due to the module system restrictions in JDK 17, where 
> reflection cannot access private fields in the 
> java.util.Collections$UnmodifiableMap class.
>  
> To resolve this issue, JDK 17 compile options have been added to ensure the 
> maven-surefire-plugin works correctly in a JDK 17 environment. This PR adds 
> the necessary compile options for maven-surefire-plugin to support JDK 17, 
> fixing the error and ensuring that unit tests can run smoothly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to