Program: 65326
Project: 65326
Buggy source:
/** 
 * Convert the object to the appropriate type by invoking the appropriate ConversionManager method
 * @param object - the object that must be converted
 * @param javaClass - the class that the object must be converted to
 * @exception - ConversionException, all exceptions will be thrown as this type.
 * @return - the newly converted object
 */
public Object convertObject(Object sourceObject,Class javaClass) throws ConversionException {
  if (sourceObject == null) {
    if (javaClass != null) {
      return getDefaultNullValue(javaClass);
    }
 else {
      return null;
    }
  }
  if ((sourceObject.getClass() == javaClass) || (javaClass == null) || (javaClass == ClassConstants.OBJECT)|| (javaClass == ClassConstants.BLOB)|| (javaClass == ClassConstants.CLOB)) {
    return sourceObject;
  }
  try {
    if (javaClass == ClassConstants.STRING) {
      return convertObjectToString(sourceObject);
    }
 else     if (javaClass == ClassConstants.UTILDATE) {
      return convertObjectToUtilDate(sourceObject);
    }
 else     if (javaClass == ClassConstants.SQLDATE) {
      return convertObjectToDate(sourceObject);
    }
 else     if (javaClass == ClassConstants.TIME) {
      return convertObjectToTime(sourceObject);
    }
 else     if (javaClass == ClassConstants.TIMESTAMP) {
      return convertObjectToTimestamp(sourceObject);
    }
 else     if ((javaClass == ClassConstants.CALENDAR) || (javaClass == ClassConstants.GREGORIAN_CALENDAR)) {
      return convertObjectToCalendar(sourceObject);
    }
 else     if ((javaClass == ClassConstants.CHAR) || (javaClass == ClassConstants.PCHAR && !(sourceObject instanceof Character))) {
      return convertObjectToChar(sourceObject);
    }
 else     if ((javaClass == ClassConstants.INTEGER) || (javaClass == ClassConstants.PINT && !(sourceObject instanceof Integer))) {
      return convertObjectToInteger(sourceObject);
    }
 else     if ((javaClass == ClassConstants.DOUBLE) || (javaClass == ClassConstants.PDOUBLE && !(sourceObject instanceof Double))) {
      return convertObjectToDouble(sourceObject);
    }
 else     if ((javaClass == ClassConstants.FLOAT) || (javaClass == ClassConstants.PFLOAT && !(sourceObject instanceof Float))) {
      return convertObjectToFloat(sourceObject);
    }
 else     if ((javaClass == ClassConstants.LONG) || (javaClass == ClassConstants.PLONG && !(sourceObject instanceof Long))) {
      return convertObjectToLong(sourceObject);
    }
 else     if ((javaClass == ClassConstants.SHORT) || (javaClass == ClassConstants.PSHORT && !(sourceObject instanceof Short))) {
      return convertObjectToShort(sourceObject);
    }
 else     if ((javaClass == ClassConstants.BYTE) || (javaClass == ClassConstants.PBYTE && !(sourceObject instanceof Byte))) {
      return convertObjectToByte(sourceObject);
    }
 else     if (javaClass == ClassConstants.BIGINTEGER) {
      return convertObjectToBigInteger(sourceObject);
    }
 else     if (javaClass == ClassConstants.BIGDECIMAL) {
      return convertObjectToBigDecimal(sourceObject);
    }
 else     if (javaClass == ClassConstants.NUMBER) {
      return convertObjectToNumber(sourceObject);
    }
 else     if ((javaClass == ClassConstants.BOOLEAN) || (javaClass == ClassConstants.PBOOLEAN && !(sourceObject instanceof Boolean))) {
      return convertObjectToBoolean(sourceObject);
    }
 else     if (javaClass == ClassConstants.APBYTE) {
      return convertObjectToByteArray(sourceObject);
    }
 else     if (javaClass == ClassConstants.ABYTE) {
      return convertObjectToByteObjectArray(sourceObject);
    }
 else     if (javaClass == ClassConstants.APCHAR) {
      return convertObjectToCharArray(sourceObject);
    }
 else     if (javaClass == ClassConstants.ACHAR) {
      return convertObjectToCharacterArray(sourceObject);
    }
 else     if ((sourceObject.getClass() == ClassConstants.STRING) && (javaClass == ClassConstants.CLASS)) {
      return convertObjectToClass(sourceObject);
    }
  }
 catch (  ConversionException ce) {
    throw ce;
  }
catch (  Exception e) {
    throw ConversionException.couldNotBeConverted(sourceObject,javaClass,e);
  }
  if ((((javaClass == ClassConstants.PBOOLEAN) && (sourceObject instanceof Boolean)) || ((javaClass == ClassConstants.PLONG) && (sourceObject instanceof Long)) || ((javaClass == ClassConstants.PINT) && (sourceObject instanceof Integer))|| ((javaClass == ClassConstants.PFLOAT) && (sourceObject instanceof Float))|| ((javaClass == ClassConstants.PDOUBLE) && (sourceObject instanceof Double))|| ((javaClass == ClassConstants.PBYTE) && (sourceObject instanceof Byte))|| ((javaClass == ClassConstants.PCHAR) && (sourceObject instanceof Character))|| ((javaClass == ClassConstants.PSHORT) && (sourceObject instanceof Short)))) {
    return sourceObject;
  }
  if (javaClass.isInstance(sourceObject)) {
    return sourceObject;
  }
  if (ClassConstants.NOCONVERSION.isAssignableFrom(javaClass)) {
    return sourceObject;
  }
  throw ConversionException.couldNotBeConverted(sourceObject,javaClass);
}

Fixed version (ground truth):
/** 
 * Convert the object to the appropriate type by invoking the appropriate ConversionManager method
 * @param object - the object that must be converted
 * @param javaClass - the class that the object must be converted to
 * @exception - ConversionException, all exceptions will be thrown as this type.
 * @return - the newly converted object
 */
public Object convertObject(Object sourceObject,Class javaClass) throws ConversionException {
  if (sourceObject == null) {
    if (javaClass != null) {
      return getDefaultNullValue(javaClass);
    }
 else {
      return null;
    }
  }
  if ((sourceObject.getClass() == javaClass) || (javaClass == null) || (javaClass == ClassConstants.OBJECT)|| (javaClass == ClassConstants.BLOB)|| (javaClass == ClassConstants.CLOB)) {
    return sourceObject;
  }
  try {
    if (javaClass == ClassConstants.STRING) {
      return convertObjectToString(sourceObject);
    }
 else     if (javaClass == ClassConstants.UTILDATE) {
      return convertObjectToUtilDate(sourceObject);
    }
 else     if (javaClass == ClassConstants.SQLDATE) {
      return convertObjectToDate(sourceObject);
    }
 else     if (javaClass == ClassConstants.TIME) {
      return convertObjectToTime(sourceObject);
    }
 else     if (javaClass == ClassConstants.TIMESTAMP) {
      return convertObjectToTimestamp(sourceObject);
    }
 else     if ((javaClass == ClassConstants.CALENDAR) || (javaClass == ClassConstants.GREGORIAN_CALENDAR)) {
      return convertObjectToCalendar(sourceObject);
    }
 else     if ((javaClass == ClassConstants.CHAR) || (javaClass == ClassConstants.PCHAR && !(sourceObject instanceof Character))) {
      return convertObjectToChar(sourceObject);
    }
 else     if ((javaClass == ClassConstants.INTEGER) || (javaClass == ClassConstants.PINT && !(sourceObject instanceof Integer))) {
      return convertObjectToInteger(sourceObject);
    }
 else     if ((javaClass == ClassConstants.DOUBLE) || (javaClass == ClassConstants.PDOUBLE && !(sourceObject instanceof Double))) {
      return convertObjectToDouble(sourceObject);
    }
 else     if ((javaClass == ClassConstants.FLOAT) || (javaClass == ClassConstants.PFLOAT && !(sourceObject instanceof Float))) {
      return convertObjectToFloat(sourceObject);
    }
 else     if ((javaClass == ClassConstants.LONG) || (javaClass == ClassConstants.PLONG && !(sourceObject instanceof Long))) {
      return convertObjectToLong(sourceObject);
    }
 else     if ((javaClass == ClassConstants.SHORT) || (javaClass == ClassConstants.PSHORT && !(sourceObject instanceof Short))) {
      return convertObjectToShort(sourceObject);
    }
 else     if ((javaClass == ClassConstants.BYTE) || (javaClass == ClassConstants.PBYTE && !(sourceObject instanceof Byte))) {
      return convertObjectToByte(sourceObject);
    }
 else     if (javaClass == ClassConstants.BIGINTEGER) {
      return convertObjectToBigInteger(sourceObject);
    }
 else     if (javaClass == ClassConstants.BIGDECIMAL) {
      return convertObjectToBigDecimal(sourceObject);
    }
 else     if (javaClass == ClassConstants.NUMBER) {
      return convertObjectToNumber(sourceObject);
    }
 else     if ((javaClass == ClassConstants.BOOLEAN) || (javaClass == ClassConstants.PBOOLEAN && !(sourceObject instanceof Boolean))) {
      return convertObjectToBoolean(sourceObject);
    }
 else     if (javaClass == ClassConstants.APBYTE) {
      return convertObjectToByteArray(sourceObject);
    }
 else     if (javaClass == ClassConstants.ABYTE) {
      return convertObjectToByteObjectArray(sourceObject);
    }
 else     if (javaClass == ClassConstants.APCHAR) {
      return convertObjectToCharArray(sourceObject);
    }
 else     if (javaClass == ClassConstants.ACHAR) {
      return convertObjectToCharacterArray(sourceObject);
    }
 else     if ((sourceObject.getClass() == ClassConstants.STRING) && (javaClass == ClassConstants.CLASS)) {
      return convertObjectToClass(sourceObject);
    }
 else     if (javaClass == ClassConstants.URL_Class) {
      return convertObjectToUrl(sourceObject);
    }
  }
 catch (  ConversionException ce) {
    throw ce;
  }
catch (  Exception e) {
    throw ConversionException.couldNotBeConverted(sourceObject,javaClass,e);
  }
  if ((((javaClass == ClassConstants.PBOOLEAN) && (sourceObject instanceof Boolean)) || ((javaClass == ClassConstants.PLONG) && (sourceObject instanceof Long)) || ((javaClass == ClassConstants.PINT) && (sourceObject instanceof Integer))|| ((javaClass == ClassConstants.PFLOAT) && (sourceObject instanceof Float))|| ((javaClass == ClassConstants.PDOUBLE) && (sourceObject instanceof Double))|| ((javaClass == ClassConstants.PBYTE) && (sourceObject instanceof Byte))|| ((javaClass == ClassConstants.PCHAR) && (sourceObject instanceof Character))|| ((javaClass == ClassConstants.PSHORT) && (sourceObject instanceof Short)))) {
    return sourceObject;
  }
  if (javaClass.isInstance(sourceObject)) {
    return sourceObject;
  }
  if (ClassConstants.NOCONVERSION.isAssignableFrom(javaClass)) {
    return sourceObject;
  }
  throw ConversionException.couldNotBeConverted(sourceObject,javaClass);
}