8019617: Better view of objects
Reviewed-by: art, skoivu
This commit is contained in:
parent
2ac18d4ae9
commit
fb90cdbe87
@ -31,6 +31,9 @@ import javax.swing.text.*;
|
||||
import java.beans.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import sun.reflect.misc.MethodUtil;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
* Component decorator that implements the view interface
|
||||
* for <object> elements.
|
||||
@ -87,6 +90,7 @@ public class ObjectView extends ComponentView {
|
||||
AttributeSet attr = getElement().getAttributes();
|
||||
String classname = (String) attr.getAttribute(HTML.Attribute.CLASSID);
|
||||
try {
|
||||
ReflectUtil.checkPackageAccess(classname);
|
||||
Class c = Class.forName(classname, true,Thread.currentThread().
|
||||
getContextClassLoader());
|
||||
Object o = c.newInstance();
|
||||
@ -115,28 +119,6 @@ public class ObjectView extends ComponentView {
|
||||
return comp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Class object to use for loading the
|
||||
* classid. If possible, the Classloader
|
||||
* used to load the associated Document is used.
|
||||
* This would typically be the same as the ClassLoader
|
||||
* used to load the EditorKit. If the documents
|
||||
* ClassLoader is null,
|
||||
* <code>Class.forName</code> is used.
|
||||
*/
|
||||
private Class getClass(String classname) throws ClassNotFoundException {
|
||||
Class klass;
|
||||
|
||||
Class docClass = getDocument().getClass();
|
||||
ClassLoader loader = docClass.getClassLoader();
|
||||
if (loader != null) {
|
||||
klass = loader.loadClass(classname);
|
||||
} else {
|
||||
klass = Class.forName(classname);
|
||||
}
|
||||
return klass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize this component according the KEY/VALUEs passed in
|
||||
* via the <param> elements in the corresponding
|
||||
@ -170,7 +152,7 @@ public class ObjectView extends ComponentView {
|
||||
}
|
||||
Object [] args = { value };
|
||||
try {
|
||||
writer.invoke(comp, args);
|
||||
MethodUtil.invoke(writer, comp, args);
|
||||
} catch (Exception ex) {
|
||||
System.err.println("Invocation failed");
|
||||
// invocation code
|
||||
|
Loading…
x
Reference in New Issue
Block a user