groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Persi <...@git.apache.org>
Subject [GitHub] incubator-groovy pull request: GROOVY-7018 GroovyClassLoader addCl...
Date Wed, 01 Jul 2015 06:52:46 GMT
Github user Persi commented on a diff in the pull request:

    https://github.com/apache/incubator-groovy/pull/43#discussion_r33652610
  
    --- Diff: src/main/groovy/ui/GroovyMain.java ---
    @@ -391,17 +391,16 @@ public String getText(String uriOrFilename) throws IOException {
         protected GroovyCodeSource getScriptSource(boolean isScriptFile, String script) throws
IOException, URISyntaxException {
             //check the script is currently valid before starting a server against the script
             if (isScriptFile) {
    -            if (uriPattern.matcher(script).matches()) {
    +            // search for the file and if it exists don't try to use URIs ...
    +            File scriptFile = huntForTheScriptFile(script);
    +            if (!scriptFile.exists() && uriPattern.matcher(script).matches())
{
                     return new GroovyCodeSource(new URI(script));
    -            } else {
    -                return new GroovyCodeSource(huntForTheScriptFile(script));
                 }
    -        } else {
    -            return new GroovyCodeSource(script, "script_from_command_line", GroovyShell.DEFAULT_CODE_BASE);
    +            return new GroovyCodeSource(huntForTheScriptFile(script));
    --- End diff --
    
    Hello Paul,
    
    indeed I could reduce the calls to "huntForTheScriptFile" to one.
    
    I'll commit it.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message