" .... It's a bug in Sun's JarURLConnection. The workaround should solve the problems even in
When you open an URL connection to an entry in a jar, you get a
JarURLConnection. The JarURLConnection in the package
sun.net.www.protocol.jar has an internal field
/* the url connection for the JAR file */
private URLConnection jarFileURLConnection;
which you cannot access in any way. When you ask for the last modified
time, the JarURLConnection will ask for the header field
"last-modified", which in turn will ask the jarFileURLConnection for the
that header field, which in turn will cause the initializeHeaders() call
in FileURLConnection, which in turn calls connect() and opens the file
(even though for the last modified header that is quite unnecessary).
The way to close the file is to call getInputStream().close() on the
jarFileURLConnection field, but unfortunately you can't since it is hidden.
There is a very simple workaround though. In code:
URL url = new URL("jar:file:jarfile.jar!Entry.class");
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection)
This little hack is not done in myfaces DefaultFaceletFactory and FaceletCacheImpl.
Simple workaround is: javax.faces.FACELETS_REFRESH_PERIOD=0 in Development stage