Re: JarURLConnection.getJarFile() resource leak when file is not found

2015-09-04 Thread Neon Ngo
Peter, I just tried disabling caching via call to urlConnection.setUseCaches(false) prior to my call to getJarFile() in my test code and that does prevent the resource leak in test scenario. So that is one possible workaround when I am anticipating that the file will not exist in the jar file. Al

Re: JarURLConnection.getJarFile() resource leak when file is not found

2015-08-25 Thread Peter Levart
You're right, Neon! I thought I saw close() somewhere in JarURLConnection, but it seems I saw it somewhere else. Peeking at code, I think it would help if you did: jarUrlConnection.setUseCaches(false); before invoking: jarUrlConnection.getJarFile()/getJarEntry()/connect(); In case caches

Re: JarURLConnection.getJarFile() resource leak when file is not found

2015-08-25 Thread Neon Ngo
There are no close(), disconnect(), or similar method on java.net.JarURLConnection nor it's super class (java.net.URLConnection). My sample test program will close the resource when searching for an "existing" file inside the jar file. It only has resource leak (open file descriptor) when searchin

Re: JarURLConnection.getJarFile() resource leak when file is not found

2015-08-21 Thread Peter Levart
On 08/17/2015 04:02 PM, Neon Ngo wrote: The test program below shows a resource leak in java.net.JarURLConnection's getJarFile() when given an non-existent file to lookup in the jar file. Under Windows, the last printout shows that it is not able to remove the test input jar file. Any input