JDK 9 RFR of JDK-8169971: tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java fails intermittently

Paul Sandoz paul.sandoz at oracle.com
Wed Apr 12 16:36:14 UTC 2017


Hi Amy,

FileUtils
—

-            } catch (NoSuchFileException | DirectoryNotEmptyException x) {
+            } catch (NoSuchFileException x) {


You removed the catch and rethrow of DirectoryNotEmptyException. The documentation of deleteFIleIfExistsWithRetry states:

  72     /**
  73      * Deletes a file, retrying if necessary.
  74      * No exception thrown if file doesn't exist.
  75      *
  76      * @param path  the file to delete
  77      *
  78      * @throws NoSuchFileException
  79      *         if the file does not exist (optional specific exception)
  80      * @throws DirectoryNotEmptyException
  81      *         if the file is a directory and could not otherwise be deleted
  82      *         because the directory is not empty (optional specific exception)
  83      * @throws IOException
  84      *         if an I/O error occurs
  85      */
  86     public static void deleteFileIfExistsWithRetry(Path path)


I dunno what it means by "(optional specific exception)”, but what happens now if deleteFileIfExistsWithRetry is called with a non-empty directory?

It’s amazing how hard it is to actually forcibly delete something. Such “simple” ( :-) ) utilities should be part of the JDK.

—

Do you think it’s simpler just to let jtreg cleanup? There are a few Mr.Jar tests that clean up after themselves but i wonder if it’s just simpler to let jtreg do it? any thoughts on that?

Paul.

> On 10 Apr 2017, at 19:15, Amy Lu <amy.lu at oracle.com> wrote:
> 
> Please review this test-only change.
> 
> tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java
> 
> This test fails intermittently on Windows platform in the final cleanup step, @AfterClass, in which test tries to delete all dirs and files it created. Though it’s okay to leave this cleanup work to jtreg, I still make it done in test by making test to create everything under ./testoutput (testdir), and delete this testdir directly with FileUtils.deleteFileTreeWithRetry(testdir).
> 
> Moreover, in FileUtils, as it tries to delete path with retry, we might want to give it a chance to "retry" in case of DirectoryNotEmptyException.
> 
> bug: https://bugs.openjdk.java.net/browse/JDK-8169971
> webrev: http://cr.openjdk.java.net/~amlu/8169971/webrev.00/
> 
> Thanks,
> Amy
> 



More information about the core-libs-dev mailing list