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

GroovyClassLoader.isSourceNewer() fails when url has spaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-beta-1
    • 1.7.4, 1.8-beta-1
    • None
    • None

    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. reloading.patch
          4 kB
          Hans Lund
        2. isSourceNewer.patch
          2 kB
          Hans Lund
        3. GroovyClassLoaderTest.java
          6 kB
          Hans Lund

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: