Program: 15538
Project: 15538
Buggy source:
private static String FTLStringLiteralEnc(String s,char quotation,boolean addQuotation){
  final int ln=s.length();
  final int escLn=ESCAPES.length;
  final char otherQuotation;
  if (quotation == 0) {
    otherQuotation=0;
  }
 else   if (quotation == '"') {
    otherQuotation='\'';
  }
 else   if (quotation == '\'') {
    otherQuotation='"';
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + quotation);
  }
  StringBuffer buf=null;
  for (int i=0; i < ln; i++) {
    char c=s.charAt(i);
    if (c < escLn) {
      char escape=ESCAPES[c];
      if (escape == otherQuotation) {
        escape=0;
      }
switch (escape) {
case 0:
{
          if (buf != null) {
            buf.append(c);
          }
          break;
        }
case 1:
{
        if (buf == null) {
          buf=new StringBuffer(s.length() + 3 + (addQuotation ? 2 : 0));
          if (addQuotation) {
            buf.append(quotation);
          }
          buf.append(s.substring(0,i));
        }
        buf.append("String_Node_Str");
        int c2=(c >> 4) & 0x0F;
        c=(char)(c & 0x0F);
        buf.append((char)(c2 < 10 ? c2 + '0' : c2 - 10 + 'A'));
        buf.append((char)(c < 10 ? c + '0' : c - 10 + 'A'));
        break;
      }
default :
{
      if (buf == null) {
        buf=new StringBuffer(s.length() + 2 + (addQuotation ? 2 : 0));
        if (addQuotation) {
          buf.append(quotation);
        }
        buf.append(s.substring(0,i));
      }
      buf.append('\\');
      buf.append(escape);
    }
}
}
 else {
if (buf != null) {
  buf.append(c);
}
}
}
if (buf == null) {
return addQuotation ? quotation + s + quotation : s;
}
 else {
if (addQuotation) {
buf.append(quotation);
}
return buf.toString();
}
}

Fixed version (ground truth):
private static String FTLStringLiteralEnc(String s,char quotation,boolean addQuotation){
  final int ln=s.length();
  final char otherQuotation;
  if (quotation == 0) {
    otherQuotation=0;
  }
 else   if (quotation == '"') {
    otherQuotation='\'';
  }
 else   if (quotation == '\'') {
    otherQuotation='"';
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + quotation);
  }
  final int escLn=ESCAPES.length;
  StringBuffer buf=null;
  for (int i=0; i < ln; i++) {
    char c=s.charAt(i);
    char escape=c < escLn ? ESCAPES[c] : c == '{' && i > 0 && isInterpolationStart(s.charAt(i - 1)) ? '{' : 0;
    if (escape == 0 || escape == otherQuotation) {
      if (buf != null) {
        buf.append(c);
      }
    }
 else {
      if (buf == null) {
        buf=new StringBuffer(s.length() + 4 + (addQuotation ? 2 : 0));
        if (addQuotation) {
          buf.append(quotation);
        }
        buf.append(s.substring(0,i));
      }
      if (escape == 1) {
        buf.append("String_Node_Str");
        int c2=(c >> 4) & 0x0F;
        c=(char)(c & 0x0F);
        buf.append((char)(c2 < 10 ? c2 + '0' : c2 - 10 + 'A'));
        buf.append((char)(c < 10 ? c + '0' : c - 10 + 'A'));
      }
 else {
        buf.append('\\');
        buf.append(escape);
      }
    }
  }
  if (buf == null) {
    return addQuotation ? quotation + s + quotation : s;
  }
 else {
    if (addQuotation) {
      buf.append(quotation);
    }
    return buf.toString();
  }
}