groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject groovy git commit: GROOVY-7771: Exception driven control flow in groovy.lang.Script.getProperty()
Date Sun, 28 Feb 2016 21:36:49 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 58d0c148d -> 472e93560


GROOVY-7771: Exception driven control flow in groovy.lang.Script.getProperty()

path provided by Benjamin Graf


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

Branch: refs/heads/master
Commit: 472e93560c51da489126168b064e8686aff68c88
Parents: 58d0c14
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Sun Feb 28 22:36:23 2016 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Sun Feb 28 22:36:23 2016 +0100

----------------------------------------------------------------------
 src/main/groovy/lang/Script.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/472e9356/src/main/groovy/lang/Script.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/Script.java b/src/main/groovy/lang/Script.java
index 196c74c..2d65813 100644
--- a/src/main/groovy/lang/Script.java
+++ b/src/main/groovy/lang/Script.java
@@ -52,11 +52,10 @@ public abstract class Script extends GroovyObjectSupport {
     }
 
     public Object getProperty(String property) {
-        try {
-            return binding.getVariable(property);
-        } catch (MissingPropertyException e) {
-            return super.getProperty(property);
-        }
+      if (binding.hasVariable(property)) {
+          return binding.getVariable(property);
+      }
+      return super.getProperty(property);
     }
 
     public void setProperty(String property, Object newValue) {


Mime
View raw message