Program: 68631
Project: 68631
Buggy source:
/** 
 * Convert to a String value based to the SDO type.
 * @param value  The value to convert.
 * @param sdoType the SDO type
 * @return the original value converted to a String based on the SDO type specified.
 */
private String convertToStringValue(Object value,Type sdoType,QName xsdType){
  if (value.getClass() == ClassConstants.CALENDAR) {
    if (sdoType.equals(SDOConstants.SDO_DATETIME)) {
      return toDateTime((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_TIME)) {
      return toTime((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DAY)) {
      return toDay((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DURATION)) {
      return toDuration((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTH)) {
      return toMonth((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTHDAY)) {
      return toMonthDay((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEAR)) {
      return toYear((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTH)) {
      return toYearMonth((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTHDAY)) {
      return toYearMonthDay((Calendar)value);
    }
  }
 else   if (value.getClass() == ClassConstants.UTILDATE) {
    if (sdoType.equals(SDOConstants.SDO_DATETIME)) {
      return toDateTime((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_TIME)) {
      return toTime((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DAY)) {
      return toDay((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DURATION)) {
      return toDuration((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTH)) {
      return toMonth((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTHDAY)) {
      return toMonthDay((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEAR)) {
      return toYear((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTH)) {
      return toYearMonth((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTHDAY)) {
      return toYearMonthDay((Date)value);
    }
  }
 else   if (value.getClass().getName().equals("String_Node_Str")) {
    try {
      Class binaryDataHelper=PrivilegedAccessHelper.getClassForName("String_Node_Str");
      java.lang.reflect.Method getHelperMethod=PrivilegedAccessHelper.getMethod(binaryDataHelper,"String_Node_Str",new Class[]{},false);
      java.lang.reflect.Method stringToDataHandlerMethod=PrivilegedAccessHelper.getMethod(binaryDataHelper,"String_Node_Str",new Class[]{Object.class,QName.class},false);
      Object helper=PrivilegedAccessHelper.invokeMethod(getHelperMethod,binaryDataHelper,new Object[]{});
      String result=(String)PrivilegedAccessHelper.invokeMethod(stringToDataHandlerMethod,helper,new Object[]{value,xsdType});
      return result;
    }
 catch (    Exception ex) {
      return (String)getXMLConversionManager().convertObject(value,ClassConstants.STRING,xsdType);
    }
  }
  return (String)getXMLConversionManager().convertObject(value,ClassConstants.STRING,xsdType);
}

Fixed version (ground truth):
/** 
 * Convert to a String value based to the SDO type.
 * @param value  The value to convert.
 * @param sdoType the SDO type
 * @return the original value converted to a String based on the SDO type specified.
 */
private String convertToStringValue(Object value,Type sdoType,QName xsdType){
  if (value.getClass() == ClassConstants.CALENDAR) {
    if (sdoType.equals(SDOConstants.SDO_DATETIME)) {
      return toDateTime((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_TIME)) {
      return toTime((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DAY)) {
      return toDay((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DURATION)) {
      return toDuration((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTH)) {
      return toMonth((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTHDAY)) {
      return toMonthDay((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEAR)) {
      return toYear((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTH)) {
      return toYearMonth((Calendar)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTHDAY)) {
      return toYearMonthDay((Calendar)value);
    }
  }
 else   if (value.getClass() == ClassConstants.UTILDATE) {
    if (sdoType.equals(SDOConstants.SDO_DATETIME)) {
      return toDateTime((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_TIME)) {
      return toTime((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DAY)) {
      return toDay((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_DURATION)) {
      return toDuration((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTH)) {
      return toMonth((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_MONTHDAY)) {
      return toMonthDay((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEAR)) {
      return toYear((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTH)) {
      return toYearMonth((Date)value);
    }
 else     if (sdoType.equals(SDOConstants.SDO_YEARMONTHDAY)) {
      return toYearMonthDay((Date)value);
    }
  }
 else   if (value.getClass().getName().equals("String_Node_Str")) {
    try {
      Class binaryDataHelper=PrivilegedAccessHelper.getClassForName("String_Node_Str");
      java.lang.reflect.Method getHelperMethod=PrivilegedAccessHelper.getMethod(binaryDataHelper,"String_Node_Str",new Class[]{},false);
      java.lang.reflect.Method stringToDataHandlerMethod=PrivilegedAccessHelper.getMethod(binaryDataHelper,"String_Node_Str",new Class[]{Object.class,QName.class,AbstractSession.class},false);
      Object helper=PrivilegedAccessHelper.invokeMethod(getHelperMethod,binaryDataHelper,new Object[]{});
      String result=(String)PrivilegedAccessHelper.invokeMethod(stringToDataHandlerMethod,helper,new Object[]{value,xsdType,((SDOXMLHelper)getHelperContext().getXMLHelper()).getXmlContext().getSession(0)});
      return result;
    }
 catch (    Exception ex) {
      return (String)getXMLConversionManager().convertObject(value,ClassConstants.STRING,xsdType);
    }
  }
  return (String)getXMLConversionManager().convertObject(value,ClassConstants.STRING,xsdType);
}