Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JAR files with ResourceBundles as .properties at their root #3537

Closed
wants to merge 1 commit into from

Conversation

zakkak
Copy link
Collaborator

@zakkak zakkak commented Jul 1, 2021

@zakkak zakkak requested a review from olpaw July 1, 2021 18:38
@olpaw
Copy link
Member

olpaw commented Jul 2, 2021

@zakkak thanks for suggesting a fix. To solve the problem correctly we need a different fix.

What we actually need is:

diff --git a/substratevm/src/com.oracle.svm.hosted.jdk11/src/com/oracle/svm/hosted/jdk11/ClassLoaderSupportImplJDK11OrLater.java b/substratevm/src/com.oracle.svm.hosted.jdk11/src/com/oracle/svm/hosted/jdk11/ClassLoaderSupportImplJDK11OrLater.java
index df9556d6504..ca0012e99af 100644
--- a/substratevm/src/com.oracle.svm.hosted.jdk11/src/com/oracle/svm/hosted/jdk11/ClassLoaderSupportImplJDK11OrLater.java
+++ b/substratevm/src/com.oracle.svm.hosted.jdk11/src/com/oracle/svm/hosted/jdk11/ClassLoaderSupportImplJDK11OrLater.java
@@ -80,9 +80,6 @@ public final class ClassLoaderSupportImplJDK11OrLater extends ClassLoaderSupport
             bundleName = specParts[0];
         }
         String packageName = packageName(bundleName);
-        if (packageName == null) {
-            throw new MissingResourceException("ResourceBundle does not seem to be a fully qualified class name.", bundleName, locale.toLanguageTag());
-        }
         Set<Module> modules;
         if (moduleName != null) {
             modules = classLoaderSupport.findModule(moduleName).stream().collect(Collectors.toSet());
@@ -107,8 +104,7 @@ public final class ClassLoaderSupportImplJDK11OrLater extends ClassLoaderSupport
     private static String packageName(String bundleName) {
         int classSep = bundleName.replace('/', '.').lastIndexOf('.');
         if (classSep == -1) {
-            /* The bundle is not specified via a java.class or java.properties format. */
-            return null;
+            return ""; /* unnamed package */
         }
         return bundleName.substring(0, classSep);
     }

This will make your reproducer from #3535 work but in addition will be able to correctly open up modules that have bundles in their unnamed package. I will create a PR and add you as a reviewer.

@zakkak
Copy link
Collaborator Author

zakkak commented Jul 2, 2021

Closing in favor of #3540

@zakkak zakkak closed this Jul 2, 2021
@zakkak zakkak deleted the fix-3535 branch July 2, 2021 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants