You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/08/06 16:51:36 UTC

groovy git commit: Fix the test groovy.ui.GroovyMainTest.testURISource

Repository: groovy
Updated Branches:
  refs/heads/master 9849ff1df -> bbe543d9a


Fix the test groovy.ui.GroovyMainTest.testURISource


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/bbe543d9
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/bbe543d9
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/bbe543d9

Branch: refs/heads/master
Commit: bbe543d9a4f2af41e8aecbec332f5526f39ea8d3
Parents: 9849ff1
Author: sunlan <su...@apache.org>
Authored: Mon Aug 7 00:51:19 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Mon Aug 7 00:51:19 2017 +0800

----------------------------------------------------------------------
 .../org/apache/groovy/parser/antlr4/Antlr4ParserPlugin.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/bbe543d9/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/Antlr4ParserPlugin.java
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/Antlr4ParserPlugin.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/Antlr4ParserPlugin.java
index 31ad35f..0b4728f 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/Antlr4ParserPlugin.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/Antlr4ParserPlugin.java
@@ -52,8 +52,13 @@ public class Antlr4ParserPlugin implements ParserPlugin {
     }
 
     @Override
-    public ModuleNode buildAST(SourceUnit sourceUnit, java.lang.ClassLoader classLoader, Reduction cst) throws ParserException {
-        if (null != this.readerSource) {
+    public ModuleNode buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduction cst) throws ParserException {
+        try {
+            ReaderSource readerSource = sourceUnit.getSource();
+            if (null == readerSource || null == readerSource.getReader()) {
+                sourceUnit.setSource(this.readerSource);
+            }
+        } catch (IOException e) {
             sourceUnit.setSource(this.readerSource);
         }