Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3888

Resource from classpath locked on windows after change in eclipse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.12, 2.1.13, 2.1.14, 2.1.15
    • 2.1.16, 2.2.4
    • None
    • None
    • Tomcat in an Eclipse on Windows environment

    Description

      Loading a JSF page from the classpath in Tomcat in an Eclipse on Windows environment, then changing the JSF file via Eclipse lead to the original file resource being locked by the finalizer thread trying to close an InputStream to the file resource. After a GC the resource was overwritable again. The reason was the unclosed input stream in FaceletCacheImpl.java .

      The following patch fixes the issue.

      — java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java 8 Jan 2013 14:28:47 -0000 1.2
      +++ java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java 24 Apr 2014 16:20:49 -0000
      @@ -154,9 +154,10 @@
      {
      // Should check for file modification

      + URLConnection conn = null;
      try
      {

      • URLConnection conn = facelet.getSource().openConnection();
        + conn = facelet.getSource().openConnection();
        long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);

      return lastModified == 0 || lastModified > target;
      @@ -165,6 +166,16 @@

      { throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e); }

      + // finally close input stream when finished
      + finally {
      + if (conn != null) {
      + try

      { + conn.getInputStream().close(); + }

      catch (IOException e)

      { + throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e); + }

      + }
      + }
      }

      return false;

      Attachments

        1. patch_input_stream_close.patch
          2 kB
          Patrick McLaren
        2. FaceletCacheImpl_patched.java
          6 kB
          Patrick McLaren

        Activity

          People

            lu4242 Leonardo Uribe
            mclaren@his.de Patrick McLaren
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: