8212627: [TESTBUG] runtime/CreateMirror/ArraysNewInstanceBug.java timed out
authorctornqvi
Mon, 01 Apr 2019 14:34:24 -0700
changeset 54367 e2c096943ba2
parent 54366 2b48cedce327
child 54368 f15b5d110fbc
8212627: [TESTBUG] runtime/CreateMirror/ArraysNewInstanceBug.java timed out Reviewed-by: coleenp, dcubed, hseigel
test/hotspot/jtreg/runtime/CreateMirror/ArraysNewInstanceBug.java
--- a/test/hotspot/jtreg/runtime/CreateMirror/ArraysNewInstanceBug.java	Mon Apr 01 17:11:38 2019 -0400
+++ b/test/hotspot/jtreg/runtime/CreateMirror/ArraysNewInstanceBug.java	Mon Apr 01 14:34:24 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 
 // This test crashes in compiled code with race, because the compiler generates code that assumes this ordering.
 import java.lang.reflect.Array;
+import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
 
@@ -55,13 +56,13 @@
 
     public static void main(String[] args) throws Throwable {
         Class<?> c = ArraysNewInstanceBug.class;
-        ClassLoader apploader =  c.getClassLoader();
+        ClassLoader apploader = c.getClassLoader();
+        File testClasses = new File(System.getProperty("test.classes"));
         for (int iter = 0; iter < 10 ; iter++) {  // 10 is enough to get it to crash on my machine.
             System.err.print('[');
             classes = new Class<?>[1000];
-            String urlpath = "file://" + System.getProperty("test.classes") + "/";
             for (int i = 0; i < classes.length; i++) {
-                ClassLoader loader = new URLClassLoader(new URL[] { new URL(urlpath) }, apploader.getParent());
+                ClassLoader loader = new URLClassLoader(new URL[] { testClasses.toURI().toURL() }, apploader.getParent());
                 classes[i] = loader.loadClass(c.getSimpleName());
             }
             System.err.print(']');