Skip to content

Commit

Permalink
Adapt JDK-8344299: SM cleanup in javax.naming modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mur47x111 committed Nov 28, 2024
1 parent 782dd29 commit 1455c7e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
*/
package com.oracle.svm.core.jdk.localization.substitutions;

import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;

import java.util.Locale;
import java.util.Objects;
import java.util.ResourceBundle;
Expand All @@ -39,11 +37,14 @@
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.jdk.JDK21OrEarlier;
import com.oracle.svm.core.jdk.localization.LocalizationSupport;
import com.oracle.svm.core.jdk.localization.substitutions.modes.OptimizedLocaleMode;
import com.oracle.svm.core.jdk.resources.MissingResourceRegistrationUtils;
import com.oracle.svm.util.ReflectionUtil;

import jdk.internal.loader.BootLoader;
import sun.security.util.SecurityConstants;

@TargetClass(java.util.ResourceBundle.class)
@SuppressWarnings({"unused"})
Expand Down Expand Up @@ -137,6 +138,7 @@ private static ResourceBundle getBundleImpl(String baseName,

@Substitute
@SuppressWarnings({"removal", "deprecation"})
@TargetElement(onlyWith = JDK21OrEarlier.class)
private static ResourceBundle getBundleFromModule(Class<?> caller,
Module module,
String baseName,
Expand All @@ -147,7 +149,8 @@ private static ResourceBundle getBundleFromModule(Class<?> caller,
if (callerModule != module) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(GET_CLASSLOADER_PERMISSION);
RuntimePermission getClassLoaderPermission = ReflectionUtil.readField(SecurityConstants.class, "GET_CLASSLOADER_PERMISSION", null);
sm.checkPermission(getClassLoaderPermission);
}
}
if (!ImageSingletons.lookup(LocalizationSupport.class).isRegisteredBundleLookup(baseName, locale, control)) {
Expand Down

0 comments on commit 1455c7e

Please sign in to comment.