Merge
authorlana
Fri, 06 Sep 2013 17:10:02 -0700
changeset 19926 5bf074b3320e
parent 19925 16855a3ade18 (current diff)
parent 19924 d45df0a53e20 (diff)
child 19927 8793c5627ba7
Merge
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java	Fri Sep 06 14:20:49 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java	Fri Sep 06 17:10:02 2013 -0700
@@ -34,6 +34,7 @@
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
@@ -221,8 +222,10 @@
         /** If the file is a directory, list its contents. */
         public Iterable<DocFile> list() throws IOException {
             List<DocFile> files = new ArrayList<DocFile>();
-            for (Path f: Files.newDirectoryStream(file)) {
-                files.add(new StandardDocFile(f));
+            try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
+                for (Path f: ds) {
+                    files.add(new StandardDocFile(f));
+                }
             }
             return files;
         }
--- a/langtools/test/tools/javadoc/api/basic/APITest.java	Fri Sep 06 14:20:49 2013 -0700
+++ b/langtools/test/tools/javadoc/api/basic/APITest.java	Fri Sep 06 17:10:02 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -29,6 +29,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URI;
+import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Arrays;
@@ -164,11 +165,13 @@
     }
 
     private void listFiles(Path dir, Set<Path> files) throws IOException {
-        for (Path f: Files.newDirectoryStream(dir)) {
-            if (Files.isDirectory(f))
-                listFiles(f, files);
-            else if (Files.isRegularFile(f))
-                files.add(f);
+        try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) {
+            for (Path f: ds) {
+                if (Files.isDirectory(f))
+                    listFiles(f, files);
+                else if (Files.isRegularFile(f))
+                    files.add(f);
+            }
         }
     }
 
--- a/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java	Fri Sep 06 14:20:49 2013 -0700
+++ b/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java	Fri Sep 06 17:10:02 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6493690
+ * @bug 6493690 8024434
  * @summary javadoc should have a javax.tools.Tool service provider
  * @build APITest
  * @run main GetTask_FileManagerTest