< prev index next >

test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java

Print this page
rev 13327 : 8184738: CTW fails with assert(!method->method_holder()->is_not_initialized()) failed: method holder must be initialized
Reviewed-by: duke

@@ -23,48 +23,54 @@
 
 package sun.hotspot.tools.ctw;
 
 import java.io.BufferedReader;
 import java.io.IOException;
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.concurrent.Executor;
+import java.util.stream.Stream;
 
 /**
  * Handler for files containing a list of classes to compile.
  */
-public class ClassesListInFile extends PathHandler {
-    public ClassesListInFile(Path root, Executor executor) {
-        super(root, executor);
-    }
+public class ClassesListInFile extends PathHandler.PathEntry {
+    private final BufferedReader reader;
 
-    @Override
-    public void process() {
-        CompileTheWorld.OUT.println("# list: " + root);
+    public ClassesListInFile(Path root) {
+        super(root);
         if (!Files.exists(root)) {
-            return;
+            throw new Error(root + " file does not exist");
         }
         try {
-            try (BufferedReader reader = Files.newBufferedReader(root)) {
-                String line;
-                while (!isFinished() && ((line = reader.readLine()) != null)) {
-                    processClass(line);
+           reader = Files.newBufferedReader(root);
+        } catch (IOException e) {
+            throw new Error("can not open " + root + " : " + e.getMessage(), e);
                 }
             }
-        } catch (IOException e) {
-            e.printStackTrace();
+
+    @Override
+    protected byte[] findByteCode(String name) {
+        return null;
         }
+
+    @Override
+    protected Stream<String> classes() {
+        return reader.lines();
     }
 
     @Override
-    public long classCount() {
-        try {
-            try (BufferedReader reader = Files.newBufferedReader(root)) {
-                return reader.lines().count();
+    protected String description() {
+        return "# list: " + root;
             }
+
+    @Override
+    public void close() {
+        try {
+            reader.close();
         } catch (IOException e) {
-            throw new Error("can not read list " + root + " : "
-                    + e.getMessage(), e);
+            throw new Error("error on closing reader for " + root
+                    + " : "  + e.getMessage(), e);
+        } finally {
+            super.close();
         }
     }
 }
< prev index next >