Program: 157681
Project: 157681
Buggy source:
private List<Token> getTokens(int page,String set){
  ArrayList<CardDownloadData> allTokens=getTokenCardUrls();
  ArrayList<Token> tokens=new ArrayList<>();
  for (  CardDownloadData token : allTokens) {
    if (token.getSet().equals(set)) {
      try {
        String className=token.getName();
        className=className.replaceAll("String_Node_Str","String_Node_Str");
        className="String_Node_Str" + className + "String_Node_Str";
        if (token.getTokenClassName() != null && token.getTokenClassName().length() > 0) {
          if (token.getTokenClassName().toLowerCase(Locale.ENGLISH).matches("String_Node_Str")) {
            className=token.getTokenClassName();
            className="String_Node_Str" + className;
          }
 else           if (token.getTokenClassName().toLowerCase(Locale.ENGLISH).matches("String_Node_Str")) {
            continue;
          }
        }
        Class<?> c=Class.forName(className);
        Constructor<?> cons=c.getConstructor();
        Object newToken=cons.newInstance();
        if (newToken != null && newToken instanceof mage.game.permanent.token.Token) {
          ((Token)newToken).setExpansionSetCodeForImage(set);
          ((Token)newToken).setOriginalExpansionSetCode(set);
          ((Token)newToken).setTokenType(token.getType());
          tokens.add((Token)newToken);
        }
      }
 catch (      ClassNotFoundException|NoSuchMethodException|SecurityException|InstantiationException|IllegalAccessException|IllegalArgumentException|InvocationTargetException ex) {
      }
    }
  }
  int start=page * conf.CARDS_PER_PAGE;
  int end=page * conf.CARDS_PER_PAGE + conf.CARDS_PER_PAGE;
  int ttokens=getTotalNumTokens(set);
  int temblems=getTotalNumEmblems(set);
  int tplanes=getTotalNumPlanes(set);
  int numTokensEmblemsPlanes=ttokens + temblems + tplanes;
  if (end > numTokensEmblemsPlanes) {
    end=numTokensEmblemsPlanes;
  }
  if (numTokensEmblemsPlanes > end) {
    pageRight.setVisible(true);
  }
  end=Math.min(end,ttokens);
  if (start < ttokens) {
    return tokens.subList(start,end);
  }
  return null;
}

Fixed version (ground truth):
private List<Token> getTokens(int page,String set){
  ArrayList<CardDownloadData> allTokens=getTokenCardUrls();
  ArrayList<Token> tokens=new ArrayList<>();
  for (  CardDownloadData token : allTokens) {
    if (token.getSet().equals(set)) {
      try {
        String className=token.getName();
        className=className.replaceAll("String_Node_Str","String_Node_Str");
        className="String_Node_Str" + className + "String_Node_Str";
        if (token.getTokenClassName() != null && token.getTokenClassName().length() > 0) {
          if (token.getTokenClassName().toLowerCase(Locale.ENGLISH).matches("String_Node_Str")) {
            className=token.getTokenClassName();
            className="String_Node_Str" + className;
          }
 else           if (token.getTokenClassName().toLowerCase(Locale.ENGLISH).matches("String_Node_Str")) {
            continue;
          }
        }
        Class<?> c=Class.forName(className);
        Constructor<?> cons=c.getConstructor();
        Object newToken=cons.newInstance();
        if (newToken != null && newToken instanceof mage.game.permanent.token.Token) {
          ((Token)newToken).setExpansionSetCodeForImage(set);
          ((Token)newToken).setOriginalExpansionSetCode(set);
          ((Token)newToken).setTokenType(token.getType());
          tokens.add((Token)newToken);
        }
      }
 catch (      ClassNotFoundException|NoSuchMethodException|SecurityException|InstantiationException|IllegalAccessException|IllegalArgumentException|InvocationTargetException ex) {
      }
    }
  }
  int start=page * conf.CARDS_PER_PAGE;
  int end=page * conf.CARDS_PER_PAGE + conf.CARDS_PER_PAGE;
  int ttokens=tokens.size();
  int temblems=getTotalNumEmblems(set);
  int tplanes=getTotalNumPlanes(set);
  int numTokensEmblemsPlanes=ttokens + temblems + tplanes;
  if (end > numTokensEmblemsPlanes) {
    end=numTokensEmblemsPlanes;
  }
  if (numTokensEmblemsPlanes > end) {
    pageRight.setVisible(true);
  }
  end=Math.min(end,ttokens);
  if (start < ttokens) {
    return tokens.subList(start,end);
  }
  return null;
}