use of javax.xml.bind.JAXBException in project ORCID-Source by ORCID.
the class ValidateV2_1IdentifiersTest method marshall.
/** Marshals to a JAXBSource backed by SAX
*
* @param type
* @param obj
* @return
*/
private Source marshall(Class<?> type, Object obj) {
try {
JAXBContext context = JAXBContext.newInstance(type);
JAXBSource source = new JAXBSource(context, obj);
return source;
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.JAXBException in project ORCID-Source by ORCID.
the class ValidateV2SamplesTest method unmarshall.
private Object unmarshall(Reader reader, Class<?> type, String schemaPath) throws SAXException, URISyntaxException {
try {
JAXBContext context = JAXBContext.newInstance(type);
Unmarshaller unmarshaller = context.createUnmarshaller();
if (schemaPath != null) {
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new File(getClass().getResource(schemaPath).toURI()));
unmarshaller.setSchema(schema);
}
return unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.JAXBException in project ORCID-Source by ORCID.
the class NotificationsTest method unmarshall.
public NotificationPermission unmarshall(Reader reader) {
try {
JAXBContext context = JAXBContext.newInstance(NotificationPermission.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
return (NotificationPermission) unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.JAXBException in project ORCID-Source by ORCID.
the class ValidateV2IdentifiersTest method unmarshall.
private Object unmarshall(Reader reader, Class<?> type) {
try {
JAXBContext context = JAXBContext.newInstance(type);
Unmarshaller unmarshaller = context.createUnmarshaller();
return unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
use of javax.xml.bind.JAXBException in project ORCID-Source by ORCID.
the class NotificationsTest method unmarshall.
public NotificationPermission unmarshall(Reader reader) {
try {
JAXBContext context = JAXBContext.newInstance(NotificationPermission.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
return (NotificationPermission) unmarshaller.unmarshal(reader);
} catch (JAXBException e) {
throw new RuntimeException("Unable to unmarshall orcid message" + e);
}
}
Aggregations