else if (elementClass.isAnnotationPresent(XmlType.class)) {
result.add(unmarshaller.unmarshal(streamReader, elementClass).getValue());
}
else {
// should not happen, since we check in canRead(Type)
throw new HttpMessageConversionException("Could not unmarshal to [" + elementClass + "]");
}
event = moveToNextElement(streamReader);
}
return result;
}
catch (UnmarshalException ex) {
throw new HttpMessageNotReadableException("Could not unmarshal to [" + elementClass + "]: " + ex.getMessage(), ex);
}
catch (JAXBException ex) {
throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
}
catch (XMLStreamException ex) {
throw new HttpMessageConversionException(ex.getMessage(), ex);
}
}