axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10219] New: - RemoteException detail field does not contain real exception
Date Tue, 25 Jun 2002 15:24:50 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10219>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10219

RemoteException detail field does not contain real exception

           Summary: RemoteException detail field does not contain real
                    exception
           Product: Axis
           Version: current (nightly)
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: ulbricht@us.ibm.com


When an impl throws a java.lang.IllegalArgumentException, the client
receives a java.rmi.RemoteException.  However, the detail field of the
RemoteException contains null instead of the exception. 

I tested with the 2002-06-24 Axis nightly build.  The test/wsdl/addrNoImplSEI
functional test verifies this functionality, but the test does not allow
the exception generated to reach the *TestCase class.  Therefore, the failure 
is not reported by Junit.

I added the following fixes to my build (lines are marked with ** New **):

org/apache/axis/AxisFault.java

    public AxisFault(QName code, String str,
                     String actor, Element[] details) {
        super (str);
        setFaultCode( code );
        setFaultString( str );
        setFaultActor( actor );
        setFaultDetail( details );
        setExceptionDetail( str );         //** New **
        if (details == null)
            initFromException(this);
    }

    // ** New Method **
    public void setExceptionDetail(String exception) {
        if ((exception != null) && (exception != "")) {
            try {
                Object exceptionCls = ClassUtils.forName(exception).newInstance
();
                detail = (Exception) exceptionCls;
            } catch (Exception e) {
            }
        }
    }


org/apache/axis/message/SOAPFaultBuilder.java

    public void endElement(String namespace, String localName,
                           DeserializationContext context)
            throws SAXException {
        super.endElement(namespace, localName, context);
        
        AxisFault f = null;
        if (faultClassName != null) {
            try {
                Class exClass = ClassUtils.forName(faultClassName);
                if (AxisFault.class.isAssignableFrom(exClass)) {
                    f = (AxisFault) exClass.newInstance();
                    f.setFaultCode(faultCode);
                    f.setFaultString(faultString);
                    f.setFaultActor(faultActor);
                    f.setFaultDetail(faultDetails);
                    f.setExceptionDetail(faultString);   // ** New **
                }
            }
            catch (Exception e) {
                // Don't do anything here, since a problem above means
                // we'll just fall through and use a plain AxisFault.
            }
        }

        if (f == null) {
            f  = new AxisFault(faultCode, 
                               faultString, 
                               faultActor, 
                               faultDetails);
        }
        
        element.setFault(f);
    }


test/wsd/addrNoImplSEI/Main.java

    public static void main (String[] args) throws Exception {
        try {
            Options opts = new Options(args);

            System.err.println ("Using proxy without session maintenance.");
            System.err.println ("(queries without session should say:  
\"ADDRESS NOT FOUND!\")");

            AddressBookNoImplSEIService abs = new 
AddressBookNoImplSEIServiceLocator();
            opts.setDefaultURL( abs.getAddressBookNoImplSEIAddress() );
            URL serviceURL = new URL(opts.getURL());

            AddressBookNoImplSEI ab1 = null;
            if (serviceURL == null) {
                ab1 = abs.getAddressBookNoImplSEI();
            }
            else {
                ab1 = abs.getAddressBookNoImplSEI(serviceURL);
            }
            Object ret = doit (ab1);
            if (ret != null) {
                throw new Exception("non-session test expected null response, 
got "+ret);
            }

            System.err.println ("\n\nUsing proxy with session maintenance.");
            AddressBookNoImplSEI ab2 = null;
            if (serviceURL == null) {
                ab2 = abs.getAddressBookNoImplSEI();
            }
            else {
                ab2 = abs.getAddressBookNoImplSEI(serviceURL);
            }
            ((AddressBookNoImplSEISoapBindingStub) ab2).setMaintainSession 
(true);
            ret = doit (ab2);
            if (ret == null) {
                throw new Exception("session test expected non-null response, 
got "+ret);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            throw e;                            // ** New **
        }
    }

Mime
View raw message