diff --git a/js/rhino/org/mozilla/javascript/tools/shell/Environment.java b/js/rhino/org/mozilla/javascript/tools/shell/Environment.java index e66e1f9a3976..4458cc591f0c 100644 --- a/js/rhino/org/mozilla/javascript/tools/shell/Environment.java +++ b/js/rhino/org/mozilla/javascript/tools/shell/Environment.java @@ -41,79 +41,79 @@ import java.util.Properties; * @author Patrick C. Beard */ public class Environment extends ScriptableObject { - private Environment thePrototypeInstance = null; - - public static void defineClass(ScriptableObject scope) { + private Environment thePrototypeInstance = null; + + public static void defineClass(ScriptableObject scope) { try { - ScriptableObject.defineClass(scope, Environment.class); - } catch (Exception e) { + ScriptableObject.defineClass(scope, Environment.class); + } catch (Exception e) { throw new Error(e.getMessage()); - } - } + } + } public String getClassName() { return "Environment"; } - public Environment() { - if (thePrototypeInstance == null) - thePrototypeInstance = this; - } - - public Environment(ScriptableObject scope) { - setParentScope(scope); + public Environment() { + if (thePrototypeInstance == null) + thePrototypeInstance = this; + } + + public Environment(ScriptableObject scope) { + setParentScope(scope); Object ctor = ScriptRuntime.getTopLevelProp(scope, "Environment"); if (ctor != null && ctor instanceof Scriptable) { Scriptable s = (Scriptable) ctor; setPrototype((Scriptable) s.get("prototype", s)); } - } - - public boolean has(String name, Scriptable start) { - if (this == thePrototypeInstance) - return super.has(name, start); - - return (System.getProperty(name) != null); - } + } + + public boolean has(String name, Scriptable start) { + if (this == thePrototypeInstance) + return super.has(name, start); + + return (System.getProperty(name) != null); + } public Object get(String name, Scriptable start) { - if (this == thePrototypeInstance) - return super.get(name, start); - - String result = System.getProperty(name); - if (result != null) - return ScriptRuntime.toObject(getParentScope(), result); - else - return Scriptable.NOT_FOUND; - } - - public void put(String name, Scriptable start, Object value) { - if (this == thePrototypeInstance) - super.put(name, start, value); - else - System.getProperties().put(name, ScriptRuntime.toString(value)); - } + if (this == thePrototypeInstance) + return super.get(name, start); + + String result = System.getProperty(name); + if (result != null) + return ScriptRuntime.toObject(getParentScope(), result); + else + return Scriptable.NOT_FOUND; + } + + public void put(String name, Scriptable start, Object value) { + if (this == thePrototypeInstance) + super.put(name, start, value); + else + System.getProperties().put(name, ScriptRuntime.toString(value)); + } - private Object[] collectIds() { - Properties props = System.getProperties(); - Enumeration names = props.propertyNames(); - Vector keys = new Vector(); - while (names.hasMoreElements()) - keys.addElement(names.nextElement()); - Object[] ids = new Object[keys.size()]; - keys.copyInto(ids); - return ids; - } + private Object[] collectIds() { + Properties props = System.getProperties(); + Enumeration names = props.propertyNames(); + Vector keys = new Vector(); + while (names.hasMoreElements()) + keys.addElement(names.nextElement()); + Object[] ids = new Object[keys.size()]; + keys.copyInto(ids); + return ids; + } public Object[] getIds() { - if (this == thePrototypeInstance) - return super.getIds(); - return collectIds(); + if (this == thePrototypeInstance) + return super.getIds(); + return collectIds(); } public Object[] getAllIds() { - if (this == thePrototypeInstance) - return super.getAllIds(); - return collectIds(); + if (this == thePrototypeInstance) + return super.getAllIds(); + return collectIds(); } } diff --git a/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Environment.java b/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Environment.java index e66e1f9a3976..4458cc591f0c 100644 --- a/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Environment.java +++ b/js/rhino/toolsrc/org/mozilla/javascript/tools/shell/Environment.java @@ -41,79 +41,79 @@ import java.util.Properties; * @author Patrick C. Beard */ public class Environment extends ScriptableObject { - private Environment thePrototypeInstance = null; - - public static void defineClass(ScriptableObject scope) { + private Environment thePrototypeInstance = null; + + public static void defineClass(ScriptableObject scope) { try { - ScriptableObject.defineClass(scope, Environment.class); - } catch (Exception e) { + ScriptableObject.defineClass(scope, Environment.class); + } catch (Exception e) { throw new Error(e.getMessage()); - } - } + } + } public String getClassName() { return "Environment"; } - public Environment() { - if (thePrototypeInstance == null) - thePrototypeInstance = this; - } - - public Environment(ScriptableObject scope) { - setParentScope(scope); + public Environment() { + if (thePrototypeInstance == null) + thePrototypeInstance = this; + } + + public Environment(ScriptableObject scope) { + setParentScope(scope); Object ctor = ScriptRuntime.getTopLevelProp(scope, "Environment"); if (ctor != null && ctor instanceof Scriptable) { Scriptable s = (Scriptable) ctor; setPrototype((Scriptable) s.get("prototype", s)); } - } - - public boolean has(String name, Scriptable start) { - if (this == thePrototypeInstance) - return super.has(name, start); - - return (System.getProperty(name) != null); - } + } + + public boolean has(String name, Scriptable start) { + if (this == thePrototypeInstance) + return super.has(name, start); + + return (System.getProperty(name) != null); + } public Object get(String name, Scriptable start) { - if (this == thePrototypeInstance) - return super.get(name, start); - - String result = System.getProperty(name); - if (result != null) - return ScriptRuntime.toObject(getParentScope(), result); - else - return Scriptable.NOT_FOUND; - } - - public void put(String name, Scriptable start, Object value) { - if (this == thePrototypeInstance) - super.put(name, start, value); - else - System.getProperties().put(name, ScriptRuntime.toString(value)); - } + if (this == thePrototypeInstance) + return super.get(name, start); + + String result = System.getProperty(name); + if (result != null) + return ScriptRuntime.toObject(getParentScope(), result); + else + return Scriptable.NOT_FOUND; + } + + public void put(String name, Scriptable start, Object value) { + if (this == thePrototypeInstance) + super.put(name, start, value); + else + System.getProperties().put(name, ScriptRuntime.toString(value)); + } - private Object[] collectIds() { - Properties props = System.getProperties(); - Enumeration names = props.propertyNames(); - Vector keys = new Vector(); - while (names.hasMoreElements()) - keys.addElement(names.nextElement()); - Object[] ids = new Object[keys.size()]; - keys.copyInto(ids); - return ids; - } + private Object[] collectIds() { + Properties props = System.getProperties(); + Enumeration names = props.propertyNames(); + Vector keys = new Vector(); + while (names.hasMoreElements()) + keys.addElement(names.nextElement()); + Object[] ids = new Object[keys.size()]; + keys.copyInto(ids); + return ids; + } public Object[] getIds() { - if (this == thePrototypeInstance) - return super.getIds(); - return collectIds(); + if (this == thePrototypeInstance) + return super.getIds(); + return collectIds(); } public Object[] getAllIds() { - if (this == thePrototypeInstance) - return super.getAllIds(); - return collectIds(); + if (this == thePrototypeInstance) + return super.getAllIds(); + return collectIds(); } }