Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-08-25 04:30:01 -0400
committerEike Stepper2016-08-25 04:30:01 -0400
commit58eb0dd28337648b9e53f259111355cb90ed9333 (patch)
tree21968df4372c26c7231a0c71298f9a46ff66a8d4 /plugins/org.eclipse.net4j.tests/src/org
parent63d092b3bf6eaa7521ec07570a5cc66ae9b2c318 (diff)
downloadcdo-58eb0dd28337648b9e53f259111355cb90ed9333.tar.gz
cdo-58eb0dd28337648b9e53f259111355cb90ed9333.tar.xz
cdo-58eb0dd28337648b9e53f259111355cb90ed9333.zip
[500245] Lob cache can't be deleted (streams not closed?)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=500245
Diffstat (limited to 'plugins/org.eclipse.net4j.tests/src/org')
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java47
1 files changed, 40 insertions, 7 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index f7338b3bbf..8420c88071 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -92,7 +92,7 @@ public abstract class AbstractOMTest extends TestCase
private static String testName;
- private transient List<File> filesToDelete = new ArrayList<File>();
+ private transient final List<File> filesToDelete = new ArrayList<File>();
private transient String codeLink;
@@ -435,19 +435,52 @@ public abstract class AbstractOMTest extends TestCase
deleteFiles();
}
- public synchronized void deleteFiles()
+ public void deleteFiles()
{
- for (File file : filesToDelete)
+ synchronized (filesToDelete)
{
- IOUtil.delete(file);
+ for (File file : filesToDelete)
+ {
+ IOUtil.delete(file);
+ }
+ filesToDelete.clear();
+ }
+ }
+
+ public void addFileToDelete(File file)
+ {
+ synchronized (filesToDelete)
+ {
+ filesToDelete.add(file);
}
+ }
- filesToDelete.clear();
+ public File getTempName() throws IORuntimeException
+ {
+ File name = TMPUtil.getTempName();
+ addFileToDelete(name);
+ return name;
+ }
+
+ public File getTempName(String prefix) throws IORuntimeException
+ {
+ File name = TMPUtil.getTempName(prefix);
+ addFileToDelete(name);
+ return name;
+ }
+
+ public File getTempName(String prefix, String suffix) throws IORuntimeException
+ {
+ File name = TMPUtil.getTempName(prefix, suffix);
+ addFileToDelete(name);
+ return name;
}
- public synchronized void addFileToDelete(File file)
+ public File getTempName(String prefix, String suffix, File directory) throws IORuntimeException
{
- filesToDelete.add(file);
+ File name = TMPUtil.getTempName(prefix, suffix, directory);
+ addFileToDelete(name);
+ return name;
}
public File createTempFolder() throws IORuntimeException

Back to the top