< prev index next >

test/hotspot/jtreg/runtime/testlibrary/GeneratedClassLoader.java

Print this page

        

*** 20,29 **** --- 20,30 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ import java.io.DataInputStream; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter;
*** 143,156 **** File file = new File(className + ".java"); try (PrintWriter pw = new PrintWriter(new FileWriter(file))) { pw.append(src); pw.flush(); } ! int exitcode = javac.run(null, null, null, file.getCanonicalPath()); if (exitcode != 0) { throw new RuntimeException("javac failure when compiling: " + file.getCanonicalPath()); } else { if (deleteFiles) { file.delete(); } } --- 144,164 ---- File file = new File(className + ".java"); try (PrintWriter pw = new PrintWriter(new FileWriter(file))) { pw.append(src); pw.flush(); } ! ByteArrayOutputStream err = new ByteArrayOutputStream(); ! int exitcode = javac.run(null, null, err, file.getCanonicalPath()); if (exitcode != 0) { + // Print Error + System.err.print(err); + if (err.toString().contains("java.lang.OutOfMemoryError: Java heap space")) { + throw new OutOfMemoryError("javac failed with resources exhausted"); + } else { throw new RuntimeException("javac failure when compiling: " + file.getCanonicalPath()); + } } else { if (deleteFiles) { file.delete(); } }
< prev index next >