Author: sebb Date: Wed Mar 25 00:04:41 2009 New Revision: 758096 URL: http://svn.apache.org/viewvc?rev=758096&view=rev Log: Allow for globalScope being null
Modified: jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/SimpleScriptContext.java Modified: jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/SimpleScriptContext.java URL: http://svn.apache.org/viewvc/jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/SimpleScriptContext.java?rev=758096&r1=758095&r2=758096&view=diff ============================================================================== --- jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/SimpleScriptContext.java (original) +++ jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/SimpleScriptContext.java Wed Mar 25 00:04:41 2009 @@ -85,7 +85,7 @@ if (engineScope.get(name) != null) { return engineScope.get(name); - } else if (globalScope.get(name) != null) { + } else if (globalScope != null && globalScope.get(name) != null) { return globalScope.get(name); } else { return null; @@ -101,7 +101,7 @@ case ENGINE_SCOPE: return engineScope.get(name); case GLOBAL_SCOPE: - return globalScope.get(name); + return globalScope != null ? globalScope.get(name) : null; default: throw new IllegalArgumentException("invalid scope"); } @@ -114,7 +114,7 @@ if (engineScope.containsKey(name)) { return ENGINE_SCOPE; - } else if(globalScope.containsKey(name)) { + } else if(globalScope != null && globalScope.containsKey(name)) { return GLOBAL_SCOPE; } @@ -143,7 +143,7 @@ case ENGINE_SCOPE: return engineScope.remove(name); case GLOBAL_SCOPE: - return globalScope.remove(name); + return globalScope != null ? globalScope.remove(name) : null; default: throw new IllegalArgumentException("invalid scope"); } @@ -159,7 +159,11 @@ engineScope.put(name, value); break; case GLOBAL_SCOPE: - globalScope.put(name, value); + if (globalScope != null) { + globalScope.put(name, value); + } else { + throw new IllegalArgumentException("Global scope is null");// TODO is this correct? + } break; default: throw new IllegalArgumentException("invalid scope"); --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: bsf-dev-h...@jakarta.apache.org