Buggy code:
final class R_OSGiRemoteServiceContainer implements IContainer , IRemoteServiceContainerAdapter , RemoteServiceListener { private BundleContext context ; private RemoteOSGiService remoteService ; private final List containerListeners = new ArrayList ( 0 ) ; R_OSGiID containerID ; private R_OSGiID connectedID ; private ServiceTracker remoteServicesTracker ; private Map remoteServicesRegs = new HashMap ( 0 ) ; private Map remoteServiceListeners = new HashMap ( 0 ) ; private IConnectContext connectContext ; public R_OSGiRemoteServiceContainer ( RemoteOSGiService service , final ID containerID ) throws IDCreateException { } private void startRegTracker ( ) { } public void addRemoteServiceListener ( final IRemoteServiceListener listener ) { } public IRemoteService getRemoteService ( final IRemoteServiceReference reference ) { } public IRemoteServiceReference [ ] getRemoteServiceReferences ( final ID [ ] idFilter , final String clazz , final String filter ) throws InvalidSyntaxException { } public IRemoteServiceReference [ ] getRemoteServiceReferences ( ID targetID , String clazz , String filter ) throws ContainerConnectException , InvalidSyntaxException { } public IRemoteServiceReference [ ] getAllRemoteServiceReferences ( String clazz , String filter ) throws InvalidSyntaxException { } private IRemoteServiceReference createLocalRemoteServiceReference ( ServiceReference ref ) { } private List connectAndGetRemoteServiceReferencesForTarget ( ID currentlyConnectedID , ID targetID , String clazz , IRemoteFilter remoteFilter ) { } private List connectAndGetRemoteServiceReferencesForTarget ( ID targetID , String clazz , IRemoteFilter remoteFilter , boolean doDisconnect ) { } private void logException ( String message , Throwable e ) { } private synchronized List getRemoteServiceReferencesConnected ( final String clazz , IRemoteFilter filter ) { } IRemoteServiceID createRemoteServiceID ( R_OSGiID cID , Long l ) { } IRemoteServiceID createRemoteServiceID ( RemoteServiceReference rref ) { } public IRemoteServiceRegistration registerRemoteService ( final String [ ] clazzes , final Object service , final Dictionary properties ) { if ( ( containerID ) == null ) { throw new IllegalStateException ( "Container<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>connected" ) ; } final Dictionary props = ( properties == null ) ? new Hashtable ( ) : clone ( properties ) ; props . put ( R_OSGi_REGISTRATION , Boolean . TRUE ) ; props . remove ( "osgi.remote.interfaces" ) ; props . put ( SERVICE_CONTAINER_ID , containerID ) ; props . put ( OBJECTCLASS , clazzes ) ; <START_BUG> Integer serviceRanking = ( ( Integer ) ( properties . get ( SERVICE_RANKING ) ) ) ; <END_BUG> serviceRanking = ( serviceRanking == null ) ? new Integer ( 0 ) : serviceRanking ; props . put ( SERVICE_RANKING , serviceRanking ) ; final ServiceRegistration reg = context . registerService ( clazzes , service , props ) ; reg . setProperties ( prepareProperties ( reg . getReference ( ) ) ) ; synchronized ( remoteServicesRegs ) { remoteServicesRegs . put ( reg . getReference ( ) , reg ) ; } return new RemoteServiceRegistrationImpl ( createRemoteServiceID ( containerID , ( ( Long ) ( reg . getReference ( ) . getProperty ( Constants . SERVICE_ID ) ) ) ) , reg ) ; } Dictionary prepareProperties ( ServiceReference reference ) { } public void removeRemoteServiceListener ( final IRemoteServiceListener listener ) { } public boolean ungetRemoteService ( IRemoteServiceReference reference ) { } public Object getAdapter ( final Class adapter ) { } public void addListener ( final IContainerListener listener ) { } public synchronized void connect ( final ID targetID , final IConnectContext cc ) throws ContainerConnectException { } private RemoteServiceReference [ ] doConnect ( R_OSGiID targetID ) throws IOException { } private void doDisconnect ( R_OSGiID targetID ) { } public synchronized void disconnect ( ) { } public void dispose ( ) { } public Namespace getConnectNamespace ( ) { } public synchronized ID getConnectedID ( ) { } public void removeListener ( final IContainerListener listener ) { } public ID getID ( ) { } private void fireListeners ( final IContainerEvent event ) { } public void remoteServiceEvent ( final RemoteServiceEvent event ) { } private void checkImport ( final RemoteServiceReference ref ) { } private Hashtable clone ( final Dictionary props ) { } public IFuture asyncGetRemoteServiceReferences ( final ID [ ] idFilter , final String clazz , final String filter ) { } public IFuture asyncGetRemoteServiceReferences ( final ID target , final String clazz , final String filter ) { } public Namespace getRemoteServiceNamespace ( ) { } public IRemoteFilter createRemoteFilter ( String filter ) throws InvalidSyntaxException { } public IRemoteServiceID getRemoteServiceID ( ID containerId , long containerRelativeId ) { } public IRemoteServiceReference getRemoteServiceReference ( IRemoteServiceID serviceId ) { } public void setConnectContextForAuthentication ( IConnectContext connectContext ) { } }

Fix:
Integer serviceRanking = ( ( Integer ) ( props . get ( SERVICE_RANKING ) ) ) ;