Program: 68251
Project: 68251
Buggy source:
private String stringFromTimestamp(Timestamp sourceDate,QName schemaType){
  if (XMLConstants.DATE_TIME_QNAME.equals(schemaType)) {
    String string=dateTimeFormatter.get().format(sourceDate);
    int ns=sourceDate.getNanos();
    if (0 == ns) {
      string+="String_Node_Str";
    }
 else {
      string+=('.' + Helper.buildZeroPrefixAndTruncTrailZeros(ns,9));
    }
    return appendTimeZone(string);
  }
 else   if (XMLConstants.DATE_QNAME.equals(schemaType)) {
    return dateFormatter.get().format(sourceDate);
  }
 else   if (XMLConstants.TIME_QNAME.equals(schemaType)) {
    String string=timeFormatter.get().format(sourceDate);
    int ns=sourceDate.getNanos();
    if (0 == ns) {
      string+="String_Node_Str";
    }
 else {
      string+=('.' + Helper.buildZeroPrefixAndTruncTrailZeros(ns,9));
    }
    return appendTimeZone(string);
  }
 else   if (XMLConstants.G_DAY_QNAME.equals(schemaType)) {
    return gDayFormatter.get().format(sourceDate);
  }
 else   if (XMLConstants.G_MONTH_QNAME.equals(schemaType)) {
    return gMonthFormatter.get().format(sourceDate);
  }
 else   if (XMLConstants.G_MONTH_DAY_QNAME.equals(schemaType)) {
    return gMonthDayFormatter.get().format(sourceDate);
  }
 else   if (XMLConstants.G_YEAR_QNAME.equals(schemaType)) {
    return gYearFormatter.get().format(sourceDate);
  }
 else   if (XMLConstants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
    return gYearMonthFormatter.get().format(sourceDate);
  }
 else   if (XMLConstants.DURATION_QNAME.equals(schemaType)) {
    throw new IllegalArgumentException();
  }
 else {
    return stringFromTimestamp(sourceDate);
  }
}

Fixed version (ground truth):
/** 
 * This method returns a string representing a given Timestamp based on a given schema type QName. BC dates (sourceDate.getTime() < YEAR_ONE_AD_TIME) are handled  as follows: '2007 BC' --> '-2006 AD'.
 * @param sourceDate
 * @param schemaType
 * @return
 */
private String stringFromTimestamp(Timestamp sourceDate,QName schemaType){
  boolean bc=sourceDate.getTime() < YEAR_ONE_AD_TIME;
  if (bc) {
    sourceDate=handleBCDate(sourceDate);
  }
  if (XMLConstants.DATE_QNAME.equals(schemaType)) {
    return bc ? '-' + dateFormatter.get().format(sourceDate) : dateFormatter.get().format(sourceDate);
  }
  if (XMLConstants.TIME_QNAME.equals(schemaType)) {
    String string=timeFormatter.get().format(sourceDate);
    string=appendNanos(string,sourceDate);
    return appendTimeZone(string);
  }
  if (XMLConstants.G_DAY_QNAME.equals(schemaType)) {
    return gDayFormatter.get().format(sourceDate);
  }
  if (XMLConstants.G_MONTH_QNAME.equals(schemaType)) {
    return gMonthFormatter.get().format(sourceDate);
  }
  if (XMLConstants.G_MONTH_DAY_QNAME.equals(schemaType)) {
    return gMonthDayFormatter.get().format(sourceDate);
  }
  if (XMLConstants.G_YEAR_QNAME.equals(schemaType)) {
    return bc ? '-' + gYearFormatter.get().format(sourceDate) : gYearFormatter.get().format(sourceDate);
  }
  if (XMLConstants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
    return bc ? '-' + gYearMonthFormatter.get().format(sourceDate) : gYearMonthFormatter.get().format(sourceDate);
  }
  if (XMLConstants.DURATION_QNAME.equals(schemaType)) {
    throw new IllegalArgumentException();
  }
  String string=dateTimeFormatter.get().format(sourceDate);
  string=appendNanos(string,sourceDate);
  return bc ? '-' + appendTimeZone(string) : appendTimeZone(string);
}