Program: 63322
Project: 63322
Buggy source:
public java.sql.Timestamp convertStringToTimestamp(String sourceString,QName schemaType){
  XMLGregorianCalendar xmlGregorianCalender=null;
  try {
    xmlGregorianCalender=convertStringToXMLGregorianCalendar(sourceString);
  }
 catch (  Exception ex) {
    if (Constants.DATE_QNAME.equals(schemaType)) {
      throw ConversionException.incorrectDateFormat(sourceString);
    }
 else     if (Constants.TIME_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectTimestampTimeFormat(sourceString);
    }
 else     if (Constants.G_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGDayFormat(sourceString);
    }
 else     if (Constants.G_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthFormat(sourceString);
    }
 else     if (Constants.G_MONTH_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthDayFormat(sourceString);
    }
 else     if (Constants.G_YEAR_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearFormat(sourceString);
    }
 else     if (Constants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearMonthFormat(sourceString);
    }
 else     if (Constants.DURATION_QNAME.equals(schemaType)) {
      throw new IllegalArgumentException();
    }
 else {
      throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
    }
  }
  if (xmlGregorianCalender == null) {
    return null;
  }
  GregorianCalendar cal=xmlGregorianCalender.toGregorianCalendar();
  if (xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
    cal.setTimeZone(getTimeZone());
  }
  QName calendarQName=xmlGregorianCalender.getXMLSchemaType();
  if (!calendarQName.equals(schemaType)) {
    if (Constants.DATE_QNAME.equals(schemaType)) {
      if (calendarQName.equals(Constants.DATE_TIME_QNAME)) {
        cal.clear(Calendar.HOUR_OF_DAY);
        cal.clear(Calendar.MINUTE);
        cal.clear(Calendar.SECOND);
        cal.clear(Calendar.MILLISECOND);
        return Helper.timestampFromCalendar(cal);
      }
 else {
        throw ConversionException.incorrectDateFormat(sourceString);
      }
    }
 else     if (Constants.TIME_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectTimestampTimeFormat(sourceString);
    }
 else     if (Constants.G_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGDayFormat(sourceString);
    }
 else     if (Constants.G_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthFormat(sourceString);
    }
 else     if (Constants.G_MONTH_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthDayFormat(sourceString);
    }
 else     if (Constants.G_YEAR_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearFormat(sourceString);
    }
 else     if (Constants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearMonthFormat(sourceString);
    }
 else     if (Constants.DURATION_QNAME.equals(schemaType)) {
      throw new IllegalArgumentException();
    }
 else     if (Constants.DATE_TIME_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
    }
  }
  Timestamp timestamp=Helper.timestampFromCalendar(cal);
  String trimmedSourceString=sourceString.trim();
  int decimalIndex=trimmedSourceString.lastIndexOf('.');
  if (-1 == decimalIndex) {
    return timestamp;
  }
 else {
    int timeZoneIndex=trimmedSourceString.lastIndexOf(GMT_SUFFIX);
    if (-1 == timeZoneIndex) {
      timeZoneIndex=trimmedSourceString.lastIndexOf('-');
      if (timeZoneIndex < decimalIndex) {
        timeZoneIndex=-1;
      }
      if (-1 == timeZoneIndex) {
        timeZoneIndex=trimmedSourceString.lastIndexOf('+');
      }
    }
    String nsString;
    if (-1 == timeZoneIndex) {
      nsString=trimmedSourceString.substring(decimalIndex + 1);
    }
 else {
      nsString=trimmedSourceString.substring((decimalIndex + 1),timeZoneIndex);
    }
    double ns=Long.valueOf(nsString).doubleValue();
    ns=ns * Math.pow(10,9 - nsString.length());
    timestamp.setNanos((int)ns);
    return timestamp;
  }
}

Fixed version (ground truth):
public java.sql.Timestamp convertStringToTimestamp(String sourceString,QName schemaType){
  XMLGregorianCalendar xmlGregorianCalender=null;
  try {
    xmlGregorianCalender=convertStringToXMLGregorianCalendar(sourceString);
  }
 catch (  Exception ex) {
    if (Constants.DATE_QNAME.equals(schemaType)) {
      throw ConversionException.incorrectDateFormat(sourceString);
    }
 else     if (Constants.TIME_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectTimestampTimeFormat(sourceString);
    }
 else     if (Constants.G_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGDayFormat(sourceString);
    }
 else     if (Constants.G_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthFormat(sourceString);
    }
 else     if (Constants.G_MONTH_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthDayFormat(sourceString);
    }
 else     if (Constants.G_YEAR_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearFormat(sourceString);
    }
 else     if (Constants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearMonthFormat(sourceString);
    }
 else     if (Constants.DURATION_QNAME.equals(schemaType)) {
      throw new IllegalArgumentException();
    }
 else {
      throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
    }
  }
  if (xmlGregorianCalender == null) {
    return null;
  }
  Calendar cal=this.toCalendar(xmlGregorianCalender);
  if (xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
    cal.setTimeZone(getTimeZone());
  }
  QName calendarQName=xmlGregorianCalender.getXMLSchemaType();
  if (!calendarQName.equals(schemaType)) {
    if (Constants.DATE_QNAME.equals(schemaType)) {
      if (calendarQName.equals(Constants.DATE_TIME_QNAME)) {
        cal.clear(Calendar.HOUR_OF_DAY);
        cal.clear(Calendar.MINUTE);
        cal.clear(Calendar.SECOND);
        cal.clear(Calendar.MILLISECOND);
        return Helper.timestampFromCalendar(cal);
      }
 else {
        throw ConversionException.incorrectDateFormat(sourceString);
      }
    }
 else     if (Constants.TIME_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectTimestampTimeFormat(sourceString);
    }
 else     if (Constants.G_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGDayFormat(sourceString);
    }
 else     if (Constants.G_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthFormat(sourceString);
    }
 else     if (Constants.G_MONTH_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthDayFormat(sourceString);
    }
 else     if (Constants.G_YEAR_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearFormat(sourceString);
    }
 else     if (Constants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearMonthFormat(sourceString);
    }
 else     if (Constants.DURATION_QNAME.equals(schemaType)) {
      throw new IllegalArgumentException();
    }
 else     if (Constants.DATE_TIME_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectTimestampDateTimeFormat(sourceString);
    }
  }
  Timestamp timestamp=Helper.timestampFromCalendar(cal);
  String trimmedSourceString=sourceString.trim();
  int decimalIndex=trimmedSourceString.lastIndexOf('.');
  if (-1 == decimalIndex) {
    return timestamp;
  }
 else {
    int timeZoneIndex=trimmedSourceString.lastIndexOf(GMT_SUFFIX);
    if (-1 == timeZoneIndex) {
      timeZoneIndex=trimmedSourceString.lastIndexOf('-');
      if (timeZoneIndex < decimalIndex) {
        timeZoneIndex=-1;
      }
      if (-1 == timeZoneIndex) {
        timeZoneIndex=trimmedSourceString.lastIndexOf('+');
      }
    }
    String nsString;
    if (-1 == timeZoneIndex) {
      nsString=trimmedSourceString.substring(decimalIndex + 1);
    }
 else {
      nsString=trimmedSourceString.substring((decimalIndex + 1),timeZoneIndex);
    }
    double ns=Long.valueOf(nsString).doubleValue();
    ns=ns * Math.pow(10,9 - nsString.length());
    timestamp.setNanos((int)ns);
    return timestamp;
  }
}