[
https://issues.apache.org/jira/browse/MYFACES-3545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe updated MYFACES-3545:
------------------------------------
Resolution: Fixed
Fix Version/s: 2.1.8
2.0.14
Status: Resolved (was: Patch Available)
Thanks to Martin Koci for provide this patch
> FACELETS_REFRESH_PERIOD > 0 + .xhtml in .jar = Too many open files
> -------------------------------------------------------------------
>
> Key: MYFACES-3545
> URL: https://issues.apache.org/jira/browse/MYFACES-3545
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 2.1.7
> Environment: myfaces trunk
> Reporter: Martin Kočí
> Assignee: Martin Kočí
> Fix For: 2.0.14, 2.1.8
>
> Attachments: MYFACES-3545.patch
>
>
> this is a classic one:
> https://issues.apache.org/jira/browse/TRINIDAD-73
> https://issues.apache.org/jira/browse/MYFACES-1982
> From
> http://www.mail-archive.com/[email protected]/msg20937.html:
> " .... It's a bug in Sun's JarURLConnection. The workaround should solve the
> problems even in
> development mode.
> 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) {
> JarURLConnection jarUrlConnection = (JarURLConnection)
> connection;
> URL jarFileUrl = jarUrlConnection.getJarFileURL();
> URLConnection jarFileConnection =
> jarFileUrl.openConnection();
> long lastModified = jarFileConnection.getLastModified();
> jarFileConnection.getInputStream().close();
> System.out.println("last modified=" + new
> Date(lastModified));
> }
> ... "
> This little hack is not done in myfaces DefaultFaceletFactory and
> FaceletCacheImpl.
> Simple workaround is: javax.faces.FACELETS_REFRESH_PERIOD=0 in Development
> stage
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira