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

GroovyClassLoader.isSourceNewer() fails when url has spaces

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6-beta-1
    • Fix Version/s: 1.7.4, 1.8-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:

      Description

      The GroovyClassLoader fails to recompile scripts when the script path contains spaces, as the file latest modified always return 0 (file not found).
      I think this is related to Groovy-1787 issue.

      As a consequence scripts cashed by a GroovyClassLoader will not be updated even if the source is replaced.

      I've extended the GroovyClassLoaderTest.java with a new test method that demonstrate the issue. My guess is that this is not the proper location so someone with a better understanding that me of the project structure should properly move/refactor it.

      Also as far as I can see a fix is almost trivial? within the isSorceNewer() method the filepath:

      String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');

      should be parsed through the internal decodeFileName prior to creating the file object.

      But I'm not convinced that this is the proper fix?

        Attachments

        1. GroovyClassLoaderTest.java
          6 kB
          Hans Lund
        2. isSourceNewer.patch
          2 kB
          Hans Lund
        3. reloading.patch
          4 kB
          Hans Lund

          Activity

            People

            • Assignee:
              guillaume Guillaume Sauthier
              Reporter:
              halu Hans Lund
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: