Java tutorial
/* * Copyright 2001-2008 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.uddi.v2_service; import java.lang.reflect.UndeclaredThrowableException; import javax.xml.bind.JAXBException; import javax.xml.soap.Detail; import javax.xml.ws.WebFault; import javax.xml.ws.soap.SOAPFaultException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.4-b01 * Generated source version: 2.2 * */ @WebFault(name = "dispositionReport", targetNamespace = "urn:uddi-org:api_v2") public class DispositionReport extends Exception { /** * Java type that goes as soapenv:Fault detail element. * */ private org.uddi.api_v2.DispositionReport faultInfo; private static transient Log log = LogFactory.getLog(DispositionReport.class); /** * * @param message * @param faultInfo */ public DispositionReport(String message, org.uddi.api_v2.DispositionReport faultInfo) { super(message); this.faultInfo = faultInfo; } /** * * @param message * @param faultInfo * @param cause */ public DispositionReport(String message, org.uddi.api_v2.DispositionReport faultInfo, Throwable cause) { super(message, cause); this.faultInfo = faultInfo; } /** * * @return * returns fault bean: org.uddi.api_v2.DispositionReport */ public org.uddi.api_v2.DispositionReport getFaultInfo() { return faultInfo; } /** * Convenience method to figure out if the Exception at hand contains a * DispositionReport. Disposition report will be null if none can be found. * * @param e the Exception at hang * @return DispositionReport if one can be found, or null if it is not. */ public static org.uddi.api_v2.DispositionReport getDispositionReport(Exception e) { org.uddi.api_v2.DispositionReport report = null; if (e instanceof DispositionReport) { DispositionReport faultMsg = (DispositionReport) e; report = faultMsg.faultInfo; } else if (e instanceof SOAPFaultException) { SOAPFaultException soapFault = (SOAPFaultException) e; Detail detail = soapFault.getFault().getDetail(); if (detail != null && detail.getFirstChild() != null) { try { report = new org.uddi.api_v2.DispositionReport(detail.getFirstChild()); } catch (JAXBException je) { log.error("Could not unmarshall detail to a DispositionReport"); } } } else if (e instanceof UndeclaredThrowableException) { UndeclaredThrowableException ute = (UndeclaredThrowableException) e; if (ute.getUndeclaredThrowable() != null && ute.getUndeclaredThrowable().getCause() != null && ute.getUndeclaredThrowable().getCause().getCause() instanceof DispositionReport) { DispositionReport faultMsg = (DispositionReport) ute.getUndeclaredThrowable().getCause().getCause(); report = faultMsg.getFaultInfo(); } } else { log.error("Unsupported Exception: " + e.getClass()); } return report; } }