mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8062348: langtools tests should close file manager (group 1)
Reviewed-by: darcy
This commit is contained in:
parent
b587478f7c
commit
8bd23f1681
145 changed files with 2701 additions and 2452 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, 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
|
||||
|
@ -54,19 +54,20 @@ public class GetTask_OptionsTest extends APITest {
|
|||
public void testNoIndex() throws Exception {
|
||||
JavaFileObject srcFile = createSimpleJavaFileObject();
|
||||
DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
|
||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
||||
File outDir = getOutDir();
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
|
||||
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
|
||||
Iterable<String> options = Arrays.asList("-noindex");
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, options, files);
|
||||
if (t.call()) {
|
||||
System.err.println("task succeeded");
|
||||
Set<String> expectFiles = new TreeSet<String>(standardExpectFiles);
|
||||
expectFiles.remove("index-all.html");
|
||||
checkFiles(outDir, expectFiles);
|
||||
} else {
|
||||
error("task failed");
|
||||
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||
File outDir = getOutDir();
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
|
||||
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
|
||||
Iterable<String> options = Arrays.asList("-noindex");
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, options, files);
|
||||
if (t.call()) {
|
||||
System.err.println("task succeeded");
|
||||
Set<String> expectFiles = new TreeSet<String>(standardExpectFiles);
|
||||
expectFiles.remove("index-all.html");
|
||||
checkFiles(outDir, expectFiles);
|
||||
} else {
|
||||
error("task failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,16 +78,17 @@ public class GetTask_OptionsTest extends APITest {
|
|||
public void testNull() throws Exception {
|
||||
JavaFileObject srcFile = createSimpleJavaFileObject();
|
||||
DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
|
||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
||||
File outDir = getOutDir();
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
|
||||
Iterable<String> options = Arrays.asList((String) null);
|
||||
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
|
||||
try {
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, options, files);
|
||||
error("getTask succeeded, no exception thrown");
|
||||
} catch (NullPointerException e) {
|
||||
System.err.println("exception caught as expected: " + e);
|
||||
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||
File outDir = getOutDir();
|
||||
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
|
||||
Iterable<String> options = Arrays.asList((String) null);
|
||||
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
|
||||
try {
|
||||
DocumentationTask t = tool.getTask(null, fm, null, null, options, files);
|
||||
error("getTask succeeded, no exception thrown");
|
||||
} catch (NullPointerException e) {
|
||||
System.err.println("exception caught as expected: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue