Program: 159691
Project: 159691
Buggy source:
private static ArrayList<CardDownloadData> getNeededCards(List<CardInfo> allCards,String imagesPath){
  ArrayList<CardDownloadData> cardsToDownload=new ArrayList<CardDownloadData>();
  ArrayList<CardDownloadData> allCardsUrls=new ArrayList<CardDownloadData>();
  HashSet<String> ignoreUrls=SettingsManager.getIntance().getIgnoreUrls();
  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(),usesVariousArt(card),0,false,card.isDoubleFaced(),card.isNightCard());
        if (url.getUsesVariousArt()) {
          url.setDownloadName(createDownloadName(card));
        }
        url.setFlipCard(card.isFlipCard());
        url.setSplitCard(card.isSplitCard());
        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(),usesVariousArt(card),0,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");
          log.error("String_Node_Str" + card);
        }
 else         if (card.getSetCode().isEmpty()) {
          System.err.println("String_Node_Str");
          log.error("String_Node_Str" + card);
        }
      }
    }
    allCardsUrls.addAll(getTokenCardUrls());
  }
 catch (  Exception e) {
    log.error(e);
  }
  TFile file;
  for (  CardDownloadData card : allCardsUrls) {
    file=new TFile(CardImageUtils.getImagePath(card,imagesPath));
    if (!file.exists()) {
      cardsToDownload.add(card);
    }
  }
  for (  CardDownloadData card : cardsToDownload) {
    if (card.isToken()) {
      log.info("String_Node_Str" + card.getName() + "String_Node_Str");
    }
 else {
      try {
        log.info("String_Node_Str" + card.getName() + "String_Node_Str"+ card.getSet()+ "String_Node_Str");
      }
 catch (      Exception e) {
        log.error(e);
      }
    }
  }
  return cardsToDownload;
}

Fixed version (ground truth):
private static ArrayList<CardDownloadData> getNeededCards(List<CardInfo> allCards,String imagesPath){
  ArrayList<CardDownloadData> cardsToDownload=new ArrayList<CardDownloadData>();
  ArrayList<CardDownloadData> allCardsUrls=new ArrayList<CardDownloadData>();
  HashSet<String> ignoreUrls=SettingsManager.getIntance().getIgnoreUrls();
  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(),usesVariousArt(card),0,false,card.isDoubleFaced(),card.isNightCard());
        if (url.getUsesVariousArt()) {
          url.setDownloadName(createDownloadName(card));
        }
        url.setFlipCard(card.isFlipCard());
        url.setSplitCard(card.isSplitCard());
        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(),usesVariousArt(card),0,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(),usesVariousArt(card),0,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");
          log.error("String_Node_Str" + card);
        }
 else         if (card.getSetCode().isEmpty()) {
          System.err.println("String_Node_Str");
          log.error("String_Node_Str" + card);
        }
      }
    }
    allCardsUrls.addAll(getTokenCardUrls());
  }
 catch (  Exception e) {
    log.error(e);
  }
  TFile file;
  for (  CardDownloadData card : allCardsUrls) {
    file=new TFile(CardImageUtils.getImagePath(card,imagesPath));
    if (!file.exists()) {
      cardsToDownload.add(card);
    }
  }
  for (  CardDownloadData card : cardsToDownload) {
    if (card.isToken()) {
      log.info("String_Node_Str" + card.getName() + "String_Node_Str");
    }
 else {
      try {
        log.info("String_Node_Str" + card.getName() + "String_Node_Str"+ card.getSet()+ "String_Node_Str");
      }
 catch (      Exception e) {
        log.error(e);
      }
    }
  }
  return cardsToDownload;
}