protected Object replaceObject ( Object obj ) throws IOException { if ( ( obj instanceof Remote ) && ! ( obj instanceof RemoteStub ) ) { Remote remote = ( Remote ) obj ; try { obj = RemoteObject . toStub ( remote ) ; } catch ( IOException ignore ) { // Let the Serialization layer try with the orignal obj } } return obj ; }
Override replaceObject to check for Remote objects that are not RemoteStubs .