Unable to retrieve endpoint for a given service QName
-----------------------------------------------------

                 Key: SMX4-204
                 URL: https://issues.apache.org/activemq/browse/SMX4-204
             Project: ServiceMix 4
          Issue Type: Bug
    Affects Versions: 4.0-m2
            Reporter: Lars Heinemann


I got the following helper function which used to work in older SMX 3 and 4 
versions (latest known of SMX4 is 28th of january?).
Today in the morning I built the latest trunk and the function doesn't work any 
longer.

    /**
     * checks whether the given service is available in the nmr or not
     * 
     * @param context   the component context
     * @param service   the service to check for
     * @return          true if at least one endpoint is available for the 
     *                  given service, otherwise false
     */
    public static final boolean isServiceAvailable(ComponentContext context, 
QName service) {
        ServiceEndpoint[] eps = context.getEndpointsForService(service);
        return (eps != null && eps.length > 0);
     }

I tried to extend this function that in case there is no such service 
registered, I call the method context.getEndpoints(null) to retrieve all 
registered
endpoints (like API Doc says) but it ends up in a NPE which is not JBI 
compliant.

java.lang.NullPointerException
        at 
org.apache.servicemix.nmr.core.EndpointRegistryImpl.internalQuery(EndpointRegistryImpl.java:271)
        at 
org.apache.servicemix.nmr.core.EndpointRegistryImpl.query(EndpointRegistryImpl.java:188)
        at 
org.apache.servicemix.jbi.osgi.RegistryWrapper.query(RegistryWrapper.java:67)
        at 
org.apache.servicemix.jbi.runtime.impl.AbstractComponentContext.internalQueryEndpoints(AbstractComponentContext.java:114)
        at 
org.apache.servicemix.jbi.runtime.impl.AbstractComponentContext.getEndpoints(AbstractComponentContext.java:110)
        at 
org.apache.servicemix.common.EndpointComponentContext.getEndpoints(EndpointComponentContext.java:94)
        at 
net.compart.jbi.shared.CpEsbUtils.isServiceAvailable(CpEsbUtils.java:389)

Any thoughts on that? It must have been broken withing the last few days.


-- 
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