Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4037

GroovyClassLoader leaves file handles open

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.7.0
    • 1.7.1
    • class generator
    • None
    • any

    Description

      GroovyClassLoader leaves file handles open.

      We use Groovy scripts within an application server. On systems that protect open files with locks (e.g. Windows) this bug prevents Groovy scripts from being redeployed.

      The following code shows the problem:

      public void test() throws Exception
      {
        final File              l_fileScript;
        final GroovyClassLoader l_ldr;
        final GroovyCodeSource  l_cs;
        final Class<?>          l_classScript;
      
        l_fileScript = new File("path/to/script1944A6CADCE5EBA2BE66D50EA1D8AE36562C645E.groovy");
      
        l_ldr = new GroovyClassLoader();
      
        l_cs = new GroovyCodeSource(l_fileScript);
      
        l_cs.setCachable(false);
      
        l_classScript = l_ldr.parseClass(l_cs);
      
        return; // set breakpoint here
      }
      

      At the breakpoint the handle of the script file is still open.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            veita Alexander Veit
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: