Program: 64942
Project: 64942
Buggy source:
/** 
 * Build and return a Result instance based on a given ProcedureType and return type name.
 */
protected Result buildResultForStoredFunction(ArgumentType returnArgument,String returnType){
  Result result=null;
  DatabaseType rargDataType=returnArgument.getEnclosedType();
  if (rargDataType.isPLSQLCursorType() || returnArgument.getTypeName().contains(CURSOR_STR)) {
    result=new CollectionResult();
    result.setType(SXF_QNAME_CURSOR);
  }
 else {
    result=new Result();
    int rargJdbcType=OTHER;
    if (rargDataType.isComposite()) {
      if (rargDataType.isObjectType()) {
        rargJdbcType=STRUCT;
      }
 else       if (rargDataType.isVArrayType() || rargDataType.isObjectTableType()) {
        rargJdbcType=ARRAY;
      }
    }
 else {
      rargJdbcType=Util.getJDBCTypeFromTypeName(returnArgument.getTypeName());
    }
switch (rargJdbcType) {
case OTHER:
      if (returnType == null || returnType.length() == 0) {
        returnType=rargDataType.getTypeName();
      }
    String packageName=null;
  if (rargDataType.isPLSQLType()) {
    packageName=((PLSQLType)rargDataType).getParentType().getPackageName();
  }
String returnTypeName=(packageName != null && packageName.length() > 0) ? packageName + UNDERSCORE + returnType : returnType;
result.setType(buildCustomQName(returnTypeName,dbwsBuilder));
break;
case STRUCT:
case ARRAY:
if (returnType == null || returnType.length() == 0) {
returnType=rargDataType.getTypeName().toLowerCase().concat(TYPE_STR);
}
result.setType(buildCustomQName(returnType,dbwsBuilder));
break;
default :
result.setType(getXMLTypeFromJDBCType(rargJdbcType));
break;
}
}
return result;
}

Fixed version (ground truth):
/** 
 * Build and return a Result instance based on a given ProcedureType and return type name.
 */
protected Result buildResultForStoredFunction(ArgumentType returnArgument,String returnType){
  Result result=null;
  DatabaseType rargDataType=returnArgument.getEnclosedType();
  if (rargDataType.isPLSQLCursorType() || returnArgument.getTypeName().contains(CURSOR_STR)) {
    result=new CollectionResult();
    result.setType(SXF_QNAME_CURSOR);
  }
 else {
    result=new Result();
    int rargJdbcType=OTHER;
    if (rargDataType.isComposite()) {
      if (rargDataType.isObjectType()) {
        rargJdbcType=STRUCT;
      }
 else       if (rargDataType.isVArrayType() || rargDataType.isObjectTableType()) {
        rargJdbcType=ARRAY;
      }
    }
 else {
      rargJdbcType=Util.getJDBCTypeFromTypeName(returnArgument.getTypeName());
    }
switch (rargJdbcType) {
case OTHER:
      String returnTypeName;
    if (returnType != null && returnType.length() > 0) {
      returnTypeName=returnType;
    }
 else {
      returnType=rargDataType.getTypeName();
      String packageName=null;
      if (rargDataType.isPLSQLType()) {
        packageName=((PLSQLType)rargDataType).getParentType().getPackageName();
      }
      returnTypeName=(packageName != null && packageName.length() > 0) ? packageName + UNDERSCORE + returnType : returnType;
    }
  result.setType(buildCustomQName(returnTypeName,dbwsBuilder));
break;
case STRUCT:
case ARRAY:
if (returnType == null || returnType.length() == 0) {
returnType=rargDataType.getTypeName().toLowerCase().concat(TYPE_STR);
}
result.setType(buildCustomQName(returnType,dbwsBuilder));
break;
default :
result.setType(getXMLTypeFromJDBCType(rargJdbcType));
break;
}
}
return result;
}