Program: 158566
Project: 158566
Buggy source:
private static ArrayList<CardDownloadData> getNeededCards(List<CardInfo> allCards){
  ArrayList<CardDownloadData> cardsToDownload=new ArrayList<>();
  ArrayList<CardDownloadData> allCardsUrls=new ArrayList<>();
  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();
  try {
    offlineMode=true;
    for (    CardInfo card : allCards) {
      if (card.getCardNumber() > 0 && !card.getSetCode().isEmpty() && !ignoreUrls.contains(card.getSetCode())) {
        String cardName=card.getName();
        CardDownloadData url=new CardDownloadData(cardName,card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
        if (url.getUsesVariousArt()) {
          url.setDownloadName(createDownloadName(card));
        }
        url.setFlipCard(card.isFlipCard());
        url.setSplitCard(card.isSplitCard());
        if (type2SetsFilter.contains(card.getSetCode())) {
          url.setType2(true);
        }
        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",false,card.isDoubleFaced(),true);
          allCardsUrls.add(url);
        }
        if (card.isFlipCard()) {
          if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) {
            throw new IllegalStateException("String_Node_Str");
          }
          url=new CardDownloadData(card.getFlipCardName(),card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
          url.setFlipCard(true);
          url.setFlippedSide(true);
          allCardsUrls.add(url);
        }
      }
 else {
        if (card.getCardNumber() < 1) {
          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);
        }
      }
    }
    allCardsUrls.addAll(getTokenCardUrls());
  }
 catch (  Exception e) {
    logger.error(e);
  }
  int numberTokenImages=allCardsUrls.size() - numberCardImages;
  TFile file;
  for (  CardDownloadData card : allCardsUrls) {
    file=new TFile(CardImageUtils.generateImagePath(card));
    if (!file.exists()) {
      cardsToDownload.add(card);
    }
  }
  logger.info("String_Node_Str" + numberCardImages + "String_Node_Str"+ numberTokenImages+ "String_Node_Str"+ cardsToDownload.size());
  if (logger.isDebugEnabled()) {
    for (    CardDownloadData card : cardsToDownload) {
      if (card.isToken()) {
        logger.debug("String_Node_Str" + card.getName() + "String_Node_Str");
      }
 else {
        try {
          logger.debug("String_Node_Str" + card.getName() + "String_Node_Str"+ card.getSet()+ "String_Node_Str");
        }
 catch (        Exception e) {
          logger.error(e);
        }
      }
    }
  }
  return cardsToDownload;
}

Fixed version (ground truth):
private static ArrayList<CardDownloadData> getNeededCards(List<CardInfo> allCards){
  ArrayList<CardDownloadData> cardsToDownload=new ArrayList<>();
  ArrayList<CardDownloadData> allCardsUrls=new ArrayList<>();
  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();
  try {
    offlineMode=true;
    for (    CardInfo card : allCards) {
      if (card.getCardNumber() > 0 && !card.getSetCode().isEmpty() && !ignoreUrls.contains(card.getSetCode())) {
        String cardName=card.getName();
        CardDownloadData url=new CardDownloadData(cardName,card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
        if (url.getUsesVariousArt()) {
          url.setDownloadName(createDownloadName(card));
        }
        url.setFlipCard(card.isFlipCard());
        url.setSplitCard(card.isSplitCard());
        if (type2SetsFilter.contains(card.getSetCode())) {
          url.setType2(true);
        }
        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",false,card.isDoubleFaced(),true);
          allCardsUrls.add(url);
        }
        if (card.isFlipCard()) {
          if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) {
            throw new IllegalStateException("String_Node_Str");
          }
          url=new CardDownloadData(card.getFlipCardName(),card.getSetCode(),card.getCardNumber(),card.usesVariousArt(),0,"String_Node_Str",false,card.isDoubleFaced(),card.isNightCard());
          url.setFlipCard(true);
          url.setFlippedSide(true);
          allCardsUrls.add(url);
        }
      }
 else       if (card.getCardNumber() < 1) {
        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);
      }
    }
    allCardsUrls.addAll(getTokenCardUrls());
  }
 catch (  Exception e) {
    logger.error(e);
  }
  int numberTokenImages=allCardsUrls.size() - numberCardImages;
  TFile file;
  for (  CardDownloadData card : allCardsUrls) {
    file=new TFile(CardImageUtils.generateImagePath(card));
    if (!file.exists()) {
      cardsToDownload.add(card);
    }
  }
  logger.info("String_Node_Str" + numberCardImages + "String_Node_Str"+ numberTokenImages+ "String_Node_Str"+ cardsToDownload.size());
  if (logger.isDebugEnabled()) {
    for (    CardDownloadData card : cardsToDownload) {
      if (card.isToken()) {
        logger.debug("String_Node_Str" + card.getName() + "String_Node_Str");
      }
 else {
        try {
          logger.debug("String_Node_Str" + card.getName() + "String_Node_Str"+ card.getSet()+ "String_Node_Str");
        }
 catch (        Exception e) {
          logger.error(e);
        }
      }
    }
  }
  return cardsToDownload;
}