changeset 5988:db57f06c2c8d

8011990: TEST_BUG: java/util/logging/bundlesearch/ResourceBundleSearchTest.java fails on Windows Summary: Fix URL to reliably work on all platforms Reviewed-by: duke
author jgish
date Tue, 16 Apr 2013 16:34:14 -0400
parents fe514475bc17
children 5fc00e7f7f5b 8f7c3ea16f4a
files test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java	Tue Apr 16 12:20:53 2013 -0700
+++ b/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java	Tue Apr 16 16:34:14 2013 -0400
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -45,11 +46,13 @@
         String testClassesDir = System.getProperty("test.classes",
                 System.getProperty("user.dir"));
         String sep = System.getProperty("file.separator");
+
         URL[] urls = new URL[2];
 
         // Allow for both jtreg and standalone cases here
-        urls[0] = new URL("file://" + testDir + sep + "resources" + sep);
-        urls[1] = new URL("file://" + testClassesDir + sep );
+        urls[0] = new File( testDir + sep + "resources" + sep ).toURI().toURL();
+        urls[1] = new File( testClassesDir + sep ).toURI().toURL();
+
         System.out.println("INFO: urls[0] = " + urls[0]);
         System.out.println("INFO: urls[1] = " + urls[1]);
 
--- a/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java	Tue Apr 16 12:20:53 2013 -0700
+++ b/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java	Tue Apr 16 16:34:14 2013 -0400
@@ -29,6 +29,7 @@
  * @build  ResourceBundleSearchTest IndirectlyLoadABundle LoadItUp
  * @run main ResourceBundleSearchTest
  */
+import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
@@ -70,7 +71,8 @@
         String sep = System.getProperty("file.separator");
 
         URL[] urls = new URL[1];
-        urls[0] = new URL("file://" + testDir + sep + "resources" + sep);
+
+        urls[0] = new File( testDir + sep + "resources" + sep ).toURI().toURL();
         URLClassLoader rbClassLoader = new URLClassLoader(urls);
 
         // Test 1 - can we find a Logger bundle from doing a stack search?