--- old/src/java.base/share/classes/java/util/ResourceBundle.java 2018-11-28 14:00:26.401602440 -0800 +++ new/src/java.base/share/classes/java/util/ResourceBundle.java 2018-11-28 14:00:25.220578114 -0800 @@ -3184,10 +3184,16 @@ bundleClass.getName() + " in " + m.toString()); } try { - // bundle in a unnamed module - Constructor ctor = bundleClass.getConstructor(); + Constructor ctor = AccessController.doPrivileged( + new PrivilegedExceptionAction<>() { + @Override + public Constructor run() throws NoSuchMethodException { + return bundleClass.getDeclaredConstructor(); + } + }); if (!Modifier.isPublic(ctor.getModifiers())) { - return null; + throw new IllegalAccessException("no-arg constructor in " + + bundleClass.getName() + " is not publicly accessible."); } // java.base may not be able to read the bundleClass's module. @@ -3196,12 +3202,16 @@ bundle = ctor.newInstance((Object[]) null); } catch (InvocationTargetException e) { uncheckedThrow(e); + } catch (PrivilegedActionException e) { + assert e.getException() instanceof NoSuchMethodException; + throw new InstantiationException("public no-arg constructor " + + "does not exist in " + bundleClass.getName()); } } else { throw new ClassCastException(c.getName() + " cannot be cast to ResourceBundle"); } - } catch (ClassNotFoundException|NoSuchMethodException e) { + } catch (ClassNotFoundException e) { } } else if (format.equals("java.properties")) { final String resourceName = toResourceName0(bundleName, "properties");