6736293: OpenType checks can be bypassed through finalizer resurrection

Reviewed-by: hawtin
This commit is contained in:
Eamonn McManus 2009-05-07 10:44:45 +02:00
parent f6e8569c85
commit ec41d4d0e9
3 changed files with 11 additions and 4 deletions

View file

@ -3629,6 +3629,8 @@ public class Window extends Container implements Accessible {
y + h + 2); y + h + 2);
// Now make sure the warning window is visible on the screen // Now make sure the warning window is visible on the screen
GraphicsConfiguration graphicsConfig =
getGraphicsConfiguration_NoClientCode();
Rectangle screenBounds = graphicsConfig.getBounds(); Rectangle screenBounds = graphicsConfig.getBounds();
Insets screenInsets = Insets screenInsets =
Toolkit.getDefaultToolkit().getScreenInsets(graphicsConfig); Toolkit.getDefaultToolkit().getScreenInsets(graphicsConfig);

View file

@ -690,7 +690,7 @@ public class OpenMBeanAttributeInfoSupport
private static <T> T convertFromString(String s, OpenType<T> openType) { private static <T> T convertFromString(String s, OpenType<T> openType) {
Class<T> c; Class<T> c;
try { try {
c = cast(Class.forName(openType.getClassName())); c = cast(Class.forName(openType.safeGetClassName()));
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.toString()); // can't happen throw new NoClassDefFoundError(e.toString()); // can't happen
} }
@ -711,7 +711,7 @@ public class OpenMBeanAttributeInfoSupport
} catch (Exception e) { } catch (Exception e) {
final String msg = final String msg =
"Could not convert \"" + s + "\" using method: " + valueOf; "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) { } catch (Exception e) {
final String msg = final String msg =
"Could not convert \"" + s + "\" using constructor: " + con; "Could not convert \"" + s + "\" using constructor: " + con;
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg, e);
} }
} }
@ -757,7 +757,7 @@ public class OpenMBeanAttributeInfoSupport
stringArrayClass = stringArrayClass =
Class.forName(squareBrackets + "Ljava.lang.String;"); Class.forName(squareBrackets + "Ljava.lang.String;");
targetArrayClass = targetArrayClass =
Class.forName(squareBrackets + "L" + baseType.getClassName() + Class.forName(squareBrackets + "L" + baseType.safeGetClassName() +
";"); ";");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(e.toString()); // can't happen throw new NoClassDefFoundError(e.toString()); // can't happen

View file

@ -304,7 +304,12 @@ public abstract class OpenType<T> implements Serializable {
* @return the class name. * @return the class name.
*/ */
public String getClassName() { 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; return className;
} }