}
// construct the object and add to list
valueList.add(primitiveElementStringConstructor
.newInstance(new Object[] { elemText }));
} catch (Exception e) {
throw new InvalidXMLException(e);
}
} else
// element type does not match
throw new InvalidXMLException(InvalidXMLException.INVALID_ELEMENT_TYPE, new Object[] {
aPropXmlInfo.arrayElementTagName, curElem.getTagName() });
} else {
// array element type is not specified, try defaults
valueList.add(aParser.buildObjectOrPrimitive(curElem, aOptions));
}
}
}
// initialize an appropriate array of the same length as the valueList,
// and copy the values
Class componentType = Object.class;
if (!(aPropClass == Object.class)) {
componentType = aPropClass.getComponentType();
// verify that objects are of appropriate type
Iterator i = valueList.iterator();
while (i.hasNext()) {
Object curObj = i.next();
if (!componentType.isAssignableFrom(curObj.getClass())) {
throw new InvalidXMLException(InvalidXMLException.INVALID_CLASS, new Object[] {
componentType, curObj.getClass() });
}
}
} else {
// attribute class is generic object, so we don't know what type of