Skip to content

Commit 52867df

Browse files
committed
Always catch SecurityException.
1 parent 5e30f0d commit 52867df

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/builtins/JavaBuiltins.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,8 @@ protected Object extend(Object[] arguments) {
359359
types[i] = toHostClass(arguments[i], env);
360360
}
361361

362-
JavaAccess.checkAccess(types, getContext());
363-
364362
try {
363+
JavaAccess.checkAccess(types, getContext());
365364
if (classOverrides != null) {
366365
return env.createHostAdapterClassWithStaticOverrides(types, classOverrides);
367366
} else {

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/function/JSNewNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ private Object extend(Class<?> type, TruffleLanguage.Env env) {
247247
}
248248
// Equivalent to Java.extend(type)
249249
Class<?>[] types = new Class<?>[]{type};
250-
JavaAccess.checkAccess(types, context);
251250
try {
251+
JavaAccess.checkAccess(types, context);
252252
return env.createHostAdapterClass(types);
253253
} catch (Exception ex) {
254254
throw Errors.createTypeError(ex.getMessage(), ex, this);

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/java/JavaAccess.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
4646
import com.oracle.truffle.api.TruffleLanguage;
47-
import com.oracle.truffle.js.runtime.Errors;
4847
import com.oracle.truffle.js.runtime.JSContext;
4948

5049
/**
@@ -72,7 +71,7 @@ public static boolean isReflectionClass(final Class<?> type) {
7271

7372
public static void checkReflectionAccess(final Class<?> clazz, final boolean isStatic, final boolean allowReflection) {
7473
if (!allowReflection && isReflectiveCheckNeeded(clazz, isStatic)) {
75-
throw Errors.createTypeError("Java reflection not allowed");
74+
throw new SecurityException("Java reflection not allowed");
7675
}
7776

7877
final SecurityManager sm = System.getSecurityManager();

0 commit comments

Comments
 (0)