Program: 159977
Project: 159977
Buggy source:
public void setCard(final CardView card){
  if (card == null)   return;
  if (isCurrentCard(card))   return;
  currentCard=card;
  ThreadUtils.threadPool.submit(new Runnable(){
    public void run(){
      try {
        if (!card.equals(currentCard))         return;
        String manaCost="String_Node_Str";
        for (        String m : card.getManaCost()) {
          manaCost+=m;
        }
        String castingCost=UI.getDisplayManaCost(manaCost);
        castingCost=ManaSymbols.replaceSymbolsWithHTML(castingCost,ManaSymbols.Type.CARD);
        int symbolCount=0;
        int offset=0;
        while ((offset=castingCost.indexOf("String_Node_Str",offset) + 1) != 0)         symbolCount++;
        List<String> rules=card.getRules();
        List<String> rulings=new ArrayList<String>(rules);
        if (card instanceof PermanentView) {
          if (card.getPairedCard() != null) {
            rulings.add("String_Node_Str");
          }
          List<CounterView> counters=((PermanentView)card).getCounters();
          int count=counters != null ? counters.size() : 0;
          if (count > 0) {
            StringBuilder sb=new StringBuilder();
            int index=0;
            for (            CounterView counter : ((PermanentView)card).getCounters()) {
              if (counter.getCount() > 0) {
                if (index == 0) {
                  sb.append("String_Node_Str");
                }
 else {
                  sb.append("String_Node_Str");
                }
                sb.append(counter.getCount() + "String_Node_Str" + counter.getName()+ "String_Node_Str");
                index++;
              }
            }
            rulings.add(sb.toString());
          }
          int damage=((PermanentView)card).getDamage();
          if (damage > 0) {
            rulings.add("String_Node_Str" + damage + "String_Node_Str");
          }
        }
        int fontSize=11;
        String fontFamily="String_Node_Str";
        final StringBuilder buffer=new StringBuilder(512);
        buffer.append("String_Node_Str");
        buffer.append(fontFamily);
        buffer.append("String_Node_Str");
        buffer.append(fontSize);
        buffer.append("String_Node_Str");
        buffer.append("String_Node_Str");
        buffer.append("String_Node_Str");
        buffer.append(card.getName());
        buffer.append("String_Node_Str");
        buffer.append(symbolCount * 11 + 1);
        buffer.append("String_Node_Str");
        buffer.append(castingCost);
        buffer.append("String_Node_Str");
        buffer.append("String_Node_Str");
        buffer.append(getTypes(card));
        buffer.append("String_Node_Str");
switch (card.getRarity()) {
case RARE:
          buffer.append("String_Node_Str");
        break;
case UNCOMMON:
      buffer.append("String_Node_Str");
    break;
case COMMON:
  buffer.append("String_Node_Str");
break;
case MYTHIC:
buffer.append("String_Node_Str");
break;
}
String rarity=card.getRarity().getCode();
if (card.getExpansionSetCode() != null) {
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(),rarity));
}
buffer.append("String_Node_Str");
String pt="String_Node_Str";
if (CardUtil.isCreature(card)) {
pt=card.getPower() + "String_Node_Str" + card.getToughness();
}
 else if (CardUtil.isPlaneswalker(card)) {
pt=card.getLoyalty().toString();
}
if (pt.length() > 0) {
buffer.append("String_Node_Str");
buffer.append("String_Node_Str");
buffer.append(pt);
buffer.append("String_Node_Str");
buffer.append("String_Node_Str");
}
String legal="String_Node_Str";
if (rulings.size() > 0) {
legal=legal.replaceAll("String_Node_Str","String_Node_Str");
legal=legal.replaceAll("String_Node_Str","String_Node_Str");
legal=legal.replace("String_Node_Str","String_Node_Str");
legal+="String_Node_Str";
for (String ruling : rulings) {
if (ruling != null && !ruling.replace("String_Node_Str","String_Node_Str").trim().isEmpty()) {
legal+="String_Node_Str";
legal+=ruling;
legal+="String_Node_Str";
}
}
}
if (legal.length() > 0) {
legal=legal.replaceAll("String_Node_Str",card.getName());
legal=legal.replaceAll("String_Node_Str",card.getName());
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal,ManaSymbols.Type.CARD));
}
buffer.append("String_Node_Str");
SwingUtilities.invokeLater(new Runnable(){
public void run(){
if (!card.equals(currentCard)) return;
setText(buffer.toString());
setCaretPosition(0);
}
}
);
}
 catch (Exception e) {
e.printStackTrace();
}
}
}
);
}

Fixed version (ground truth):
public void setCard(final CardView card,final Component container){
  if (card == null)   return;
  if (isCurrentCard(card))   return;
  currentCard=card;
  ThreadUtils.threadPool.submit(new Runnable(){
    public void run(){
      try {
        if (!card.equals(currentCard))         return;
        String manaCost="String_Node_Str";
        for (        String m : card.getManaCost()) {
          manaCost+=m;
        }
        String castingCost=UI.getDisplayManaCost(manaCost);
        castingCost=ManaSymbols.replaceSymbolsWithHTML(castingCost,ManaSymbols.Type.CARD);
        int symbolCount=0;
        int offset=0;
        while ((offset=castingCost.indexOf("String_Node_Str",offset) + 1) != 0)         symbolCount++;
        List<String> rules=card.getRules();
        List<String> rulings=new ArrayList<String>(rules);
        if (card instanceof PermanentView) {
          if (card.getPairedCard() != null) {
            rulings.add("String_Node_Str");
          }
          List<CounterView> counters=((PermanentView)card).getCounters();
          int count=counters != null ? counters.size() : 0;
          if (count > 0) {
            StringBuilder sb=new StringBuilder();
            int index=0;
            for (            CounterView counter : ((PermanentView)card).getCounters()) {
              if (counter.getCount() > 0) {
                if (index == 0) {
                  sb.append("String_Node_Str");
                }
 else {
                  sb.append("String_Node_Str");
                }
                sb.append(counter.getCount() + "String_Node_Str" + counter.getName()+ "String_Node_Str");
                index++;
              }
            }
            rulings.add(sb.toString());
          }
          int damage=((PermanentView)card).getDamage();
          if (damage > 0) {
            rulings.add("String_Node_Str" + damage + "String_Node_Str");
          }
        }
        int fontSize=11;
        String fontFamily="String_Node_Str";
        final StringBuilder buffer=new StringBuilder(512);
        buffer.append("String_Node_Str");
        buffer.append(fontFamily);
        buffer.append("String_Node_Str");
        buffer.append(fontSize);
        buffer.append("String_Node_Str");
        buffer.append("String_Node_Str");
        buffer.append("String_Node_Str");
        buffer.append(card.getName());
        buffer.append("String_Node_Str");
        buffer.append(symbolCount * 11 + 1);
        buffer.append("String_Node_Str");
        buffer.append(castingCost);
        buffer.append("String_Node_Str");
        buffer.append("String_Node_Str");
        buffer.append(getTypes(card));
        buffer.append("String_Node_Str");
switch (card.getRarity()) {
case RARE:
          buffer.append("String_Node_Str");
        break;
case UNCOMMON:
      buffer.append("String_Node_Str");
    break;
case COMMON:
  buffer.append("String_Node_Str");
break;
case MYTHIC:
buffer.append("String_Node_Str");
break;
}
String rarity=card.getRarity().getCode();
if (card.getExpansionSetCode() != null) {
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(),rarity));
}
buffer.append("String_Node_Str");
String pt="String_Node_Str";
if (CardUtil.isCreature(card)) {
pt=card.getPower() + "String_Node_Str" + card.getToughness();
}
 else if (CardUtil.isPlaneswalker(card)) {
pt=card.getLoyalty().toString();
}
if (pt.length() > 0) {
buffer.append("String_Node_Str");
buffer.append("String_Node_Str");
buffer.append(pt);
buffer.append("String_Node_Str");
buffer.append("String_Node_Str");
}
String legal="String_Node_Str";
if (rulings.size() > 0) {
legal=legal.replaceAll("String_Node_Str","String_Node_Str");
legal=legal.replaceAll("String_Node_Str","String_Node_Str");
legal=legal.replace("String_Node_Str","String_Node_Str");
legal+="String_Node_Str";
for (String ruling : rulings) {
if (ruling != null && !ruling.replace("String_Node_Str","String_Node_Str").trim().isEmpty()) {
legal+="String_Node_Str";
legal+=ruling;
legal+="String_Node_Str";
}
}
}
if (legal.length() > 0) {
legal=legal.replaceAll("String_Node_Str",card.getName());
legal=legal.replaceAll("String_Node_Str",card.getName());
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal,ManaSymbols.Type.CARD));
}
buffer.append("String_Node_Str");
SwingUtilities.invokeLater(new Runnable(){
public void run(){
if (!card.equals(currentCard)) {
return;
}
resizeTooltipIfNeeded(buffer,container);
setText(buffer.toString());
setCaretPosition(0);
}
}
);
}
 catch (Exception e) {
e.printStackTrace();
}
}
}
);
}