JDK-8075205 : java/net/URLClassLoader/closetest/CloseTest.java and GetResourceAsStream.java failed with existing dir
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: generic
  • Submitted: 2015-03-16
  • Updated: 2017-06-09
  • Resolved: 2017-06-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_minorResolved
Related Reports
Duplicate :  
Relates :  
Description
These two tests failed with different but probably related problems. From test logs, both of the failures seem to be due to existing dir "C:\Users\aurora\sandbox\gresults\testoutput\jdk_net\JTwork\classes\java\net\URLClassLoader\closetest\testdir"

This is test output by java/net/URLClassLoader/closetest/CloseTest.java

----------System.out:(5/552)*----------
Doing tests with URL: file:C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest/test.jar and http://127.0.0.1:64910/
 ... OK
Doing tests with URL: file:C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest/test.jar and http://127.0.0.1:64910/
 ... OK
Doing tests with URL: file:C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest/testdir/ and http://127.0.0.1:64910/
----------System.err:(185/17905)*----------
java.nio.file.AccessDeniedException: C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest\\testdir\\com\\foo\\Resource1
	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
	at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
	at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
	at java.nio.file.Files.delete(Files.java:1126)
	at jdk.testlibrary.FileUtils.deleteFileWithRetry0(FileUtils.java:103)
	at jdk.testlibrary.FileUtils.access$000(FileUtils.java:41)
	at jdk.testlibrary.FileUtils$1.visitFile(FileUtils.java:161)
	at jdk.testlibrary.FileUtils$1.visitFile(FileUtils.java:157)
	at java.nio.file.Files.walkFileTree(Files.java:2671)
	at java.nio.file.Files.walkFileTree(Files.java:2743)
	at jdk.testlibrary.FileUtils.deleteFileTreeUnchecked(FileUtils.java:157)
	at jdk.testlibrary.FileUtils.deleteFileTreeWithRetry(FileUtils.java:144)
	at Common.rm_minus_rf(Common.java:54)
	at CloseTest.test(CloseTest.java:135)
	at CloseTest.main(CloseTest.java:78)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:502)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:745)
	Suppressed: java.nio.file.AccessDeniedException: C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest\\testdir\\com\\foo\\Resource1
		... 23 more
	Suppressed: java.nio.file.DirectoryNotEmptyException: C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest\\testdir\\com\\foo
		at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:266)
		at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
		at java.nio.file.Files.delete(Files.java:1126)
		at jdk.testlibrary.FileUtils.deleteFileWithRetry0(FileUtils.java:103)
		at jdk.testlibrary.FileUtils.access$000(FileUtils.java:41)
		at jdk.testlibrary.FileUtils$1.postVisitDirectory(FileUtils.java:173)
		at jdk.testlibrary.FileUtils$1.postVisitDirectory(FileUtils.java:157)
		at java.nio.file.Files.walkFileTree(Files.java:2689)
		... 12 more
	Suppressed: java.nio.file.DirectoryNotEmptyException: C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest\\testdir\\com
		at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:266)
		at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
		at java.nio.file.Files.delete(Files.java:1126)
		at jdk.testlibrary.FileUtils.deleteFileWithRetry0(FileUtils.java:103)
		at jdk.testlibrary.FileUtils.access$000(FileUtils.java:41)
		at jdk.testlibrary.FileUtils$1.postVisitDirectory(FileUtils.java:173)
		at jdk.testlibrary.FileUtils$1.postVisitDirectory(FileUtils.java:157)
		at java.nio.file.Files.walkFileTree(Files.java:2689)
		... 12 more
	Suppressed: java.nio.file.DirectoryNotEmptyException: C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest\\testdir
		at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:266)
		at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
		at java.nio.file.Files.delete(Files.java:1126)
		at jdk.testlibrary.FileUtils.deleteFileWithRetry0(FileUtils.java:103)
		at jdk.testlibrary.FileUtils.access$000(FileUtils.java:41)
		at jdk.testlibrary.FileUtils$1.postVisitDirectory(FileUtils.java:173)
		at jdk.testlibrary.FileUtils$1.postVisitDirectory(FileUtils.java:157)
		at java.nio.file.Files.walkFileTree(Files.java:2689)
		... 12 more


This is output by java/net/URLClassLoader/closetest/GetResourceAsStream.java
----------System.out:(6/444)----------
Doing tests with URL: file:/C:/Users/aurora/sandbox/gresults/testoutput/jdk_net/JTwork/classes/java/net/URLClassLoader/closetest/test.jar
 ... OK
Doing tests with URL: file:/C:/Users/aurora/sandbox/gresults/testoutput/jdk_net/JTwork/classes/java/net/URLClassLoader/closetest/test.jar
 ... OK
Doing tests with URL: file:/C:/Users/aurora/sandbox/gresults/testoutput/jdk_net/JTwork/classes/java/net/URLClassLoader/closetest/test.jar
 ... OK
----------System.err:(14/1118)*----------
java.lang.RuntimeException: Dir exists: C:\\Users\\aurora\\sandbox\\gresults\\testoutput\\jdk_net\\JTwork\\classes\\java\\net\\URLClassLoader\\closetest\\testdir
	at Common.copyDir(Common.java:62)
	at GetResourceAsStream.main(GetResourceAsStream.java:71)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:502)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:745)
Comments
This has been addressed in JDK-8166139
09-06-2017

OpenJDK review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-October/044173.html
20-10-2016

The tests uses classes directory for the output files. This may result in the files being left over after the test is complete which can result in instability. So the test can refactored to use the scratch dir so the files wont be left behind. The tests copies the files to be compiled form test src to test classes which can result in copy of permission and result in instability because the test has delete operations. The test can be refactored to remove shell and use the testlibrary for compilation and jar creation and eliminate movement of files.
17-10-2016

http://cr.openjdk.java.net/~sraghavan/8075205/webrev.00/
17-10-2016