diff options
author | wisberg <wisberg> | 2003-05-07 06:05:52 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-05-07 06:05:52 +0000 |
commit | 6519e48d6e5aa4799c26a075638af3a5e1d779cd (patch) | |
tree | e5b4e707dbec8ee53b47de3e4dc731ba647bd581 /testing | |
parent | 8bac6711e5a9649b4f4810459c44a057b26dca6e (diff) | |
download | aspectj-6519e48d6e5aa4799c26a075638af3a5e1d779cd.tar.gz aspectj-6519e48d6e5aa4799c26a075638af3a5e1d779cd.zip |
-keepTemp implementation: Suite run iterator calls clearCommand, which also calls validator.deleteTempFiles
Diffstat (limited to 'testing')
-rw-r--r-- | testing/src/org/aspectj/testing/harness/bridge/Sandbox.java | 5 | ||||
-rw-r--r-- | testing/src/org/aspectj/testing/harness/bridge/Validator.java | 19 |
2 files changed, 18 insertions, 6 deletions
diff --git a/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java b/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java index 0e0113fc3..3ad6aad10 100644 --- a/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java +++ b/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java @@ -182,6 +182,11 @@ public class Sandbox { if (null != command) { command = null; } + // also try to clear sandbox/filesystem. + // If locked by suite, we can't. + if (null != validator) { + validator.deleteTempFiles(true); + } } // /** diff --git a/testing/src/org/aspectj/testing/harness/bridge/Validator.java b/testing/src/org/aspectj/testing/harness/bridge/Validator.java index a7a43db08..e5f544356 100644 --- a/testing/src/org/aspectj/testing/harness/bridge/Validator.java +++ b/testing/src/org/aspectj/testing/harness/bridge/Validator.java @@ -507,12 +507,16 @@ public class Validator { public void deleteTempFiles(boolean reportFailures) { if (null == locker) { for (ListIterator iter = tempFiles.listIterator(); iter.hasNext();) { - deleteFile((File) iter.next(), reportFailures); + if (deleteFile((File) iter.next(), reportFailures)) { + iter.remove(); + } } for (ListIterator iter = sandboxes.listIterator(); iter.hasNext();) { Sandbox sandbox = (Sandbox) iter.next(); // XXX assumes all dirs are in sandboxDir - deleteFile(sandbox.sandboxDir, reportFailures); + if (deleteFile(sandbox.sandboxDir, reportFailures)) { + iter.remove(); + } } } } @@ -528,20 +532,23 @@ public class Validator { } - private void deleteFile(File file, boolean reportFailures) { + private boolean deleteFile(File file, boolean reportFailures) { if (null == file) { if (reportFailures) { fail("unable to delete null file"); } - return; + return true; // null file - skip } FileUtil.deleteContents(file); if (file.exists()) { file.delete(); } - if (reportFailures && file.exists()) { - fail("unable to delete " + file); + if (!file.exists()) { + return true; + } else if (reportFailures) { + fail("unable to delete " + file); } + return false; } /** @throws IllegalStateException if handler is null */ |