Program: 67883
Project: 67883
Buggy source:
public java.util.Date convertStringToDate(String sourceString,QName schemaType){
  XMLGregorianCalendar xmlGregorianCalender=null;
  try {
    xmlGregorianCalender=convertStringToXMLGregorianCalendar(sourceString);
  }
 catch (  Exception ex) {
    if (XMLConstants.DATE_QNAME.equals(schemaType)) {
      throw ConversionException.incorrectDateFormat(sourceString);
    }
 else     if (XMLConstants.TIME_QNAME.equals(schemaType)) {
      throw ConversionException.incorrectTimeFormat(sourceString);
    }
 else     if (XMLConstants.G_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGDayFormat(sourceString);
    }
 else     if (XMLConstants.G_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthFormat(sourceString);
    }
 else     if (XMLConstants.G_MONTH_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthDayFormat(sourceString);
    }
 else     if (XMLConstants.G_YEAR_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearFormat(sourceString);
    }
 else     if (XMLConstants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearMonthFormat(sourceString);
    }
 else     if (XMLConstants.DURATION_QNAME.equals(schemaType)) {
      throw new IllegalArgumentException();
    }
 else {
      throw ConversionException.incorrectDateTimeFormat(sourceString);
    }
  }
  if (schemaType == null) {
    schemaType=xmlGregorianCalender.getXMLSchemaType();
  }
  QName calendarQName=xmlGregorianCalender.getXMLSchemaType();
  if (!calendarQName.equals(schemaType)) {
    if (XMLConstants.DATE_QNAME.equals(schemaType)) {
      if (calendarQName.equals(XMLConstants.DATE_TIME_QNAME)) {
        Calendar cal=xmlGregorianCalender.toGregorianCalendar();
        cal.clear(Calendar.HOUR_OF_DAY);
        cal.clear(Calendar.MINUTE);
        cal.clear(Calendar.SECOND);
        cal.clear(Calendar.MILLISECOND);
        return cal.getTime();
      }
 else {
        throw ConversionException.incorrectDateFormat(sourceString);
      }
    }
 else     if (XMLConstants.TIME_QNAME.equals(schemaType)) {
      throw ConversionException.incorrectTimeFormat(sourceString);
    }
 else     if (XMLConstants.G_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGDayFormat(sourceString);
    }
 else     if (XMLConstants.G_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthFormat(sourceString);
    }
 else     if (XMLConstants.G_MONTH_DAY_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGMonthDayFormat(sourceString);
    }
 else     if (XMLConstants.G_YEAR_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearFormat(sourceString);
    }
 else     if (XMLConstants.G_YEAR_MONTH_QNAME.equals(schemaType)) {
      throw XMLConversionException.incorrectGYearMonthFormat(sourceString);
    }
 else     if (XMLConstants.DURATION_QNAME.equals(schemaType)) {
      throw new IllegalArgumentException();
    }
 else     if (XMLConstants.DATE_TIME_QNAME.equals(schemaType)) {
      throw ConversionException.incorrectDateTimeFormat(sourceString);
    }
  }
  XMLGregorianCalendar defaults=getDatatypeFactory().newXMLGregorianCalendar();
  defaults.setTimezone(getTimeZone().getRawOffset() / 60000);
  GregorianCalendar cal;
  if (xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
    cal=xmlGregorianCalender.toGregorianCalendar(getTimeZone(),null,null);
  }
 else {
    cal=xmlGregorianCalender.toGregorianCalendar();
  }
  cal.setGregorianChange(new Date(Long.MAX_VALUE));
  Date returnDate=cal.getTime();
  return returnDate;
}

Fixed version (ground truth):
public java.util.Date convertStringToDate(String sourceString,QName schemaType){
  XMLGregorianCalendar xmlGregorianCalender=convertStringToXMLGregorianCalendar(sourceString,schemaType);
  if (schemaType == null) {
    schemaType=xmlGregorianCalender.getXMLSchemaType();
  }
  XMLGregorianCalendar defaults=getDatatypeFactory().newXMLGregorianCalendar();
  defaults.setTimezone(getTimeZone().getRawOffset() / 60000);
  GregorianCalendar cal;
  if (xmlGregorianCalender.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
    cal=xmlGregorianCalender.toGregorianCalendar(getTimeZone(),null,null);
  }
 else {
    cal=xmlGregorianCalender.toGregorianCalendar();
  }
  cal.setGregorianChange(new Date(Long.MAX_VALUE));
  Date returnDate=cal.getTime();
  return returnDate;
}