SoapTransportFactory extends AbstractTransportFactory which contains a 
protected Bus data member. However, SoapTransportFactory has its own private 
Bus data member and does not make use of the Bus data member inherited from 
AbstractTransportFactory. Why is this? Is this done on purpose or is this an 
oversight?

public class SoapTransportFactory extends AbstractTransportFactory implements 
DestinationFactory,
    WSDLEndpointFactory, ConduitInitiator {    
    private Bus bus;
}

public abstract class AbstractTransportFactory {
    protected Bus bus;
}

In a testcase that I am developing this has led to problems. If I initialize an 
instance of SoapTransportFactory using the cxf-extension-soap.xml 
configuration,  setTransportIDs() is called on the base class 
AbstractTransportFactory which ultimately calls register() which registers the 
transport IDs with the bus:

    public final void register() {
        if (null == bus) {
            return;
        }
        if (this instanceof DestinationFactory) {
            DestinationFactoryManager dfm = 
bus.getExtension(DestinationFactoryManager.class);
            if (null != dfm && getTransportIds() != null) {
                for (String ns : getTransportIds()) {
                    dfm.registerDestinationFactory(ns, 
(DestinationFactory)this);
                }
            }
        }

However, because AbstractTransportFactory has its own Bus instance, which is 
not initialized and therefore null, the transport IDs are never registered with 
the Bus instance that is visible to the SoapTransportFactory. I think this 
issue has been disguised by the fact that usually SoapTransportFactory is not 
initialized without initializing other transport factories which do the right 
thing registering namespaces with the Bus.



Reply via email to