--- openjdk.orig/jdk/test/tools/jar/ChangeDir.java	2011-05-26 16:13:43.000000000 +0200
+++ openjdk/jdk/test/tools/jar/ChangeDir.java	2011-05-27 10:59:45.000000000 +0200
@@ -63,11 +63,14 @@
 
     static void doTest(String sep) throws Throwable {
         File testDir = null;
+        File parentDir = null;
         JarFile jf = null;
+        File tempFile = null;
         try {
             // Create a subdirectory "a/b"
-            File f = File.createTempFile("delete", ".me");
-            String dirName = f.getParent();
+            tempFile = File.createTempFile("delete", ".me");
+            String dirName = tempFile.getParent();
+            parentDir = new File(dirName + sep + "a");
             testDir = new File(dirName + sep + "a" + sep + "b");
             cleanup(testDir);
             check(testDir.mkdirs());
@@ -109,6 +112,13 @@
                 jf.close();
             }
             cleanup(testDir);
+            // clean all garbage recently created in temporary directory
+            if (parentDir != null) {
+                parentDir.delete();
+            }
+            if (tempFile != null) {
+                tempFile.delete();
+            }
         }
     }
 
