axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From R J Scheuerle Jr <sc...@us.ibm.com>
Subject Re: Bad Import? (Re: svn commit: r475935 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: ExceptionFactory.java core/controller/AxisInvocationController.java)
Date Sat, 18 Nov 2006 17:10:47 GMT





Dims,

I am fixing this now.  Thanks for catch this.

Rich Scheuerle
IBM Web Services
Apache Axis2 (scheu@apache.org)
512-838-5115  (IBM TL 678-5115)


                                                                           
             "Davanum                                                      
             Srinivas"                                                     
             <davanum@gmail.co                                          To 
             m>                        "scheu@apache.org"                  
                                       <scheu@apache.org>                  
             11/18/2006 07:34                                           cc 
             AM                        "Axis developer list"               
                                       <axis-dev@ws.apache.org>            
                                                                   Subject 
             Please respond to         Bad Import? (Re: svn commit:        
             axis-dev@ws.apach         r475935 - in                        
                   e.org               /webservices/axis2/trunk/java/modul 
                                       es/jaxws/src/org/apache/axis2/jaxws 
                                       : ExceptionFactory.java             
                                       core/controller/AxisInvocationContr 
                                       oller.java)                         
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Rich,

Can u please be careful?

import com.ibm.jvm.util.ByteArrayOutputStream;

thanks,
dims

On 11/16/06, scheu@apache.org <scheu@apache.org> wrote:
> Author: scheu
> Date: Thu Nov 16 13:44:39 2006
> New Revision: 475935
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=475935
> Log:
> AXIS2-1712
> Contributor: Mike Rheinheimer
> Added support for handling local Throwable (vs. Exception).  Added smart
processing to exception factory to generate a better message.
>
> Modified:
>
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ExceptionFactory.java

>
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java

>
> Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ExceptionFactory.java

> URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ExceptionFactory.java?view=diff&rev=475935&r1=475934&r2=475935

>
==============================================================================

> ---
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ExceptionFactory.java
 (original)
> +++
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ExceptionFactory.java
 Thu Nov 16 13:44:39 2006
> @@ -17,12 +17,11 @@
>
>  package org.apache.axis2.jaxws;
>
> +import java.io.PrintStream;
>  import java.lang.reflect.InvocationTargetException;
>
>  import javax.xml.ws.ProtocolException;
>  import javax.xml.ws.WebServiceException;
> -import javax.xml.ws.http.HTTPException;
> -import javax.xml.ws.soap.SOAPFaultException;
>
>  import org.apache.axis2.AxisFault;
>  import org.apache.axis2.jaxws.i18n.Messages;
> @@ -31,6 +30,8 @@
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>
> +import com.ibm.jvm.util.ByteArrayOutputStream;
> +
>  /**
>    * ExceptionFactory is used to create exceptions within the JAX-WS
implementation.
>    * There are several reasons for using a factory to create exceptions.
> @@ -216,6 +217,15 @@
>                 }
>                 rootCause = rootCause==null ? t :rootCause;
>                 WebServiceException e = null;
> +
> +        String enhancedMessage = enhanceMessage(rootCause);
> +        if (enhancedMessage != null) {
> +            if (message != null)
> +                message.concat(": " + enhancedMessage);
> +            else
> +                message = enhancedMessage;
> +        }
> +
>          if (message != null) {
>                 e =new WebServiceException(message, rootCause);
>          } else {
> @@ -368,6 +378,30 @@
>                 }
>         }
>         return t;
> +    }
> +
> +    /**
> +     * Other developers may add additional criteria to give better
> +     * error messages back to the user.
> +     *
> +     * @param t Throwable
> +     * @return String a message that helps the user understand what
caused the exception
> +     */
> +    private static String enhanceMessage(Throwable t) {
> +        if (t == null)
> +            return null;
> +
> +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
> +        PrintStream ps = new PrintStream(baos, true);
> +        t.printStackTrace(ps);
> +        String stackTrace = baos.toString();
> +
> +        // TODO better criteria
> +        if ((t instanceof StackOverflowError) &&
(stackTrace.contains("JAXB")))
> +            // TODO better message
> +            return "The system threw a StackOverflowError at the JAXB
level.  This usually means there is a circular type reference in the
WSDL.";
> +
> +        return null;
>      }
>
>  }
>
> Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java

> URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?view=diff&rev=475935&r1=475934&r2=475935

>
==============================================================================

> ---
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
 (original)
> +++
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
 Thu Nov 16 13:44:39 2006
> @@ -601,10 +601,11 @@
>
>              // Invoke the OperationClient
>              opClient.execute(block);
> -        } catch (Exception e) {
> -            // Catch all exceptions (including runtime exceptions) and
> +        } catch (Throwable e) {
> +            // Catch all Throwable (including runtime exceptions and
Errors) and
>              // throw as AxisFault.
> -            throw AxisFault.makeFault(e);
> +            // Since e could be a Throwable (or Error) instead of an
Exception, we'll have to wrap it:
> +            throw
AxisFault.makeFault(ExceptionFactory.makeWebServiceException(e));
>          } finally {
>              // Post-Execute logging and setup
>              postExecute(opClient, block, msgContext);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>


--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

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


Mime
View raw message