Buggy code:
public class DiscoveredServiceTrackerImpl implements DiscoveredServiceTracker { DistributionProviderImpl distributionProvider ; public DiscoveredServiceTrackerImpl ( DistributionProviderImpl dp ) { } Map discoveredRemoteServiceRegistrations = Collections . synchronizedMap ( new HashMap ( ) ) ; List ecfRemoteServiceProperties = Arrays . asList ( new String [ ] { Constants . SERVICE_ID , Constants . OBJECTCLASS , ECFServicePublication . PROP_KEY_ENDPOINT_ID , ECFServicePublication . PROP_KEY_ENDPOINT_INTERFACE_NAME , ECFServicePublication . PROP_KEY_ENDPOINT_LOCATION , ECFServicePublication . PROP_KEY_SERVICE_INTERFACE_NAME , ECFServicePublication . PROP_KEY_SERVICE_INTERFACE_VERSION , ECFServicePublication . PROP_KEY_SERVICE_PROPERTIES } ) ; public void serviceChanged ( DiscoveredServiceNotification notification ) { } private void handleDiscoveredServiceUnavailable ( ServiceEndpointDescription sed ) { } private void handleDiscoveredServiceAvailable ( ServiceEndpointDescription sed ) { } private ECFServiceEndpointDescription getECFserviceEndpointDescription ( ServiceEndpointDescription aServiceEndpointDesc ) { } private void processFutureForRemoteServiceReferences ( final ECFServiceEndpointDescription sed , final IFuture futureRemoteReferences , final ContainerAdapterHelper ch ) { Thread t = new Thread ( new Runnable ( ) { public void run ( ) { try { <START_BUG> IRemoteServiceReference [ ] remoteReferences = ( ( IRemoteServiceReference [ ] ) ( futureRemoteReferences . get ( sed . getFutureTimeout ( ) ) ) ) ; <END_BUG> IStatus futureStatus = futureRemoteReferences . getStatus ( ) ; if ( futureStatus . isOK ( ) ) { trace ( "processFutureForRemoteServiceReferences.run" , ( ( ( "containerHelper=" + ch ) + "remoteReferences=" ) + ( remoteReferences == null ? "null" : Arrays . asList ( remoteReferences ) . toString ( ) ) ) ) ; if ( ( remoteReferences != null ) && ( ( remoteReferences . length ) > 0 ) ) { registerRemoteServiceReferences ( sed , ch , remoteReferences ) ; } else { logError ( "processFutureForRemoteServiceReferences" , ( ( ( ( "getRemoteServiceReferences<seq2seq4repair_space>result<seq2seq4repair_space>is<seq2seq4repair_space>empty.<seq2seq4repair_space>" + "containerHelper=" ) + ch ) + "remoteReferences=" ) + ( remoteReferences == null ? "null" : Arrays . asList ( remoteReferences ) . toString ( ) ) ) , null ) ; } } else { logError ( "processFutureForRemoteServiceReferences" , ( "Future<seq2seq4repair_space>status<seq2seq4repair_space>NOT<seq2seq4repair_space>ok<seq2seq4repair_space>message=" + ( futureStatus . getMessage ( ) ) ) , futureStatus . getException ( ) ) ; } } catch ( InterruptedException e ) { logError ( "processFutureForRemoteServiceReferences" , "Retrieval<seq2seq4repair_space>interrupted" , e ) ; } catch ( OperationCanceledException e ) { logError ( "processFutureForRemoteServiceReferences" , "Retrieval<seq2seq4repair_space>cancelled" , e ) ; } catch ( TimeoutException e ) { logError ( "processFutureForRemoteServiceReferences" , ( "Retrieval<seq2seq4repair_space>timedout<seq2seq4repair_space>after<seq2seq4repair_space>" + ( e . getDuration ( ) ) ) , e ) ; } } } ) ; t . start ( ) ; } private void addProxyServiceRegistration ( ServiceEndpointDescription sed , ContainerAdapterHelper ch , IRemoteServiceReference ref , ServiceRegistration registration ) { } private boolean findProxyServiceRegistration ( ServiceEndpointDescription sed ) { } private ServiceRegistration [ ] removeProxyServiceRegistrations ( ServiceEndpointDescription sed ) { } class RemoteServiceReferenceUnregisteredListener implements IRemoteServiceListener { public void handleServiceEvent ( IRemoteServiceEvent event ) { } } private void unregisterProxyServiceRegistration ( ServiceRegistration reg ) { } private void registerRemoteServiceReferences ( ECFServiceEndpointDescription sed , ContainerAdapterHelper ch , IRemoteServiceReference [ ] remoteReferences ) { } private boolean isRemoteServiceProperty ( String propertyKey ) { } private Dictionary getPropertiesForRemoteService ( ServiceEndpointDescription description , IRemoteServiceContainerAdapter containerAdapter , IRemoteServiceReference remoteReference , IRemoteService remoteService ) { } private ContainerAdapterHelper [ ] findRSCAs ( ID endpointID , ServiceEndpointDescription sedh ) { } private boolean includeRCSAForDescription ( IContainer container , IRemoteServiceContainerAdapter adapter , ID endpointID , ServiceEndpointDescription description ) { } protected void trace ( String methodName , String message ) { } protected void traceException ( String methodName , String message , Throwable t ) { } protected void logError ( String methodName , String message , Throwable t ) { } protected void logError ( String methodName , String message ) { } private void logWarning ( String methodName , String message ) { } }

Fix:
IRemoteServiceReference [ ] remoteReferences = ( ( IRemoteServiceReference [ ] ) ( futureRemoteReferences . get ( sed . getLookupTimeout ( ) ) ) ) ;