Skip to content

Commit c05d660

Browse files
committed
svm: fix SecuritySubstitutions on JDK 17
1 parent 0bbef30 commit c05d660

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SecuritySubstitutions.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private static <T> T doPrivileged(PrivilegedAction<T> action) throws Throwable {
8686
try {
8787
return action.run();
8888
} catch (Throwable ex) {
89-
throw AccessControllerUtil.wrapCheckedException(ex);
89+
throw AccessControllerUtil.wrapCheckedExceptionForPrivilegedAction(ex);
9090
}
9191
}
9292

@@ -95,7 +95,7 @@ private static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) throws
9595
try {
9696
return action.run();
9797
} catch (Throwable ex) {
98-
throw AccessControllerUtil.wrapCheckedException(ex);
98+
throw AccessControllerUtil.wrapCheckedExceptionForPrivilegedAction(ex);
9999
}
100100
}
101101

@@ -104,7 +104,7 @@ private static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlConte
104104
try {
105105
return action.run();
106106
} catch (Throwable ex) {
107-
throw AccessControllerUtil.wrapCheckedException(ex);
107+
throw AccessControllerUtil.wrapCheckedExceptionForPrivilegedAction(ex);
108108
}
109109
}
110110

@@ -113,7 +113,7 @@ private static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlConte
113113
try {
114114
return action.run();
115115
} catch (Throwable ex) {
116-
throw AccessControllerUtil.wrapCheckedException(ex);
116+
throw AccessControllerUtil.wrapCheckedExceptionForPrivilegedAction(ex);
117117
}
118118
}
119119

@@ -188,6 +188,13 @@ static Throwable wrapCheckedException(Throwable ex) {
188188
return ex;
189189
}
190190
}
191+
192+
static Throwable wrapCheckedExceptionForPrivilegedAction(Throwable ex) {
193+
if (JavaVersionUtil.JAVA_SPEC <= 11) {
194+
return wrapCheckedException(ex);
195+
}
196+
return ex;
197+
}
191198
}
192199

193200
@AutomaticFeature

0 commit comments

Comments
 (0)