Buggy code:
public IDiscoveryAdvertiser [ ] getDiscoveryAdvertisers ( ) { } private void openLocator ( IDiscoveryLocator locator ) { } private void shutdownLocator ( IDiscoveryLocator locator ) { } void queueEndpointDescription ( EndpointEventListener listener , EndpointDescription endpointDescription , String matchingFilter , int eventType ) { } void queueEndpointDescription ( EndpointListener listener , EndpointDescription endpointDescription , String matchingFilters , boolean discovered ) { } Collection < EndpointDescription > getAllDiscoveredEndpointDescriptions ( ) { } void queueEndpointEvent ( EndpointDescription endpointDescription , int type ) { } String getEndpointEventTypeAsString ( int eventType ) { } void queueEndpointDescription ( EndpointDescription endpointDescription , boolean discovered ) { } private void processInitialLocatorServices ( final IDiscoveryLocator locator , final EndpointDescriptionLocator . LocatorServiceListener locatorListener ) { } void shutdownLocators ( ) { } private class EndpointEventListenerEvent { private EndpointEventListener endpointEventListener ; private EndpointEvent event ; private String matchingFilter ; public EndpointEventListenerEvent ( EndpointEventListener endpointEventListener , EndpointEvent event , String matchingFilter ) { } public EndpointEventListener getEndpointEventListener ( ) { } public EndpointEvent getEndpointEvent ( ) { } public String getMatchingFilter ( ) { } } private class EndpointListenerEvent { private EndpointListener endpointListener ; private EndpointDescription endpointDescription ; private String matchingFilter ; private boolean discovered ; public EndpointListenerEvent ( EndpointListener endpointListener , EndpointDescription endpointDescription , String matchingFilter , boolean discovered ) { } public EndpointListener getEndpointListener ( ) { } public EndpointDescription getEndointDescription ( ) { } public String getMatchingFilter ( ) { } public boolean isDiscovered ( ) { } } private class LocatorTrackerCustomizer implements ServiceTrackerCustomizer { public Object addingService ( ServiceReference reference ) { } public void modifiedService ( ServiceReference reference , Object service ) { } public void removedService ( ServiceReference reference , Object service ) { } } public IServiceInfoFactory getServiceInfoFactory ( ) { } public IDiscoveredEndpointDescriptionFactory getDiscoveredEndpointDescriptionFactory ( ) { } private Object endpointListenerServiceTrackerLock = new Object ( ) ; private Object endpointEventListenerServiceTrackerLock = new Object ( ) ; protected EndpointDescriptionLocator . EndpointListenerHolder [ ] getMatchingEndpointListenerHolders ( final EndpointDescription description ) { } protected EndpointDescriptionLocator . EndpointEventListenerHolder [ ] getMatchingEndpointEventListenerHolders ( final EndpointDescription description , final int type ) { } public class EndpointEventListenerHolder { private EndpointEventListener listener ; private EndpointDescription description ; private String matchingFilter ; private int type ; public EndpointEventListenerHolder ( EndpointEventListener l , EndpointDescription d , String f , int t ) { } public EndpointEventListener getListener ( ) { } public EndpointDescription getDescription ( ) { } public String getMatchingFilter ( ) { } public int getType ( ) { } } public class EndpointListenerHolder { private EndpointListener listener ; private EndpointDescription description ; private String matchingFilter ; public EndpointListenerHolder ( EndpointListener l , EndpointDescription d , String f ) { } public EndpointListener getListener ( ) { } public EndpointDescription getDescription ( ) { } public String getMatchingFilter ( ) { } } public EndpointDescriptionLocator . EndpointEventListenerHolder [ ] getMatchingEndpointEventListenerHolders ( ServiceReference [ ] refs , EndpointDescription description , int type ) { } public EndpointDescriptionLocator . EndpointListenerHolder [ ] getMatchingEndpointListenerHolders ( ServiceReference [ ] refs , EndpointDescription description ) { } private String isMatch ( EndpointDescription description , List < String > filters ) { } private Map getMapFromProperties ( ServiceReference ref ) { } class EndpointDescriptionBundleTrackerCustomizer implements BundleTrackerCustomizer { private static final String REMOTESERVICE_MANIFESTHEADER = "Remote-Service" ; private static final String XML_FILE_PATTERN = "*.xml" ; private Map < Long , Collection < EndpointDescription > > bundleDescriptionMap = Collections . synchronizedMap ( new HashMap < Long , Collection < EndpointDescription > > ( ) ) ; private Object endpointDescriptionReaderTrackerLock = new Object ( ) ; private ServiceTracker endpointDescriptionReaderTracker ; private IEndpointDescriptionReader getEndpointDescriptionReader ( ) { } public Object addingBundle ( Bundle bundle , BundleEvent event ) { } private void handleAddingBundle ( Bundle bundle ) { if ( ( context ) == null ) return ; String remoteServicesHeaderValue = ( ( String ) ( bundle . getHeaders ( ) . get ( EndpointDescriptionLocator . EndpointDescriptionBundleTrackerCustomizer . REMOTESERVICE_MANIFESTHEADER ) ) ) ; if ( remoteServicesHeaderValue != null ) { String [ ] paths = remoteServicesHeaderValue . split ( "," ) ; if ( paths != null ) for ( int i = 0 ; i < ( paths . length ) ; i ++ ) <START_BUG> handleEndpointDescriptionPath ( bundle , paths [ i ] ) ; <END_BUG> } } private void handleEndpointDescriptionPath ( Bundle bundle , String remoteServicesHeaderValue ) { } private EndpointDescription [ ] handleEndpointDescriptionFile ( Bundle bundle , URL fileURL ) { } private void logError ( String method , String message , Throwable t ) { } public void modifiedBundle ( Bundle bundle , BundleEvent event , Object object ) { } public void removedBundle ( Bundle bundle , BundleEvent event , Object object ) { } private void handleRemovedBundle ( Bundle bundle ) { } public void close ( ) { } } class LocatorServiceListener implements IServiceListener { private IDiscoveryLocator locator ; private Map < EndpointDescription , Set < IServiceID > > edServiceIDMap = new HashMap < EndpointDescription , Set < IServiceID > > ( ) ; public LocatorServiceListener ( IDiscoveryLocator locator ) { } private boolean matchServiceID ( IServiceID serviceId ) { } private Set < EndpointDescription > getEndpointDescriptions ( ) { } private EndpointDescription findEDFromServiceID ( IServiceID serviceID ) { } private boolean contains ( EndpointDescription ed ) { } private void updateEDServiceID ( EndpointDescription existing , EndpointDescription update , IServiceID updateServiceID ) { } private void addEDServiceID ( EndpointDescription ed , IServiceID serviceID ) { } private void removeEDServiceID ( EndpointDescription ed , IServiceID serviceID ) { } public void serviceDiscovered ( IServiceEvent anEvent ) { } public void serviceUndiscovered ( IServiceEvent anEvent ) { } void handleService ( IServiceInfo serviceInfo , boolean discovered ) { } EndpointDescription isEndpointDescriptionUpdate ( EndpointDescription endpointDescription , IServiceID updateServiceID ) { } void handleEndpointDescription ( EndpointDescription endpointDescription , boolean discovered ) { } private DiscoveredEndpointDescription getDiscoveredEndpointDescription ( IServiceID serviceId , IServiceInfo serviceInfo , boolean discovered ) { } public synchronized void close ( ) { } public boolean triggerDiscovery ( ) { } } }

Fix:
handleEndpointDescriptionPath ( bundle , paths [ i ] . trim ( ) ) ;