Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Non compliant SOAPFault.createFault(String, String) implementation #23

Open
glassfishrobot opened this issue May 21, 2007 · 5 comments
Open

Comments

@glassfishrobot
Copy link
Contributor

When I try to create a SOAPFault using the constructor on SOAPFactory:

soapFactory.createFault(reasonText, null);

it throws exception as:

java.lang.IllegalArgumentException: faultCode argument for createFault was
passed NULL
com.sun.xml.messaging.saaj.soap.ver1_2.SOAPFactory1_2Impl.createFault(SOAPFactory1_2Impl.java:56)

This is not as per the javadoc. the implementation could easily interpret the
null fault code with the whatever default SOAP spec defines. Here is what the
javadoc of the API say:

/**
*Creates a new SOAPFault object initialized with the given
reasonText

  • and faultCode
    *@param reasonText the ReasonText/FaultString for the fault
    *@param faultCode the FaultCode for the fault
    *@return a SOAPFault object
    *@throws SOAPException if there is a SOAP error
    *@SInCE SAAJ 1.3
    */
    public abstract SOAPFault createFault(String reasonText, QName faultCode)
    throws SOAPException;

Its a clear violation of the SAAJ API. I would think createFault(null, null)
should not be throwing exception as the API is silent about it and user can
always set some value using setter methods.

There is workaround to use the SOAPFactory.createFault(). since it is API
compliance issue, it needs to be fixed.

Environment

Operating System: All
Platform: All

Affected Versions

[current]

@glassfishrobot
Copy link
Contributor Author

Reported by vivekp

@glassfishrobot
Copy link
Contributor Author

Was assigned to saaj-issues

@glassfishrobot
Copy link
Contributor Author

@vbkumarjayanti said:
Here is what the Javadoc of SAAJ 1.3 says :

abstract SOAPFault createFault()
Creates a new default SOAPFault object

abstract SOAPFault createFault(java.lang.String reasonText,
javax.xml.namespace.QName faultCode)
Creates a new SOAPFault object initialized with the given reasonText
and faultCode

The 2nd createFault needs to use the given reasonText and faultCode. So i do
not think this a Spec NonCompliance.

The 2nd method should only be used when someone has a valid reasonText and
faultCode. In all other cases one can use the first method to create a default
Fault object.

I admit that more clarity is required in the Javadoc w.r.t the behavior when
arguments are null. I can plan on updating the Javadocs for the next release of
GlassFish.

@glassfishrobot
Copy link
Contributor Author

@vbkumarjayanti said:
Re-Opening as a Task for Tracking purposes. The javadoc needs to clarify the
behavior for Null arguments.

@glassfishrobot
Copy link
Contributor Author

This issue was imported from java.net JIRA SAAJ-23

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant