fixed a bug that didn't let primitive values returned by a bean pass through

because of a classcastexception.
This commit is contained in:
stefanp 2002-07-31 15:57:25 +00:00
parent c5e1c05dfb
commit a4a0405241

View file

@ -29,24 +29,25 @@ public class ESBeanWrapper extends ESWrapper {
* Wrap getProperty, return ESNode if INode would be returned, * Wrap getProperty, return ESNode if INode would be returned,
* ESMapWrapper if Map would be returned. * ESMapWrapper if Map would be returned.
*/ */
public ESValue getProperty(String propertyName, int hash) throws EcmaScriptException { public ESValue getProperty(String propertyName, int hash) throws EcmaScriptException {
try { try {
ESValue val = super.getProperty (propertyName, hash); ESValue val = super.getProperty (propertyName, hash);
Object theObject = ((ESWrapper)val).getJavaObject (); if (val instanceof ESWrapper) {
if (val instanceof ESWrapper && theObject instanceof INode) { Object theObject = ((ESWrapper)val).getJavaObject ();
return eval.getNodeWrapper ((INode) theObject); if (val instanceof ESWrapper && theObject instanceof INode) {
} else if (val instanceof ESWrapper && theObject instanceof Map) { return eval.getNodeWrapper ((INode) theObject);
ESMapWrapper wrapper = new ESMapWrapper(eval, (Map) theObject); } else if (val instanceof ESWrapper && theObject instanceof Map) {
if (theObject instanceof SystemProperties && super.getJavaObject () instanceof ApplicationBean) ESMapWrapper wrapper = new ESMapWrapper(eval, (Map) theObject);
wrapper.setReadonly(true); if (theObject instanceof SystemProperties && super.getJavaObject () instanceof ApplicationBean)
return wrapper; wrapper.setReadonly(true);
} else { return wrapper;
return val; }
} }
} catch (Exception rte) { return val;
return ESNull.theNull; } catch (Exception rte) {
} return ESNull.theNull;
} }
}
public void putProperty(String propertyName, ESValue propertyValue, int hash) throws EcmaScriptException { public void putProperty(String propertyName, ESValue propertyValue, int hash) throws EcmaScriptException {
try { try {