While investigating the cause of MULE-2164 i looked carefully at these implementations, and found a number of issues:
- When MuleEndpointURI's are copied/reconstructed the value of schemaMetaInfo is lost and the value of address gets "mangled" (See MULE-2164)
- EndpointBuilder/AbstractEndpointBuilder should be called EndpointURIBuilder/AbstractEndpointURIBuilder
- AbstractEndpointBuilder has dynamic state and is therefore not thread-safe! (values are set to null manually ready for the next thread (but method is not synchronized ) )
- The MuleEndpoint(URI)Builder exists but does not build EnpointURI's, MuleEndpointURI's are created through a mix of constructors, initialize methods and the MuleEndpointBuilder.
- AbstractEndpointBuilder set's MuleEndpointURI attributes by creating a new MuleEnpointURI instance and then copying values onto existing instance.
- MuleEndpointURI.getSchemeMetaInfo() which is an explicit get for schemeMetaInfo returns a value is there is no schemeMetaInfo
There is also a need to verify the correct implementation (and usage throughout codebase) of getScheme()/getScehemeMetaInfo()/getFullScheme()/getAddress()/getUri()