Propagate changes from 1.21.2.3 into tip.

This commit is contained in:
norris%netscape.com 2000-04-27 18:39:10 +00:00
Родитель e1f8655608
Коммит 927c1fe19b
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -56,8 +56,15 @@ public class JavaAdapter extends ScriptableObject {
public static Object convertResult(Object result, String classname)
throws ClassNotFoundException
{
return NativeJavaObject.coerceType(Class.forName(classname),
result);
Class c = ScriptRuntime.loadClassName(classname);
if (result == Undefined.instance &&
(c != ScriptRuntime.ObjectClass &&
c != ScriptRuntime.StringClass))
{
// Avoid an error for an undefined value; return null instead.
return null;
}
return NativeJavaObject.coerceType(c, result);
}
public static Object js_JavaAdapter(Context cx, Object[] args,

Просмотреть файл

@ -56,8 +56,15 @@ public class JavaAdapter extends ScriptableObject {
public static Object convertResult(Object result, String classname)
throws ClassNotFoundException
{
return NativeJavaObject.coerceType(Class.forName(classname),
result);
Class c = ScriptRuntime.loadClassName(classname);
if (result == Undefined.instance &&
(c != ScriptRuntime.ObjectClass &&
c != ScriptRuntime.StringClass))
{
// Avoid an error for an undefined value; return null instead.
return null;
}
return NativeJavaObject.coerceType(c, result);
}
public static Object js_JavaAdapter(Context cx, Object[] args,