Fix bug 462827: Do not wrap JavaAdapter if it implements o.m.j.Scriptable

git-svn-id: svn://10.0.0.236/trunk@255039 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hannes%helma.at
2008-11-14 13:52:29 +00:00
parent ff3ffecf0a
commit b0ae8632a6

View File

@@ -204,7 +204,15 @@ public final class JavaAdapter implements IdFunctionCall
try {
Object adapter = adapterClass.getConstructor(ctorParms).
newInstance(ctorArgs);
return getAdapterSelf(adapterClass, adapter);
Object self = getAdapterSelf(adapterClass, adapter);
// Return unwrapped JavaAdapter if it implements Scriptable
if (self instanceof Wrapper) {
Object unwrapped = ((Wrapper) self).unwrap();
if (unwrapped instanceof Scriptable) {
return unwrapped;
}
}
return self;
} catch (Exception ex) {
throw Context.throwAsScriptRuntimeEx(ex);
}