Buggy code:
public class AntTransceiver extends AbstractAntTransceiver { public static final Logger LOGGER = Logger . getLogger ( AntTransceiver . class . getName ( ) ) ; public static final Level LOG_LEVEL = Level . SEVERE ; private static byte MESSAGE_TX_SYNC = ( ( byte ) ( 164 ) ) ; private static final int MAX_MSG_LENGTH = 23 ; private static final int MESSAGE_OFFSET_MSG_LENGTH = 1 ; private UsbInterface _interface ; private boolean running = false ; private ReentrantLock lock = new ReentrantLock ( ) ; private ReentrantLock interfaceLock = new ReentrantLock ( ) ; private boolean readEndpoint = true ; private UsbEndpoint endpointIn ; private UsbEndpoint endpointOut ; private UsbDevice device ; UsbPipe inPipe = null ; private AntTransceiver . UsbReader usbReader ; public AntTransceiver ( int deviceNumber ) { } public AntTransceiver ( AntDeviceId antId , int deviceNumber ) { } AntTransceiver ( ) { } private void doInit ( AntDeviceId antId , int deviceNumber ) { UsbServices usbServices = null ; UsbHub rootHub ; try { usbServices = UsbHostManager . getUsbServices ( ) ; rootHub = usbServices . getRootUsbHub ( ) ; } catch ( SecurityException e ) { throw new AntCommunicationException ( e ) ; } catch ( UsbException e ) { throw new AntCommunicationException ( e ) ; } List < UsbDevice > devices = new ArrayList < UsbDevice > ( ) ; AntDeviceId [ ] deviceSearchList ; if ( antId != null ) { deviceSearchList = new AntDeviceId [ ] { antId } ; } else { deviceSearchList = AntDeviceId . values ( ) ; } for ( AntDeviceId device : deviceSearchList ) { List < UsbDevice > matchingDevices ; DeviceDescriptor usbDescriptor = device . getUsbDescriptor ( ) ; short vendorId = usbDescriptor . getVendorId ( ) ; short deviceId = usbDescriptor . getDeviceId ( ) ; matchingDevices = UsbUtils . getUsbDevicesWithId ( rootHub , vendorId , deviceId ) ; <START_BUG> if ( devices . isEmpty ( ) ) <END_BUG> continue ; devices . addAll ( matchingDevices ) ; } AntTransceiver . LOGGER . finer ( ( "Number<seq2seq4repair_space>of<seq2seq4repair_space>devices:<seq2seq4repair_space>" + ( devices . size ( ) ) ) ) ; if ( ( devices . size ( ) ) < ( deviceNumber + 1 ) ) { throw new AntCommunicationException ( "Device<seq2seq4repair_space>not<seq2seq4repair_space>found" ) ; } UsbDevice device = devices . get ( deviceNumber ) ; this . device = device ; } private void logData ( Level level , byte [ ] data , String tag ) { } public class UsbReader extends Thread { private byte [ ] last ; private static final int BUFFER_SIZE = 64 ; private byte [ ] lookForSync ( byte [ ] data , int len ) { } private byte [ ] skipCurrentSync ( byte [ ] data ) { } void processBuffer ( byte [ ] data , int len ) { } @ Override public void run ( ) { } } private void claimInterface ( UsbInterface _interface , boolean claim ) { } @ Override public boolean start ( ) { } private void killUsbReader ( ) { } @ Override public void stop ( ) { } private void write ( byte [ ] data ) throws IllegalArgumentException , UsbDisconnectedException , UsbException , UsbNotActiveException , UsbNotOpenException { } @ Override public void send ( byte [ ] message ) throws AntCommunicationException { } public byte getChecksum ( byte [ ] nocheck ) { } public byte [ ] addExtras ( byte [ ] nocheck ) { } @ Override public boolean isRunning ( ) { } }

Fix:
if ( matchingDevices . isEmpty ( ) )