try {
@SuppressWarnings("unchecked")
JAXBElement<EndpointReferenceType> notifyTo
= (JAXBElement<EndpointReferenceType>)request.getContent().get(0);
if (!EPRInspectionTool.containsUsableEPR(notifyTo.getValue())) {
throw new NoDeliveryMechanismEstablished();
}
} catch (NullPointerException npe) {
throw new NoDeliveryMechanismEstablished();
} catch (IndexOutOfBoundsException ioobe) {
throw new NoDeliveryMechanismEstablished();
}
ticket.setDelivery(request);
}