axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Hauser (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2-4414) When instantiating the ExceptionException class, add AxisFault to it (as proper reason chaining)
Date Tue, 30 Jun 2009 08:16:47 GMT
When instantiating the ExceptionException class, add AxisFault to it (as proper reason chaining)
------------------------------------------------------------------------------------------------

                 Key: AXIS2-4414
                 URL: https://issues.apache.org/jira/browse/AXIS2-4414
             Project: Axis 2.0 (Axis2)
          Issue Type: New Feature
          Components: codegen
    Affects Versions: 1.5
         Environment: vista sun-jdk1.5
            Reporter: Ralf Hauser


codegen produces the below piece of code. Unfortunately, valuable information such as server-side
stack-trace is lost with this.

Suggestion:
1) add AxisFault to the generated ExceptionException class
2) if an AxisFault is available add it to the ExceptionException

<<}catch(org.apache.axis2.AxisFault f){

            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                    try{
                        java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
                        java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                        java.lang.Exception ex=
                                (java.lang.Exception) exceptionClass.newInstance();
                        //message class
                        java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
                        java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                        java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
                        java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
                        m.invoke(ex,new java.lang.Object[]{messageObject});
                        
                        if (ex instanceof com.privasphere.qualsig.quovadis.ExceptionException){
                          throw (com.privasphere.qualsig.quovadis.ExceptionException)ex;
                        }
                        ...>>
So the new piece of code would look like

}catch(org.apache.axis2.AxisFault f){

            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                    try{
                        java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
                        java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                        java.lang.Exception ex=
                                (java.lang.Exception) exceptionClass.newInstance();
                        //message class
                        java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
                        java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                        java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
                        java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
                        m.invoke(ex,new java.lang.Object[]{messageObject});
                        
                        if (ex instanceof com.privasphere.qualsig.quovadis.ExceptionException){
                        	ExceptionException ee = (com.privasphere.qualsig.quovadis.ExceptionException)ex;

                        	ee.setAxisFault(f);
                          throw ee;
                        }
                        ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message