Buggy code:
public class DownloadMngrComp extends ComponentDefinition { private static final Logger log = LoggerFactory . getLogger ( DownloadMngrComp . class ) ; private Negative < UtilityUpdatePort > utilityUpdate = provides ( UtilityUpdatePort . class ) ; private Negative < DownloadMngrPort > dataPort = provides ( DownloadMngrPort . class ) ; private Positive < Timer > timer = requires ( Timer . class ) ; private Positive < ConnMngrPort > connMngr = requires ( ConnMngrPort . class ) ; private final DownloadMngrConfig config ; private final AtomicInteger playPos ; private final HashMngr hashMngr ; private final FileMngr fileMngr ; private boolean downloading ; private final Map < Integer , BlockMngr > queuedBlocks ; private Set < Integer > pendingPieces ; private List < Integer > nextPieces ; private Set < Integer > pendingHashes ; private List < Integer > nextHashes ; private TimeoutId speedUpTId = null ; private TimeoutId updateSelfTId ; public DownloadMngrComp ( DownloadMngrComp . DownloadMngrInit init ) { } private Handler < Start > handleStart = new Handler < Start > ( ) { @ Override public void handle ( Start event ) { } } ; private Handler < Data . DRequest > handleDataRequest = new Handler < Data . DRequest > ( ) { @ Override public void handle ( Data . DRequest req ) { } } ; private Handler < Ready > handleConnReady = new Handler < Ready > ( ) { @ Override public void handle ( Ready event ) { } } ; private Handler < Download . HashRequest > handleHashRequest = new Handler < Download . HashRequest > ( ) { @ Override public void handle ( Download . HashRequest req ) { } } ; private Handler < Download . HashResponse > handleHashResponse = new Handler < Download . HashResponse > ( ) { @ Override public void handle ( Download . HashResponse resp ) { } } ; private Handler < Download . DataRequest > handleDownloadDataRequest = new Handler < Download . DataRequest > ( ) { @ Override public void handle ( Download . DataRequest req ) { } } ; private Handler < Download . DataResponse > handleDownloadDataResponse = new Handler < Download . DataResponse > ( ) { @ Override public void handle ( Download . DataResponse resp ) { } } ; private void checkCompleteBlocks ( ) { } private Pair < Integer , Integer > pieceIdToBlockNrPieceNr ( int pieceId ) { } private Handler < ScheduledSpeedUp > handleDownloadSpeedUp = new Handler < ScheduledSpeedUp > ( ) { @ Override public void handle ( ScheduledSpeedUp event ) { } } ; private Handler < ScheduledUtilityUpdate > handleUpdateSelf = new Handler < ScheduledUtilityUpdate > ( ) { @ Override public void handle ( ScheduledUtilityUpdate event ) { } } ; private boolean download ( ) { } private boolean getNewPieces ( int currentBlockNr ) { DownloadMngrComp . log . info ( "getting<seq2seq4repair_space>new<seq2seq4repair_space>pieces<seq2seq4repair_space>from<seq2seq4repair_space>block:{}" , currentBlockNr ) ; int filePos = fileMngr . contiguous ( currentBlockNr ) ; int hashPos = hashMngr . contiguous ( 0 ) ; if ( ( filePos + ( 5 * ( config . minHashAhead ) ) ) > ( hashPos + ( pendingHashes . size ( ) ) ) ) { Set < Integer > except = new HashSet < Integer > ( ) ; except . addAll ( pendingHashes ) ; except . addAll ( nextHashes ) ; Set < Integer > newNextHashes = hashMngr . nextHashes ( config . hashesPerMsg , 0 , except ) ; DownloadMngrComp . log . debug ( "hashPos:{}<seq2seq4repair_space>pendingHashes:{}<seq2seq4repair_space>nextHashes:{}<seq2seq4repair_space>newNextHashes:{}" , new Object [ ] { hashPos , pendingHashes , nextHashes , newNextHashes } ) ; nextHashes . addAll ( newNextHashes ) ; if ( ! ( nextHashes . isEmpty ( ) ) ) { return true ; } } Integer nextBlockNr = fileMngr . nextBlock ( currentBlockNr , queuedBlocks . keySet ( ) ) ; if ( nextBlockNr == null ) { DownloadMngrComp . log . debug ( "next<seq2seq4repair_space>block<seq2seq4repair_space>is<seq2seq4repair_space>null,<seq2seq4repair_space>blockNr:{}" , filePos ) ; return false ; } int blockSize = fileMngr . blockSize ( nextBlockNr ) ; BlockMngr blankBlock = StorageMngrFactory . getSimpleBlockMngr ( blockSize , config . pieceSize ) ; queuedBlocks . put ( nextBlockNr , blankBlock ) ; for ( int i = 0 ; i < ( blankBlock . nrPieces ( ) ) ; i ++ ) { int pieceId = ( nextBlockNr * ( config . piecesPerBlock ) ) + i ; nextPieces . add ( pieceId ) ; } <START_BUG> return nextPieces . isEmpty ( ) ; <END_BUG> } private boolean downloadData ( ) { } private boolean downloadHash ( ) { } private void scheduleSpeedUp ( int periodFactor ) { } private void cancelSpeedUp ( ) { } private void scheduleUpdateSelf ( ) { } private void cancelUpdateSelf ( ) { } private void finishDownload ( ) { } public static class DownloadMngrInit extends Init < DownloadMngrComp > { public final DownloadMngrConfig config ; public final HashMngr hashMngr ; public final FileMngr fileMngr ; public final boolean downloader ; public final AtomicInteger playPos ; public DownloadMngrInit ( DownloadMngrConfig config , FileMngr fileMngr , HashMngr hashMngr , boolean downloader , AtomicInteger playPos ) { } } }

Fix:
return ! ( nextPieces . isEmpty ( ) ) ;