Program: 158126
Project: 158126
Buggy source:
private static List<CardDownloadData> getNeededCards(List<CardInfo> allCards){
  HashSet<String> ignoreUrls=SettingsManager.getIntance().getIgnoreUrls();
  Set<String> type2SetsFilter=new HashSet<>();
  List<String> constructedFormats=ConstructedFormats.getSetsByFormat(ConstructedFormats.STANDARD);
  if (constructedFormats != null && !constructedFormats.isEmpty()) {
    type2SetsFilter.addAll(constructedFormats);
  }
 else {
    logger.warn("String_Node_Str");
  }
  int numberCardImages=allCards.size();
  int numberWithoutTokens=0;
  List<CardDownloadData> allCardsUrls=Collections.synchronizedList(new ArrayList<>());
  try {
    offlineMode=true;
    allCards.parallelStream().forEach(card -> {
      if (!card.getCardNumber().isEmpty() && !"String_Node_Str".equals(card.getCardNumber()) && !card.getSetCode().isEmpty()&& !ignoreUrls.contains(card.getSetCode())) {
        String cardName=card.getName();
        boolean isType2=type2SetsFilter.contains(card.getSetCode());
        CardDownloadData url=new CardDownloadData(cardName,card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str","String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
        if (url.getUsesVariousArt()) {
          url.setDownloadName(createDownloadName(card));
        }
        url.setFlipCard(card.isFlipCard());
        url.setSplitCard(card.isSplitCard());
        url.setType2(isType2);
        allCardsUrls.add(url);
        if (card.isDoubleFaced()) {
          if (card.getSecondSideName() == null || card.getSecondSideName().trim().isEmpty()) {
            throw new IllegalStateException("String_Node_Str");
          }
          url=new CardDownloadData(card.getSecondSideName(),card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str","String_Node_Str",false,card.isDoubleFaced(),true);
          url.setType2(isType2);
          allCardsUrls.add(url);
        }
        if (card.isFlipCard()) {
          if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) {
            throw new IllegalStateException("String_Node_Str");
          }
          CardDownloadData cardDownloadData=new CardDownloadData(card.getFlipCardName(),card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str","String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
          cardDownloadData.setFlipCard(true);
          cardDownloadData.setFlippedSide(true);
          cardDownloadData.setType2(isType2);
          allCardsUrls.add(cardDownloadData);
        }
      }
 else       if (card.getCardNumber().isEmpty() || "String_Node_Str".equals(card.getCardNumber())) {
        System.err.println("String_Node_Str");
        logger.error("String_Node_Str" + card);
      }
 else       if (card.getSetCode().isEmpty()) {
        System.err.println("String_Node_Str");
        logger.error("String_Node_Str" + card);
      }
    }
);
    numberWithoutTokens=allCards.size();
    allCardsUrls.addAll(getTokenCardUrls());
  }
 catch (  Exception e) {
    logger.error(e);
  }
  int numberAllTokenImages=allCardsUrls.size() - numberWithoutTokens;
  List<CardDownloadData> cardsToDownload=Collections.synchronizedList(new ArrayList<>());
  allCardsUrls.parallelStream().forEach(card -> {
    TFile file=new TFile(CardImageUtils.generateImagePath(card));
    if (!file.exists()) {
      logger.debug("String_Node_Str" + file.getAbsolutePath());
      cardsToDownload.add(card);
    }
  }
);
  int tokenImages=0;
  for (  CardDownloadData card : cardsToDownload) {
    logger.debug((card.isToken() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + card.getName()+ "String_Node_Str"+ card.getSet()+ ')');
    if (card.isToken()) {
      tokenImages++;
    }
  }
  logger.info("String_Node_Str" + numberCardImages + "String_Node_Str"+ numberAllTokenImages+ ')');
  logger.info("String_Node_Str" + (cardsToDownload.size() - tokenImages));
  logger.info("String_Node_Str" + tokenImages);
  return new ArrayList<>(cardsToDownload);
}

Fixed version (ground truth):
private static List<CardDownloadData> getNeededCards(List<CardInfo> allCards){
  HashSet<String> ignoreUrls=SettingsManager.getIntance().getIgnoreUrls();
  Set<String> type2SetsFilter=new HashSet<>();
  List<String> constructedFormats=ConstructedFormats.getSetsByFormat(ConstructedFormats.STANDARD);
  if (constructedFormats != null && !constructedFormats.isEmpty()) {
    type2SetsFilter.addAll(constructedFormats);
  }
 else {
    logger.warn("String_Node_Str");
  }
  int numberCardImages=allCards.size();
  int numberWithoutTokens=0;
  List<CardDownloadData> allCardsUrls=Collections.synchronizedList(new ArrayList<>());
  try {
    offlineMode=true;
    allCards.parallelStream().forEach(card -> {
      if (!card.getCardNumber().isEmpty() && !"String_Node_Str".equals(card.getCardNumber()) && !card.getSetCode().isEmpty()&& !ignoreUrls.contains(card.getSetCode())) {
        String cardName=card.getName();
        boolean isType2=type2SetsFilter.contains(card.getSetCode());
        CardDownloadData url=new CardDownloadData(cardName,card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str","String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
        if (url.getUsesVariousArt()) {
          url.setDownloadName(createDownloadName(card));
        }
        url.setFlipCard(card.isFlipCard());
        url.setSplitCard(card.isSplitCard());
        url.setType2(isType2);
        allCardsUrls.add(url);
        if (card.isDoubleFaced()) {
          if (card.getSecondSideName() == null || card.getSecondSideName().trim().isEmpty()) {
            throw new IllegalStateException("String_Node_Str");
          }
          url=new CardDownloadData(card.getSecondSideName(),card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str","String_Node_Str",false,card.isDoubleFaced(),true);
          url.setType2(isType2);
          allCardsUrls.add(url);
        }
        if (card.isFlipCard()) {
          if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) {
            throw new IllegalStateException("String_Node_Str");
          }
          CardDownloadData cardDownloadData=new CardDownloadData(card.getFlipCardName(),card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str","String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
          cardDownloadData.setFlipCard(true);
          cardDownloadData.setFlippedSide(true);
          cardDownloadData.setType2(isType2);
          allCardsUrls.add(cardDownloadData);
        }
      }
 else       if (card.getCardNumber().isEmpty() || "String_Node_Str".equals(card.getCardNumber())) {
        System.err.println("String_Node_Str");
        logger.error("String_Node_Str" + card.getName());
      }
 else       if (card.getSetCode().isEmpty()) {
        System.err.println("String_Node_Str");
        logger.error("String_Node_Str" + card.getName());
      }
    }
);
    numberWithoutTokens=allCards.size();
    allCardsUrls.addAll(getTokenCardUrls());
  }
 catch (  Exception e) {
    logger.error(e);
  }
  int numberAllTokenImages=allCardsUrls.size() - numberWithoutTokens;
  List<CardDownloadData> cardsToDownload=Collections.synchronizedList(new ArrayList<>());
  allCardsUrls.parallelStream().forEach(card -> {
    TFile file=new TFile(CardImageUtils.generateImagePath(card));
    if (!file.exists()) {
      logger.debug("String_Node_Str" + file.getAbsolutePath());
      cardsToDownload.add(card);
    }
  }
);
  int tokenImages=0;
  for (  CardDownloadData card : cardsToDownload) {
    logger.debug((card.isToken() ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + card.getName()+ "String_Node_Str"+ card.getSet()+ ')');
    if (card.isToken()) {
      tokenImages++;
    }
  }
  logger.info("String_Node_Str" + numberCardImages + "String_Node_Str"+ numberAllTokenImages+ ')');
  logger.info("String_Node_Str" + (cardsToDownload.size() - tokenImages));
  logger.info("String_Node_Str" + tokenImages);
  return new ArrayList<>(cardsToDownload);
}