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/12/21 01:40:06 UTC
[1/2] groovy git commit: Close writer and reader
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_4_X cb39f7f72 -> 5314b30cf
Close writer and reader
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7ffe41c8
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7ffe41c8
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7ffe41c8
Branch: refs/heads/GROOVY_2_4_X
Commit: 7ffe41c8436a4c200a1908cd7b2108036aa45b5c
Parents: cb39f7f
Author: sunlan <su...@apache.org>
Authored: Thu Dec 21 09:39:44 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Thu Dec 21 09:39:44 2017 +0800
----------------------------------------------------------------------
src/main/groovy/ui/GroovyMain.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/7ffe41c8/src/main/groovy/ui/GroovyMain.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/ui/GroovyMain.java b/src/main/groovy/ui/GroovyMain.java
index 354a84a..77df5fe 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -484,8 +484,8 @@ public class GroovyMain {
try {
processReader(s, reader, writer);
} finally {
- reader.close();
writer.close();
+ reader.close();
}
} else {
@@ -512,11 +512,12 @@ public class GroovyMain {
if (!editFiles) {
BufferedReader reader = new BufferedReader(new FileReader(file));
+ PrintWriter writer = new PrintWriter(System.out);
+
try {
- PrintWriter writer = new PrintWriter(System.out);
processReader(s, reader, writer);
- writer.flush();
} finally {
+ writer.close();
reader.close();
}
} else {
@@ -532,14 +533,12 @@ public class GroovyMain {
throw new IOException("unable to rename " + file + " to " + backup);
BufferedReader reader = new BufferedReader(new FileReader(backup));
+ PrintWriter writer = new PrintWriter(new FileWriter(file));
+
try {
- PrintWriter writer = new PrintWriter(new FileWriter(file));
- try {
- processReader(s, reader, writer);
- } finally {
- writer.close();
- }
+ processReader(s, reader, writer);
} finally {
+ writer.close();
reader.close();
}
}
[2/2] groovy git commit: Improve robust: Check type before casting
Posted by su...@apache.org.
Improve robust: Check type before casting
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5314b30c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5314b30c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5314b30c
Branch: refs/heads/GROOVY_2_4_X
Commit: 5314b30cf8a72681fe91b0f2c3b1db07016c949a
Parents: 7ffe41c
Author: sunlan <su...@apache.org>
Authored: Thu Dec 21 09:39:53 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Thu Dec 21 09:39:53 2017 +0800
----------------------------------------------------------------------
src/main/org/codehaus/groovy/classgen/asm/MopWriter.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/5314b30c/src/main/org/codehaus/groovy/classgen/asm/MopWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/asm/MopWriter.java b/src/main/org/codehaus/groovy/classgen/asm/MopWriter.java
index b32ef4d..5744b1a 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/MopWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/MopWriter.java
@@ -69,6 +69,10 @@ public class MopWriter {
}
public boolean equals(Object obj) {
+ if (!(obj instanceof MopKey)) {
+ return false;
+ }
+
MopKey other = (MopKey) obj;
return other.name.equals(name) && equalParameterTypes(other.params,params);
}