1/*2 * Copyright 2001-2008 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 *16 */171819package org.uddi.v3_service;
2021import java.lang.reflect.InvocationTargetException;
22import java.lang.reflect.UndeclaredThrowableException;
23import java.rmi.RemoteException;
2425import javax.xml.bind.JAXBException;
26import javax.xml.soap.Detail;
27import javax.xml.ws.WebFault;
28import javax.xml.ws.soap.SOAPFaultException;
2930import org.apache.commons.logging.Log;
31import org.apache.commons.logging.LogFactory;
32import org.uddi.api_v3.DispositionReport;
33import org.uddi.api_v3.ErrInfo;
34import org.uddi.api_v3.Result;
353637/**38 * This class was generated by the JAX-WS RI.39 * JAX-WS RI 2.1.5-b03-40 * Generated source version: 2.141 * 42 */43 @WebFault(name = "dispositionReport", targetNamespace = "urn:uddi-org:api_v3")
44publicclassDispositionReportFaultMessage45extends RemoteException
46 {
47privatestaticfinallong serialVersionUID = -3901821587689888649L;
48privatestatictransient Log log = LogFactory.getLog(DispositionReportFaultMessage.class);
49/**50 * Java type that goes as soapenv:Fault detail element.51 * 52 */53privateDispositionReport faultInfo;
5455/**56 * 57 * @param message58 * @param faultInfo59 */60publicDispositionReportFaultMessage(String message, DispositionReport faultInfo) {
61super(message);
62this.faultInfo = faultInfo;
63 }
6465/**66 * 67 * @param message68 * @param faultInfo69 * @param cause70 */71publicDispositionReportFaultMessage(String message, DispositionReport faultInfo, Throwable cause) {
72super(message, cause);
73this.faultInfo = faultInfo;
74 }
7576/**77 * 78 * @return79 * returns fault bean: org.uddi.api_v3.DispositionReport80 */81publicDispositionReport getFaultInfo() {
82return faultInfo;
83 }
8485/** 86 * Convenience method to figure out if the Exception at hand contains a87 * DispositionReport. Disposition report will be null if none can be found.88 * 89 * @param e the Exception at hang90 * @return DispositionReport if one can be found, or null if it is not.91 */92publicstaticDispositionReport getDispositionReport(Exception e) {
93 DispositionReport report = null;
94if (e instanceof DispositionReportFaultMessage) {
95 DispositionReportFaultMessage faultMsg = (DispositionReportFaultMessage) e;
96 report = faultMsg.getFaultInfo();
97 } elseif (e instanceof SOAPFaultException) {
98 SOAPFaultException soapFault = (SOAPFaultException) e;
99 Detail detail = soapFault.getFault().getDetail();
100if (detail != null && detail.getFirstChild()!=null) {
101try {
102 report = new DispositionReport(detail.getFirstChild());
103 } catch (JAXBException je) {
104 log.error("Could not unmarshall detail to a DispositionReport");
105 }
106 }
107 } elseif (e instanceof UndeclaredThrowableException) {
108 UndeclaredThrowableException ute =(UndeclaredThrowableException) e;
109if (ute.getUndeclaredThrowable()!=null && ute.getUndeclaredThrowable().getCause()!=null110 && ute.getUndeclaredThrowable().getCause().getCause() instanceof DispositionReportFaultMessage) {
111 DispositionReportFaultMessage faultMsg = (DispositionReportFaultMessage) ute.getUndeclaredThrowable().getCause().getCause();
112 report = faultMsg.getFaultInfo();
113 }
114 } elseif (e instanceof InvocationTargetException){
115//https://issues.apache.org/jira/browse/JUDDI-965116 log.error("InvocationTargetException: It's not a known instance of DispositionReport. Target: ",((InvocationTargetException)e).getTargetException());
117 } else{
118 log.error("Unsupported Exception: It's not a known instance of DispositionReport. ",e);
119120 }
121return report;
122 }
123 }