Author: ate Date: Sun Sep 7 21:32:24 2014 New Revision: 1623232 URL: http://svn.apache.org/r1623232 Log: trivial but useful performance improvements (thanks to Rinke Hoekstra for reporting them)
Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleContext.java Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleContext.java URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleContext.java?rev=1623232&r1=1623231&r2=1623232&view=diff ============================================================================== --- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleContext.java (original) +++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleContext.java Sun Sep 7 21:32:24 2014 @@ -34,7 +34,8 @@ public class SimpleContext implements Co /** Serial version UID. */ private static final long serialVersionUID = 1L; /** Implementation independent log category. */ - private Log log = LogFactory.getLog(Context.class); + private static final Log DEFAULT_LOG = LogFactory.getLog(Context.class); + private Log log = DEFAULT_LOG; /** The parent Context to this Context. */ private Context parent; /** The Map of variables and their values in this Context. */ @@ -107,8 +108,9 @@ public class SimpleContext implements Co * @see org.apache.commons.scxml2.Context#get(java.lang.String) */ public Object get(final String name) { - if (getVars().containsKey(name)) { - return getVars().get(name); + Object localValue = getVars().get(name); + if (localValue != null) { + return localValue; } else if (parent != null) { return parent.get(name); } else {