src/share/classes/javax/swing/plaf/synth/SynthParser.java
Print this page
*** 320,330 ****
/**
* If <code>value</code> is an instance of <code>type</code> it is
* returned, otherwise a SAXException is thrown.
*/
! private Object checkCast(Object value, Class type) throws SAXException {
if (!type.isInstance(value)) {
throw new SAXException("Expected type " + type + " got " +
value.getClass());
}
return value;
--- 320,330 ----
/**
* If <code>value</code> is an instance of <code>type</code> it is
* returned, otherwise a SAXException is thrown.
*/
! private Object checkCast(Object value, Class<?> type) throws SAXException {
if (!type.isInstance(value)) {
throw new SAXException("Expected type " + type + " got " +
value.getClass());
}
return value;
*** 332,342 ****
/**
* Returns an object created with id=key. If the object is not of
* type type, this will throw an exception.
*/
! private Object lookup(String key, Class type) throws SAXException {
Object value;
if (_handler != null) {
if (_handler.hasVariable(key)) {
return checkCast(_handler.getVariable(key), type);
}
--- 332,342 ----
/**
* Returns an object created with id=key. If the object is not of
* type type, this will throw an exception.
*/
! private Object lookup(String key, Class<?> type) throws SAXException {
Object value;
if (_handler != null) {
if (_handler.hasVariable(key)) {
return checkCast(_handler.getVariable(key), type);
}
*** 639,649 ****
StringTokenizer tokenizer = new StringTokenizer(
attributes.getValue(i));
while (tokenizer.hasMoreTokens()) {
String typeName = tokenizer.nextToken();
int classIndex = typeName.lastIndexOf('.');
! Class typeClass;
if (classIndex == -1) {
typeClass = ColorType.class;
classIndex = 0;
}
--- 639,649 ----
StringTokenizer tokenizer = new StringTokenizer(
attributes.getValue(i));
while (tokenizer.hasMoreTokens()) {
String typeName = tokenizer.nextToken();
int classIndex = typeName.lastIndexOf('.');
! Class<?> typeClass;
if (classIndex == -1) {
typeClass = ColorType.class;
classIndex = 0;
}
*** 781,797 ****
if (property == ELEMENT_DEFAULTS_PROPERTY) {
_defaultsMap.put(key, value);
}
else if (_stateInfo != null) {
if (_stateInfo.getData() == null) {
! _stateInfo.setData(new HashMap());
}
_stateInfo.getData().put(key, value);
}
else if (_style != null) {
if (_style.getData() == null) {
! _style.setData(new HashMap());
}
_style.getData().put(key, value);
}
}
--- 781,797 ----
if (property == ELEMENT_DEFAULTS_PROPERTY) {
_defaultsMap.put(key, value);
}
else if (_stateInfo != null) {
if (_stateInfo.getData() == null) {
! _stateInfo.setData(new HashMap<>());
}
_stateInfo.getData().put(key, value);
}
else if (_style != null) {
if (_style.getData() == null) {
! _style.setData(new HashMap<>());
}
_style.getData().put(key, value);
}
}