You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by Persi <gi...@git.apache.org> on 2015/06/24 14:41:12 UTC

[GitHub] incubator-groovy pull request: GROOVY-7018 GroovyClassLoader addCl...

GitHub user Persi opened a pull request:

    https://github.com/apache/incubator-groovy/pull/43

    GROOVY-7018 GroovyClassLoader addClasspath RegexPattern issue

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Persi/incubator-groovy master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-groovy/pull/43.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #43
    
----
commit 6cf17e1d171503b5e86f5e29098d0cb619e94959
Author: Persi <th...@freenet.de>
Date:   2015-06-24T09:09:35Z

    GROOVY-7018 GroovyClassLoader addClasspath RegexPattern issue
    
    GroovyMain and GroovyClassLoader had problems in Cygwin environments
    with finding Scripts.

commit cdcb16930bf5ef63b6c6eff9f50f644353c85d0e
Author: Persi <th...@freenet.de>
Date:   2015-06-24T09:15:53Z

    Revert "GROOVY-7018 GroovyClassLoader addClasspath RegexPattern issue"
    
    This reverts commit 6cf17e1d171503b5e86f5e29098d0cb619e94959.

commit 6495a83e5f047719fc85d6f09a4334c8ad94eccb
Author: Persi <th...@freenet.de>
Date:   2015-06-24T09:20:16Z

    Revert "Revert "GROOVY-7018 GroovyClassLoader addClasspath RegexPattern issue""
    
    This reverts commit cdcb16930bf5ef63b6c6eff9f50f644353c85d0e.

commit c86f4a54ab282b84ea9aabd67721894b93e9d093
Author: Persi <th...@freenet.de>
Date:   2015-06-24T12:40:12Z

    GROOVY-7018 GroovyClassLoader addClasspath RegexPattern issue
    
    GroovyClassLoaderTest is now running succesfully with the new
    ClassLoaderCode.

----


---
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.
---

[GitHub] incubator-groovy pull request: GROOVY-7018 GroovyClassLoader addCl...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-groovy/pull/43


---
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.
---

[GitHub] incubator-groovy pull request: GROOVY-7018 GroovyClassLoader addCl...

Posted by paulk-asert <gi...@git.apache.org>.
Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/incubator-groovy/pull/43#discussion_r33632554
  
    --- 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 --
    
    can't you just use "scriptFile" instead of the second call to "huntForTheScriptFile"?


---
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.
---

[GitHub] incubator-groovy pull request: GROOVY-7018 GroovyClassLoader addCl...

Posted by Persi <gi...@git.apache.org>.
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.
---