changeset 55641:e2c096943ba2

8212627: [TESTBUG] runtime/CreateMirror/ArraysNewInstanceBug.java timed out Reviewed-by: coleenp, dcubed, hseigel
author ctornqvi
date Mon, 01 Apr 2019 14:34:24 -0700
parents 2b48cedce327
children f15b5d110fbc
files test/hotspot/jtreg/runtime/CreateMirror/ArraysNewInstanceBug.java
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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(']');