Program: 64154
Project: 64154
Buggy source:
/** 
 * Convert the given object to the appropriate type by invoking the appropriate ConversionManager method.
 * @param sourceObject - will always be a string if read from XML
 * @param javaClass - the class that the object must be converted to
 * @param schemaTypeQName - the XML schema that the object is being converted from
 * @return - the newly converted object
 */
public Object convertObject(Object sourceObject,Class javaClass,QName schemaTypeQName) throws ConversionException {
  if (schemaTypeQName == null) {
    return convertObject(sourceObject,javaClass);
  }
  if (sourceObject == null) {
    return super.convertObject(sourceObject,javaClass);
  }
 else   if ((sourceObject.getClass() == javaClass) || (javaClass == null) || (javaClass == CoreClassConstants.OBJECT)) {
    return sourceObject;
  }
 else   if ((javaClass == CoreClassConstants.CALENDAR) || (javaClass == CoreClassConstants.GREGORIAN_CALENDAR)) {
    return convertObjectToCalendar(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.ABYTE) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.HEX_BINARY)) {
      return super.convertObjectToByteObjectArray(sourceObject);
    }
 else     if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return convertSchemaBase64ToByteObjectArray(sourceObject);
    }
  }
 else   if (javaClass == CoreClassConstants.APBYTE) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.HEX_BINARY)) {
      return super.convertObjectToByteArray(sourceObject);
    }
 else     if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return convertSchemaBase64ToByteArray(sourceObject);
    }
  }
 else   if ((javaClass == CoreClassConstants.List_Class) && (sourceObject instanceof String)) {
    return convertStringToList(sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.STRING) && (sourceObject instanceof List)) {
    return convertListToString(sourceObject);
  }
 else   if (sourceObject instanceof byte[]) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return buildBase64StringFromBytes((byte[])sourceObject);
    }
    return Helper.buildHexStringFromBytes((byte[])sourceObject);
  }
 else   if (sourceObject instanceof Byte[]) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return buildBase64StringFromObjectBytes((Byte[])sourceObject);
    }
    return buildHexStringFromObjectBytes((Byte[])sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.UTILDATE)) {
    return convertObjectToUtilDate(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.SQLDATE) {
    return convertObjectToSQLDate(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.TIME) {
    return convertObjectToSQLTime(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.TIMESTAMP) {
    return convertObjectToTimestamp(sourceObject,schemaTypeQName);
  }
 else   if ((javaClass == Constants.QNAME_CLASS) && (sourceObject != null)) {
    return convertObjectToQName(sourceObject);
  }
 else   if (javaClass == CoreClassConstants.STRING) {
    return convertObjectToString(sourceObject,schemaTypeQName);
  }
 else   if ((javaClass == java.net.URI.class)) {
    return convertObjectToURI(sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.XML_GREGORIAN_CALENDAR)) {
    return convertObjectToXMLGregorianCalendar(sourceObject,schemaTypeQName);
  }
 else   if ((javaClass == CoreClassConstants.DURATION)) {
    return convertObjectToDuration(sourceObject);
  }
 else {
    try {
      return super.convertObject(sourceObject,javaClass);
    }
 catch (    ConversionException ex) {
      if (sourceObject.getClass() == CoreClassConstants.STRING) {
        return super.convertObject(((String)sourceObject).trim(),javaClass);
      }
      throw ex;
    }
  }
  throw ConversionException.couldNotBeConverted(sourceObject,javaClass);
}

Fixed version (ground truth):
/** 
 * Convert the given object to the appropriate type by invoking the appropriate ConversionManager method.
 * @param sourceObject - will always be a string if read from XML
 * @param javaClass - the class that the object must be converted to
 * @param schemaTypeQName - the XML schema that the object is being converted from
 * @return - the newly converted object
 */
public Object convertObject(Object sourceObject,Class javaClass,QName schemaTypeQName) throws ConversionException {
  if (schemaTypeQName == null) {
    return convertObject(sourceObject,javaClass);
  }
  if (sourceObject == null) {
    return super.convertObject(sourceObject,javaClass);
  }
 else   if ((sourceObject.getClass() == javaClass) || (javaClass == null) || (javaClass == CoreClassConstants.OBJECT)) {
    return sourceObject;
  }
 else   if ((javaClass == CoreClassConstants.CALENDAR) || (javaClass == CoreClassConstants.GREGORIAN_CALENDAR)) {
    return convertObjectToCalendar(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.ABYTE) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.HEX_BINARY)) {
      return super.convertObjectToByteObjectArray(sourceObject);
    }
 else     if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return convertSchemaBase64ToByteObjectArray(sourceObject);
    }
  }
 else   if (javaClass == CoreClassConstants.APBYTE) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.HEX_BINARY)) {
      return super.convertObjectToByteArray(sourceObject);
    }
 else     if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return convertSchemaBase64ToByteArray(sourceObject);
    }
  }
 else   if ((javaClass == CoreClassConstants.List_Class) && (sourceObject instanceof String)) {
    return convertStringToList(sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.STRING) && (sourceObject instanceof List)) {
    return convertListToString(sourceObject);
  }
 else   if (sourceObject instanceof byte[]) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return buildBase64StringFromBytes((byte[])sourceObject);
    }
    return Helper.buildHexStringFromBytes((byte[])sourceObject);
  }
 else   if (sourceObject instanceof Byte[]) {
    if (schemaTypeQName.getLocalPart().equalsIgnoreCase(Constants.BASE_64_BINARY)) {
      return buildBase64StringFromObjectBytes((Byte[])sourceObject);
    }
    return buildHexStringFromObjectBytes((Byte[])sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.UTILDATE)) {
    return convertObjectToUtilDate(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.SQLDATE) {
    return convertObjectToSQLDate(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.TIME) {
    return convertObjectToSQLTime(sourceObject,schemaTypeQName);
  }
 else   if (javaClass == CoreClassConstants.TIMESTAMP) {
    return convertObjectToTimestamp(sourceObject,schemaTypeQName);
  }
 else   if ((javaClass == Constants.QNAME_CLASS) && (sourceObject != null)) {
    return convertObjectToQName(sourceObject);
  }
 else   if (javaClass == CoreClassConstants.STRING) {
    return convertObjectToString(sourceObject,schemaTypeQName);
  }
 else   if ((javaClass == java.net.URI.class)) {
    return convertObjectToURI(sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.XML_GREGORIAN_CALENDAR)) {
    return convertObjectToXMLGregorianCalendar(sourceObject,schemaTypeQName);
  }
 else   if ((javaClass == CoreClassConstants.DURATION)) {
    return convertObjectToDuration(sourceObject);
  }
 else   if ((javaClass == CoreClassConstants.CHAR)) {
    return convertObjectToChar(sourceObject,schemaTypeQName);
  }
 else {
    try {
      return super.convertObject(sourceObject,javaClass);
    }
 catch (    ConversionException ex) {
      if (sourceObject.getClass() == CoreClassConstants.STRING) {
        return super.convertObject(((String)sourceObject).trim(),javaClass);
      }
      throw ex;
    }
  }
  throw ConversionException.couldNotBeConverted(sourceObject,javaClass);
}