8024434: problem running javadoc tests in samevm mode on Windows

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2013-09-06 15:31:59 -07:00
parent 26758f0ffd
commit f607953eb8
3 changed files with 16 additions and 10 deletions

View File

@ -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;
}

View File

@ -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.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);
}
}
}

View File

@ -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