Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 206678 Details for
Bug 363293
resource leaks in org.eclipse.jdt.compiler.tool.tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed patch
Bug_363293.patch (text/plain), 5.03 KB, created by
Stephan Herrmann
on 2011-11-09 07:12:07 EST
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-11-09 07:12:07 EST
Size:
5.03 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/AbstractCompilerToolTest.java b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/AbstractCompilerToolTest.java >index cd6cbfe..cb26233 100644 >--- a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/AbstractCompilerToolTest.java >+++ b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/AbstractCompilerToolTest.java >@@ -12,6 +12,7 @@ > package org.eclipse.jdt.compiler.tool.tests; > > import java.io.File; >+import java.io.IOException; > import java.io.PrintWriter; > import java.util.ArrayList; > import java.util.List; >@@ -98,16 +99,24 @@ > if (manager == null) { > manager = COMPILER.getStandardFileManager(null, null, null); // will pick defaults up > } >- List<File> files = new ArrayList<File>(); >- String[] fileNames = arguments.fileNames; >- for (int i = 0, l = fileNames.length; i < l; i++) { >- if (fileNames[i].startsWith(OUTPUT_DIR)) { >- files.add(new File(fileNames[i])); >- } else { >- files.add(new File(OUTPUT_DIR + File.separator + fileNames[i])); >+ try { >+ List<File> files = new ArrayList<File>(); >+ String[] fileNames = arguments.fileNames; >+ for (int i = 0, l = fileNames.length; i < l; i++) { >+ if (fileNames[i].startsWith(OUTPUT_DIR)) { >+ files.add(new File(fileNames[i])); >+ } else { >+ files.add(new File(OUTPUT_DIR + File.separator + fileNames[i])); >+ } > } >- } >- CompilationTask task = COMPILER.getTask(out, arguments.standardJavaFileManager /* carry the null over */, new CompilerInvocationDiagnosticListener(err), arguments.options, null, manager.getJavaFileObjectsFromFiles(files)); >- return task.call(); >+ CompilationTask task = COMPILER.getTask(out, arguments.standardJavaFileManager /* carry the null over */, new CompilerInvocationDiagnosticListener(err), arguments.options, null, manager.getJavaFileObjectsFromFiles(files)); >+ return task.call(); >+ } finally { >+ try { >+ manager.close(); >+ } catch (IOException e) { >+ // nop >+ } >+ } > } > } >diff --git a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java >index 60be95f..09a1689 100644 >--- a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java >+++ b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerInvocationTests.java >@@ -502,7 +502,9 @@ > remaining = remainingAsList.iterator(); > assertTrue("does not support -d option", javacStandardJavaFileManager.handleOption("-d", remaining)); > assertEquals("unexpected consumption rate", "remainder", remaining.next()); >+ javacStandardJavaFileManager.close(); > } >+ ecjStandardJavaFileManager.close(); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=226918 > // options consumption - check consumption rate on supported zero-args options >@@ -525,6 +527,7 @@ > assertEquals("unexpected consumption rate", REMAINDER, remaining.next()); > } > } >+ ecjStandardJavaFileManager.close(); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=226918 > // options consumption - check consumption rate on supported one-arg options >@@ -540,6 +543,7 @@ > assertEquals("unexpected consumption rate", REMAINDER, remaining.next()); > } > } >+ ecjStandardJavaFileManager.close(); > } > // tests #10-11 show that ecj throws a RuntimeException when encountering a wrong > // encoding in its parameters, while the default compiler swallows it silently >diff --git a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolTests.java b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolTests.java >index 84e2c1f..68ffad3 100644 >--- a/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolTests.java >+++ b/org.eclipse.jdt.compiler.tool.tests/src/org/eclipse/jdt/compiler/tool/tests/CompilerToolTests.java >@@ -604,7 +604,7 @@ > assertTrue("delete failed", inputFile.delete()); > } > >- public void testCompilerOneClassWithEclipseCompiler4() { >+ public void testCompilerOneClassWithEclipseCompiler4() throws IOException { > JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler(); > if (systemCompiler == null) { > System.out.println("No system java compiler available"); >@@ -653,6 +653,7 @@ > } > // check that the .class file exist for X > assertTrue("delete failed", inputFile.delete()); >+ manager.close(); > } > > public void testCompilerOneClassWithEclipseCompiler5() { >@@ -869,6 +870,7 @@ > builder.append(name.substring(lastIndexOf + 1)); > } > assertEquals("Wrong contents", "X.java", String.valueOf(builder)); >+ fileManager.close(); > } catch (IOException e) { > e.printStackTrace(); > } >@@ -943,6 +945,7 @@ > builder.append(name.substring(lastIndexOf + 1)); > } > assertEquals("Wrong contents", "X2.javaX.java", String.valueOf(builder)); >+ fileManager.close(); > } catch (IOException e) { > e.printStackTrace(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 363293
:
206678
|
206697