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

GroovyScriptEngine fails to load scripts that exist on file:// roots if they only exist on a root that is not the last root

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-JSR-4
    • 1.0-JSR-5
    • None
    • None
    • Mac OSX 1.4 / JDK 1.5

    Description

      If you add two root URLs to a GroovyScriptEngine, say:

      file://home/marc/scripts
      file://home/marc/anotherdir/morescripts

      ...if you have a file located at

      file://home/marc/scripts/test.groovy

      If you try to call gse.run("test.groovy") it will fail saying it cannot find:

      file://home/marc/anotherdir/morescripts/test.groovy

      This is because the code only calls openConnection which succeeds for file URLs. Also it does not break out on the first successful openConnection, so always uses the last and all the previous checks are pointless.

      Suggestion is to fix this to find the FIRST that does not throw an exception from urlconn.getInputStream().

      Code will be attached as comment shortly.

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            marc@anyware.co.uk Marc Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: