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

GroovyClassLoader fails to load a script from a file whose absolute name contains spaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1-beta-1
    • None
    • None
    • Patch

    Description

      I have two scripts in a directory under C:\Documents and Settings:
      A.groovy:
      this.class.classLoader.loadClass("B", true, false, true)

      and B.groovy which contains a simple (arbitrary) script.

      A.groovy fails to find the "B" class. It gets as far as the GroovyClassLoader.getSourceFile, which successfully locates the resource URL "file:/C:/Documents%20and%20Settings/.../B.groovy". However, it then tries to turn this into a File on the line:
      File path = new File(ret.getFile()).getParentFile();
      This fails, as java.io.File expects the unescaped filename of "C:/Documents and Settings/...", i.e. with the %20s converted to spaces.

      Attachments

        1. GroovyClassLoader.txt
          3 kB
          John Carnell
        2. GroovyClassLoaderTest.txt
          2 kB
          John Carnell

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              kevinthomas Kevin Thomas
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: