提交 ad3ff97c 编写于 作者: J jjg

8024434: problem running javadoc tests in samevm mode on Windows

Reviewed-by: darcy
上级 9b0ee66f
......@@ -34,6 +34,7 @@ import java.io.OutputStream;
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 @@ class PathDocFileFactory extends DocFileFactory {
/** 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;
}
......
/*
* 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.annotation.RetentionPolicy;
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 @@ class APITest {
}
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);
}
}
}
......
/*
* 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册