@@ -715,6 +715,7 @@ public void testDefaultJavaOptionsWhenExtraJDK17OptionsAreConfigured() throws Ex
715
715
List <String > javaOpts = localizer .getJavaOpts (conf );
716
716
717
717
if (Shell .isJavaVersionAtLeast (17 )) {
718
+ // Added by ContainerLocalizer for JDK17+ (MAPREDUCE-7456)
718
719
assertTrue (javaOpts .contains ("--add-exports=java.base/sun.net.dns=ALL-UNNAMED" ));
719
720
assertTrue (javaOpts .contains ("--add-exports=java.base/sun.net.util=ALL-UNNAMED" ));
720
721
}
@@ -733,6 +734,7 @@ public void testDefaultJavaOptionsWhenExtraJDK17OptionsAreNotConfigured() throws
733
734
List <String > javaOpts = localizer .getJavaOpts (conf );
734
735
735
736
if (Shell .isJavaVersionAtLeast (17 )) {
737
+ // Added by ContainerLocalizer for JDK17+ (MAPREDUCE-7456)
736
738
assertFalse (javaOpts .contains ("--add-exports=java.base/sun.net.dns=ALL-UNNAMED" ));
737
739
assertFalse (javaOpts .contains ("--add-exports=java.base/sun.net.util=ALL-UNNAMED" ));
738
740
}
@@ -751,6 +753,11 @@ public void testAdminOptionsPrecedeUserDefinedJavaOptions() throws Exception {
751
753
" userOption1 userOption2" );
752
754
List <String > javaOpts = localizer .getJavaOpts (conf );
753
755
756
+ if (Shell .isJavaVersionAtLeast (17 )) {
757
+ // Added by ContainerLocalizer for JDK17+ (MAPREDUCE-7456)
758
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.dns=ALL-UNNAMED" ));
759
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.util=ALL-UNNAMED" ));
760
+ }
754
761
assertEquals (4 , javaOpts .size ());
755
762
assertTrue (javaOpts .get (0 ).equals ("adminOption1" ));
756
763
assertTrue (javaOpts .get (1 ).equals ("adminOption2" ));
@@ -768,6 +775,11 @@ public void testAdminOptionsPrecedeDefaultUserOptions() throws Exception {
768
775
"adminOption1 adminOption2" );
769
776
List <String > javaOpts = localizer .getJavaOpts (conf );
770
777
778
+ if (Shell .isJavaVersionAtLeast (17 )) {
779
+ // Added by ContainerLocalizer for JDK17+ (MAPREDUCE-7456)
780
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.dns=ALL-UNNAMED" ));
781
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.util=ALL-UNNAMED" ));
782
+ }
771
783
assertEquals (3 , javaOpts .size ());
772
784
assertTrue (javaOpts .get (0 ).equals ("adminOption1" ));
773
785
assertTrue (javaOpts .get (1 ).equals ("adminOption2" ));
@@ -784,6 +796,11 @@ public void testUserOptionsWhenAdminOptionsAreNotDefined() throws Exception {
784
796
"userOption1 userOption2" );
785
797
List <String > javaOpts = localizer .getJavaOpts (conf );
786
798
799
+ if (Shell .isJavaVersionAtLeast (17 )) {
800
+ // Added by ContainerLocalizer for JDK17+ (MAPREDUCE-7456)
801
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.dns=ALL-UNNAMED" ));
802
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.util=ALL-UNNAMED" ));
803
+ }
787
804
assertEquals (2 , javaOpts .size ());
788
805
assertTrue (javaOpts .get (0 ).equals ("userOption1" ));
789
806
assertTrue (javaOpts .get (1 ).equals ("userOption2" ));
@@ -797,6 +814,11 @@ public void testJavaOptionsWithoutDefinedAdminOrUserOptions() throws Exception {
797
814
Configuration conf = new Configuration ();
798
815
List <String > javaOpts = localizer .getJavaOpts (conf );
799
816
817
+ if (Shell .isJavaVersionAtLeast (17 )) {
818
+ // Added by ContainerLocalizer for JDK17+ (MAPREDUCE-7456)
819
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.dns=ALL-UNNAMED" ));
820
+ assertTrue (javaOpts .remove ("--add-exports=java.base/sun.net.util=ALL-UNNAMED" ));
821
+ }
800
822
assertEquals (1 , javaOpts .size ());
801
823
assertTrue (javaOpts .get (0 ).equals ("-Xmx256m" ));
802
824
}
0 commit comments