/**
* Deletes all allocated temporary directories.
*/
publicsynchronized void dispose() throws IOException, InterruptedException {
IOException x = null;
for (File dir : tmpDirectories)
try {
new FilePath(dir).deleteRecursive();
} catch (IOException e) {
x = e;
}
tmpDirectories.clear();
if (x!=null) thrownew IOException("Failed to clean up temp dirs",x);
}
the IoException causes the actual cause to be lost (and only the most recent one is throw,) this specific case can be fixed by actually throwing a CompositeIOException - but we can not control all the code that catches and handles exceptions.