Permalink
Browse files

Bug 387465 - Incorrect string evaluations with Rhino 1.7R4

  • Loading branch information...
1 parent 8dc6d86 commit 6e35adf9cc7a9ef1e074f33d77d02e95d8722669 @mrennie mrennie committed Sep 10, 2012
@@ -178,7 +178,7 @@ public Object evaluate(String source) {
RhinoDebuggerImpl rhinoDebugger = (RhinoDebuggerImpl) context.getDebugger();
rhinoDebugger.disableThread();
- Context evalContext = context.getFactory().enter();
+ Context evalContext = context.getFactory().enterContext();
Debugger debugger = evalContext.getDebugger();
Object debuggerContextData = evalContext.getDebuggerContextData();
evalContext.setDebugger(null, null);
@@ -207,7 +207,7 @@ public boolean evaluateCondition(String condition) {
RhinoDebuggerImpl rhinoDebugger = (RhinoDebuggerImpl) context.getDebugger();
rhinoDebugger.disableThread();
- Context evalContext = context.getFactory().enter();
+ Context evalContext = context.getFactory().enterContext();
Debugger debugger = evalContext.getDebugger();
Object debuggerContextData = evalContext.getDebuggerContextData();
evalContext.setDebugger(null, null);
@@ -234,7 +234,7 @@ public Object lookup(Long handle) {
RhinoDebuggerImpl rhinoDebugger = (RhinoDebuggerImpl) context.getDebugger();
rhinoDebugger.disableThread();
- Context lookupContext = context.getFactory().enter();
+ Context lookupContext = context.getFactory().enterContext();
Debugger debugger = lookupContext.getDebugger();
Object debuggerContextData = lookupContext.getDebuggerContextData();
lookupContext.setDebugger(null, null);
@@ -286,7 +286,7 @@ public Object serialize(Long handle, Object object) {
} else if (object instanceof Number) {
Object value = (object == ScriptRuntime.NaNobj) ? null : object;
serializeSimpleType(value, JSONConstants.NUMBER, result);
- } else if (object instanceof String) {
+ } else if (object instanceof CharSequence) {
serializeSimpleType(object, JSONConstants.STRING, result);
} else if (object instanceof Scriptable) {
Scriptable scriptable = (Scriptable) object;
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others All rights reserved. This
+ * Copyright (c) 2010, 2012 IBM Corporation and others All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -365,8 +365,8 @@ else if (value instanceof Boolean)
buffer.append(value.toString());
else if (value instanceof Number)
writeNumber((Number) value, buffer);
- else if (value instanceof String)
- writeString((String) value, buffer);
+ else if (value instanceof CharSequence)
+ writeCharSequence((CharSequence) value, buffer);
else if (value instanceof Collection)
writeArray((Collection) value, buffer);
else if (value instanceof Map)
@@ -399,7 +399,7 @@ private static void writeObject(Map map, StringBuffer buffer) {
Object key = iterator.next();
if (!(key instanceof String))
throw error("Map keys must be an instance of String but was '" + key.getClass().getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$););
- writeString((String) key, buffer);
+ writeCharSequence((CharSequence) key, buffer);
buffer.append(':');
writeValue(map.get(key), buffer);
buffer.append(',');
@@ -422,7 +422,7 @@ private static void writeArray(Collection collection, StringBuffer buffer) {
buffer.append(']');
}
- private static void writeString(String string, StringBuffer buffer) {
+ private static void writeCharSequence(CharSequence string, StringBuffer buffer) {
buffer.append('"');
int length = string.length();
for (int i = 0; i < length; i++) {

0 comments on commit 6e35adf

Please sign in to comment.