You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2007/01/20 04:25:45 UTC

svn commit: r498056 [3/3] - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/binding/ jaxws/src/org/apache/axis2/jaxws/client/ jaxws/src/org/apache/axis2/jaxws/client/async/ jaxws/src/org/apache/axis2/jaxws/client/proxy/ jaxws...

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java?view=diff&rev=498056&r1=498055&r2=498056
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java Fri Jan 19 19:25:43 2007
@@ -26,8 +26,6 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.message.MessageException;
-import org.apache.axis2.jaxws.message.MessageInternalException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -118,56 +116,6 @@
 	}
 	
 	/**
-	 * Create a MessageException using the information from a Throwable and message
-	 * @param message
-	 * @param throwable
-	 * @return MessageException
-	 */
-	public static MessageException makeMessageException(String message, Throwable throwable) {
-		try {
-			// See if there is already a MessgeException 
-			MessageException e = (MessageException) findException(throwable, MessageException.class);
-			if (e == null) {
-				e = createMessageException(message, throwable);
-			}
-			return e;
-		} catch (RuntimeException re) {
-			// TODO 
-			// This is not a good situation, an exception occurred while building the exception.
-			// This should never occur!  For now log the problem and rethrow...we may revisit this later
-			if (log.isDebugEnabled()) {
-				log.debug(Messages.getMessage("exceptionDuringExceptionFlow"), re);
-			}
-			throw re;
-		}
-	}
-	
-	/**
-	 * Create a MessageInternalException using the information from a Throwable and message
-	 * @param message
-	 * @param throwable
-	 * @return MessageInternalException
-	 */
-	public static MessageInternalException makeMessageInternalException(String message, Throwable throwable) {
-		try {
-			// See if there is already a HTTPException 
-			MessageInternalException e = (MessageInternalException) findException(throwable, MessageInternalException.class);
-			if (e == null) {
-				e = createMessageInternalException(message, throwable);
-			}
-			return e;
-		} catch (RuntimeException re) {
-			// TODO 
-			// This is not a good situation, an exception occurred while building the exception.
-			// This should never occur!  For now log the problem and rethrow...we may revisit this later
-			if (log.isDebugEnabled()) {
-				log.debug(Messages.getMessage("exceptionDuringExceptionFlow"), re);
-			}
-			throw re;
-		}
-	}
-	
-	/**
 	 * Make a WebServiceException with a given message
 	 * @param message
 	 * @return WebServiceException
@@ -184,24 +132,7 @@
 	public static WebServiceException makeWebServiceException(Throwable throwable){
 		return makeWebServiceException(null, throwable);
 	}
-	
-	/**
-	 * Create a MessageException using the information from a given Throwable instance
-	 * @param throwable
-	 * @return MessageException
-	 */
-	public static MessageException makeMessageException(Throwable throwable){
-		return makeMessageException(null, throwable);
-	}
-	
-	/**
-	 * Make a MessageException with a given message
-	 * @param message
-	 * @return MessageException
-	 */
-	public static MessageException makeMessageException(String message) {
-		return makeMessageException(message, null);  
-	}
+
 	
 	/**
 	 * Create a WebServiceException
@@ -211,8 +142,8 @@
 	 */
 	private static WebServiceException createWebServiceException(String message, Throwable t) {
         
-        // We might have an embedded MessageException that has a good message on it
-        MessageException me = (MessageException) findException(t, MessageException.class);
+        // We might have an embedded WebServiceException that has a good message on it
+        WebServiceException me = (WebServiceException) findException(t, WebServiceException.class);
         if (me != null) {
             String meMessage = me.getMessage();
             if (meMessage != null) {
@@ -278,57 +209,6 @@
 		return e;
 	}
 	
-	/**
-	 * Create a MessageException
-	 * @param message
-	 * @param t Throwable
-	 * @return MessageException
-	 */
-	private static MessageException createMessageException(String message, Throwable t) {
-		Throwable rootCause = null;
-		if (t != null) {
-			rootCause = getRootCause(t);
-		}
-		rootCause = rootCause==null ? t :rootCause;
-		
-		MessageException e = null;
-		if (message != null) {
-			e = new MessageException(message, rootCause);
-		} else {
-			e = new MessageException(rootCause);
-		}
-		if (log.isDebugEnabled()) {
-			log.debug("create Exception:", e);
-		}
-		return e;
-	}
-	
-	/**
-	 * Create a MessageInternalException
-	 * @param message
-	 * @param t Throwable
-	 * @return MessageException
-	 */
-	private static MessageInternalException createMessageInternalException(String message, Throwable t) {
-        
-		Throwable rootCause = null;
-		if (t != null) {
-			rootCause = getRootCause(t);
-		}
-		rootCause = rootCause==null ? t :rootCause;
-		
-		MessageInternalException e = null;
-		if (message != null) {
-			e = new MessageInternalException(message, rootCause);
-		} else {
-			e = new MessageInternalException(rootCause);
-		}
-		if (log.isDebugEnabled()) {
-			log.debug("create Exception:", e);
-		}
-		return e;
-	}
-	
     /**
      * Return the exception or nested cause that is assignable from the specified class
      * @param t Throwable
@@ -380,8 +260,6 @@
     	while (t != null) {
     		Throwable nextCause = null;
     		if (t instanceof InvocationTargetException ||
-    		    t instanceof MessageException ||
-    		    t instanceof MessageInternalException ||
     		    t instanceof AxisFault) {
     			// Skip over this cause
     			nextCause = getCause(t);

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/SAAJFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/SAAJFactory.java?view=diff&rev=498056&r1=498055&r2=498056
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/SAAJFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/util/SAAJFactory.java Fri Jan 19 19:25:43 2007
@@ -22,10 +22,10 @@
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFactory;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.message.MessageException;
 
 /**
  * Provides convenience methods to construct a SOAP 1.1 or SOAP 1.2 SAAJ MessageFactory or SOAPFactory.
@@ -47,14 +47,14 @@
      * @param namespace
      * @return
      */
-    public static SOAPFactory createSOAPFactory(String namespace) throws MessageException, SOAPException {
+    public static SOAPFactory createSOAPFactory(String namespace) throws WebServiceException, SOAPException {
         Method m = getSOAPFactoryNewInstanceProtocolMethod();
         SOAPFactory sf = null;
         if (m == null) {
             if (namespace.equals(SOAP11_ENV_NS)) {
                 sf = SOAPFactory.newInstance();
             } else {
-                throw ExceptionFactory.makeMessageException(Messages.getMessage("SOAP12WithSAAJ12Err"));
+                throw ExceptionFactory.makeWebServiceException(Messages.getMessage("SOAP12WithSAAJ12Err"));
             }
         } else {
             String protocol = DYNAMIC_PROTOCOL;
@@ -66,7 +66,7 @@
             try {
                 sf = (SOAPFactory) m.invoke(null, new Object[] {protocol});
             } catch (Exception e) {
-                throw ExceptionFactory.makeMessageException(e);
+                throw ExceptionFactory.makeWebServiceException(e);
             }
         }
         return sf;
@@ -77,14 +77,14 @@
      * @param namespace
      * @return
      */
-    public static MessageFactory createMessageFactory(String namespace) throws MessageException, SOAPException {
+    public static MessageFactory createMessageFactory(String namespace) throws WebServiceException, SOAPException {
         Method m = getMessageFactoryNewInstanceProtocolMethod();
         MessageFactory mf = null;
         if (m == null) {
             if (namespace.equals(SOAP11_ENV_NS)) {
                 mf = MessageFactory.newInstance();
             } else {
-                throw ExceptionFactory.makeMessageException(Messages.getMessage("SOAP12WithSAAJ12Err"));
+                throw ExceptionFactory.makeWebServiceException(Messages.getMessage("SOAP12WithSAAJ12Err"));
             }
         } else {
             String protocol = DYNAMIC_PROTOCOL;
@@ -96,7 +96,7 @@
             try {
                 mf = (MessageFactory) m.invoke(null, new Object[] {protocol});
             } catch (Exception e) {
-                throw ExceptionFactory.makeMessageException(e);
+                throw ExceptionFactory.makeWebServiceException(e);
             }
         }
         return mf;



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org