提交 908a2038 编写于 作者: E emcmanus

6736293: OpenType checks can be bypassed through finalizer resurrection

Reviewed-by: hawtin
上级 8b4c742c
......@@ -3629,6 +3629,8 @@ public class Window extends Container implements Accessible {
y + h + 2);
// Now make sure the warning window is visible on the screen
GraphicsConfiguration graphicsConfig =
getGraphicsConfiguration_NoClientCode();
Rectangle screenBounds = graphicsConfig.getBounds();
Insets screenInsets =
Toolkit.getDefaultToolkit().getScreenInsets(graphicsConfig);
......
......@@ -690,7 +690,7 @@ public class OpenMBeanAttributeInfoSupport
private static <T> T convertFromString(String s, OpenType<T> openType) {
Class<T> c;
try {
c = cast(Class.forName(openType.getClassName()));
c = cast(Class.forName(openType.safeGetClassName()));
} catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.toString()); // can't happen
}
......@@ -711,7 +711,7 @@ public class OpenMBeanAttributeInfoSupport
} catch (Exception e) {
final String msg =
"Could not convert \"" + s + "\" using method: " + valueOf;
throw new IllegalArgumentException(msg);
throw new IllegalArgumentException(msg, e);
}
}
......@@ -728,7 +728,7 @@ public class OpenMBeanAttributeInfoSupport
} catch (Exception e) {
final String msg =
"Could not convert \"" + s + "\" using constructor: " + con;
throw new IllegalArgumentException(msg);
throw new IllegalArgumentException(msg, e);
}
}
......@@ -757,7 +757,7 @@ public class OpenMBeanAttributeInfoSupport
stringArrayClass =
Class.forName(squareBrackets + "Ljava.lang.String;");
targetArrayClass =
Class.forName(squareBrackets + "L" + baseType.getClassName() +
Class.forName(squareBrackets + "L" + baseType.safeGetClassName() +
";");
} catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.toString()); // can't happen
......
......@@ -304,7 +304,12 @@ public abstract class OpenType<T> implements Serializable {
* @return the class name.
*/
public String getClassName() {
return className;
}
// A version of getClassName() that can only be called from within this
// package and that cannot be overridden.
String safeGetClassName() {
return className;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册