@Transactional(readOnly = true) public class WebService { public void letsThrowAnException() { throw new XFireRuntimeException("test!"); } }
@Service public class FakeService { @Autowired private EcomService ecomService; @Autowired private WebService webService; @Transactional(noRollbackFor={XFireRuntimeException.class}) public void doSomeTransactionalStuff() { Order order = ecomService.findOrderById(459); try { webService.letsThrowAnException(); } catch (XFireRuntimeException e) { System.err.println("Caugh XFireRuntimeException:" + e.getMessage()); } order.setBookingType(BookingType.CAR_BOOKING); ecomService.persist(order); } }
Throwable cause = xfRt.getCause(); throw new XFireRuntimeException("Exception while calling: " + callTarget.toString(), cause);
protected void nextEvent(XMLStreamReader dr) { try { dr.next(); } catch (XMLStreamException e) { throw new XFireRuntimeException("Couldn't parse stream.", e); } }
throw new XFireFault("Error invoking service" + (e.getMessage() != null ? ": " + e.getMessage() : ".") , e, XFireFault.SENDER);
public static Document createDocument() { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder b = factory.newDocumentBuilder(); return b.newDocument(); } catch (ParserConfigurationException e) { throw new XFireRuntimeException("Couldn't find a DOM parser.", e); } } }
protected Object getFaultBean(Throwable cause, MessagePartInfo faultPart, MessageContext context) { try { Method method = cause.getClass().getMethod("getFaultInfo", new Class[0]); return method.invoke(cause, new Object[0]); } catch (InvocationTargetException e) { throw new XFireRuntimeException("Couldn't invoke getFaultInfo method.", e); } catch (NoSuchMethodException e) { return cause; } catch (Exception e) { throw new XFireRuntimeException("Couldn't access getFaultInfo method.", e); } } }
protected Object getFaultBean(Throwable cause, MessagePartInfo faultPart, MessageContext context) { if (FaultInfoException.class.isAssignableFrom(cause.getClass())) { try { Method method = cause.getClass().getMethod("getFaultInfo", new Class[0]); return method.invoke(cause, new Object[0]); } catch (InvocationTargetException e) { throw new XFireRuntimeException("Couldn't invoke getFaultInfo method.", e); } catch (NoSuchMethodException e) { throw new XFireRuntimeException("Custom faults need a getFaultInfo method.", e); } catch (Exception e) { throw new XFireRuntimeException("Couldn't access getFaultInfo method.", e); } } return cause; }
@Override public void setTypeClass(Class typeClass) { if (!typeClass.isEnum()) { throw new XFireRuntimeException("Type class must be an enum."); } super.setTypeClass(typeClass); }
public WSDLBuilder createWSDLBuilder(Service service, TransportManager transportManager) { try { return new XmlBeansWSDLBuilder(service, transportManager); } catch (WSDLException e) { throw new XFireRuntimeException("error creating wsdlbuilder", e); } } }
private static XFireFactory loadFactory(Class clazz) { try { Method m = clazz.getMethod("createInstance", new Class[0]); return (XFireFactory) m.invoke(null, new Object[0]); } catch (SecurityException e) { throw new XFireRuntimeException("Couldn't load " + clazz.getName(), e); } catch (NoSuchMethodException e) { throw new XFireRuntimeException("Factory doesn't implement createInstance(): " + clazz.getName(), e); } catch (IllegalArgumentException e) { throw new XFireRuntimeException("Factory doesn't implement createInstance(): " + clazz.getName(), e); } catch (IllegalAccessException e) { throw new XFireRuntimeException("Couldn't load " + clazz.getName(), e); } catch (InvocationTargetException e) { throw new XFireRuntimeException("Couldn't load factory " + clazz.getName(), e); } }
public XMLGregorianCalendarType() { try { dtFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new XFireRuntimeException("Couldn't load DatatypeFactory.", e); } setTypeClass(XMLGregorianCalendar.class); }
public static String createContentID(String ns) { String uid = UID.generate(); try { URI uri = new URI(ns); return uid + "@" + uri; } catch (URISyntaxException e) { throw new XFireRuntimeException("Could not create URI for namespace: " + ns); } }
private void ensureSoapAttachmentIsRead() { if (soapMessageRead) return; try { soapMessage = readNextAttachment(); soapMessageRead = true; } catch (IOException e) { throw new XFireRuntimeException("Could not read message!", e); } }
public DurationType() { try { dtFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new XFireRuntimeException("Couldn't load DatatypeFactory.", e); } setTypeClass(Duration.class); }
public WSDLBuilder createWSDLBuilder(Service service, TransportManager transportManager) { try { return new JaxbWSDLBuilder(service, transportManager); } catch (WSDLException e) { throw new XFireRuntimeException("Error creating the WSDLBuilder", e); } } }
public BindingProvider getBindingProvider() { if (bindingProvider == null) { try { bindingProvider = (BindingProvider) ClassLoaderUtils .loadClass("org.codehaus.xfire.aegis.AegisBindingProvider", getClass()).newInstance(); } catch (Exception e) { throw new XFireRuntimeException("Couldn't find a binding provider!", e); } } return bindingProvider; }
/** * @param reader * @return */ public static XMLStreamReader createXMLStreamReader(Reader reader, MessageContext context) { XMLInputFactory factory = getXMLInputFactory(context); try { return factory.createXMLStreamReader(reader); } catch (XMLStreamException e) { throw new XFireRuntimeException("Couldn't parse stream.", e); } }
public BindingProvider getBindingProvider() { if (bindingProvider == null) { try { bindingProvider = (BindingProvider) ClassLoaderUtils .loadClass("org.codehaus.xfire.aegis.AegisBindingProvider", getClass()).newInstance(); } catch (Exception e) { throw new XFireRuntimeException("Couldn't find a binding provider!", e); } } return bindingProvider; }