8044274: Proper property processing
authornaoto
Tue, 24 Jun 2014 14:00:01 -0700
changeset 27083 cbf7fcda2e3f
parent 27082 7ab1aa5e8713
child 27084 d7fbf9a294af
8044274: Proper property processing Reviewed-by: okutsu
jdk/src/java.base/share/classes/java/util/ResourceBundle.java
--- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Tue Jun 24 10:03:46 2014 -0700
+++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java	Tue Jun 24 14:00:01 2014 -0700
@@ -2646,7 +2646,10 @@
                 } catch (ClassNotFoundException e) {
                 }
             } else if (format.equals("java.properties")) {
-                final String resourceName = toResourceName(bundleName, "properties");
+                final String resourceName = toResourceName0(bundleName, "properties");
+                if (resourceName == null) {
+                    return bundle;
+                }
                 final ClassLoader classLoader = loader;
                 final boolean reloadFlag = reload;
                 InputStream stream = null;
@@ -2800,7 +2803,10 @@
             }
             boolean result = false;
             try {
-                String resourceName = toResourceName(toBundleName(baseName, locale), format);
+                String resourceName = toResourceName0(toBundleName(baseName, locale), format);
+                if (resourceName == null) {
+                    return result;
+                }
                 URL url = loader.getResource(resourceName);
                 if (url != null) {
                     long lastModified = 0;
@@ -2934,6 +2940,15 @@
             sb.append(bundleName.replace('.', '/')).append('.').append(suffix);
             return sb.toString();
         }
+
+        private String toResourceName0(String bundleName, String suffix) {
+            // application protocol check
+            if (bundleName.contains("://")) {
+                return null;
+            } else {
+                return toResourceName(bundleName, suffix);
+            }
+        }
     }
 
     private static class SingleFormatControl extends Control {