From 16fadae534ef7687d56a5d2ddb167462c27aa9a4 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Tue, 18 Oct 2016 17:15:11 +0530 Subject: [PATCH] 8071678: javax.script.ScriptContext setAttribute method should clarify behavior when GLOBAL_SCOPE is used and global scope object is null Reviewed-by: jlaskey, hannesw --- .../share/classes/javax/script/ScriptContext.java | 3 ++- .../share/classes/javax/script/SimpleScriptContext.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java b/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java index c283a39d3d7..5c7456faab8 100644 --- a/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java +++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java @@ -85,7 +85,8 @@ public interface ScriptContext { public Bindings getBindings(int scope); /** - * Sets the value of an attribute in a given scope. + * Sets the value of an attribute in a given scope. If the scope is GLOBAL_SCOPE + * and no Bindings is set for GLOBAL_SCOPE, then setAttribute call is a no-op. * * @param name The name of the attribute to set * @param value The value of the attribute diff --git a/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java b/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java index c56ce7adb8c..119b3f26fb3 100644 --- a/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java +++ b/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java @@ -213,7 +213,8 @@ public class SimpleScriptContext implements ScriptContext { } /** - * Sets the value of an attribute in a given scope. + * Sets the value of an attribute in a given scope. If the scope is GLOBAL_SCOPE + * and no Bindings is set for GLOBAL_SCOPE, then setAttribute call is a no-op. * * @param name The name of the attribute to set * @param value The value of the attribute