output: #fixed code
                               public void run() {
  		if( thread == null )
  			thread = Thread.currentThread();
  		interruptableRun();
  		
  		assert ( !channel.isOpen() );
  
  		try {
  			if( selector != null ) // if the initialization in <code>tryToConnect</code> fails, it could be null
  				selector.close();
  		} catch ( IOException e ) {
  			onError( e );
  		}
  
  	}
input: #vulnerable code 
                               public void run() {
  		if( thread == null )
  			thread = Thread.currentThread();
  		interruptableRun();
  
  		try {
  			if( selector != null ) // if the initialization in <code>tryToConnect</code> fails, it could be null
  				selector.close();
  		} catch ( IOException e ) {
  			onError( e );
  		}
  		closelock.lock();
  		selector = null;
  		closelock.unlock();
  		try {
  			channel.close();
  		} catch ( IOException e ) {
  			onError( e );
  		}
  		channel = null;
  		thread = null;
  	} 
                              #location 21 
                              #vulnerability type THREAD_SAFETY_VIOLATION