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 22160] New: - Exception hierarchies get lost using java2wsdl
Date Wed, 06 Aug 2003 06:59:15 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=22160>.
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=22160

Exception hierarchies get lost using java2wsdl

           Summary: Exception hierarchies get lost using java2wsdl
           Product: Axis
           Version: 1.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: WSDL processing
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: joern.gebhardt@ptv.de


When a WSDL is created out of a Java class the exception hierarchies get lost.

SCENARIO:

- There exist two Exceptions A and B. A extends java.lang.Exception and B 
extends A. 
- A class MyClass has a method myMethod() that throws A and B:

  public void myMethod() throws A, B {
     ...
  } 

OUTCOME: 
- The WSDL contains only Exception A and not B, i.e. there doesn't exists a B 
message and the operation doesn't contain the fault B.

BUG FIX SUGGESTION: 

Modify the method ServiceDesc.createFaultMetadata(...) from: 

   FaultDesc fault = operation.getFaultByClass(ex); 
   // If we didn't find one, create a new one 
   if (fault == null) { 
       fault = new FaultDesc(); 
   } 

to: 

   FaultDesc fault = operation.getFaultByClass(ex); 
   // If we didn't find one, create a new one 
   if (fault == null || !ex.getName().equals(fault.getClassName())) { 
       fault = new FaultDesc(); 
   } 

Reason: 
The method 'operation.getFaultByClass(ex)' returns the superclass of an 
exception if the superclass is already known.

SIDE EFFECT OF THIS FIX:
The auto-generated JUnit test classes when using wsdl2java might not compile 
any longer, because it might happen that exception A is caught before B and 
therefore the 'catch (B e2)' block is unreachable:

  try {
     ws.myMethod();
  catch (A e1) {
     ...
  } catch (B e2) {
     ...
  }

Mime
View raw message