WebFaultOutInterceptor.getFaultMessagePart() might be too draconian and it also 
has private visibility
------------------------------------------------------------------------------------------------------

                 Key: CXF-1003
                 URL: https://issues.apache.org/jira/browse/CXF-1003
             Project: CXF
          Issue Type: Improvement
          Components: JAX-WS Runtime
    Affects Versions: 2.0.1
         Environment: Platform independent.
            Reporter: Zarar Siddiqi


This implementation of this method is a little draconian (at least to me).  It 
forces a match on the localPart and the namespace of MessagePartInfo and the 
fault QName before returning the MessagePartInfo.  In the case of where the 
exception class annotated with @WebFault (default namespace so it "inherits" 
the services) is also the fault bean (i.e.: no getFaultInfo method specified) 
the name of the namespace URI will never match because only mpi's that are NOT 
elements are going to be considered.   And since the fault class is a java 
class, it's corresponding MPI's getTypeQName() will always return the namespace 
corresponding to the package name and NOT the real namespace of the exception 
(which really lies behind getElementQName()).

I propose changing this method so that if no MessagePartInfo is found using the 
current method, we loosen the criteria and return a match based on  the 
elementQName.  This will also require modification of the MessagePartInfo 
class.  

Now the alternate is to make this method public or protected so it can be 
overridden.  But that's not really a solution.

I'm working on a patch but before I upload it I was wondering what the CXF team 
thought of this

Thanks,
Zarar

Here's the method up for review:

private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) {
        for (FaultInfo faultInfo : op.getFaults()) {
                for (MessagePartInfo mpi : faultInfo.getMessageParts()) {
                        String ns = null;
                        if (mpi.isElement()) {
                                ns = mpi.getElementQName().getNamespaceURI();
                        } else {
                                ns = mpi.getTypeQName().getNamespaceURI();
                        }
                        if 
(qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart())
                                        && qname.getNamespaceURI().equals(ns)) {
                                return mpi;
                        }
                }

        }



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

Reply via email to