# HG changeset patch # User malenkov # Date 1373994714 -14400 # Node ID 804df741235215420142e8a6a93e6fc45474a543 # Parent 7b5054561658f2a4c4cfed166884ce365527a4cc 8019617: Better view of objects Reviewed-by: art, skoivu diff -r 7b5054561658 -r 804df7412352 jdk/src/share/classes/javax/swing/text/html/ObjectView.java --- a/jdk/src/share/classes/javax/swing/text/html/ObjectView.java Tue Jul 16 12:23:54 2013 +0100 +++ b/jdk/src/share/classes/javax/swing/text/html/ObjectView.java Tue Jul 16 21:11:54 2013 +0400 @@ -31,6 +31,9 @@ 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 @@ 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(); @@ -116,28 +120,6 @@ } /** - * 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, - * Class.forName 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 * <object> element. @@ -170,7 +152,7 @@ } Object [] args = { value }; try { - writer.invoke(comp, args); + MethodUtil.invoke(writer, comp, args); } catch (Exception ex) { System.err.println("Invocation failed"); // invocation code