Program: 65168
Project: 65168
Buggy source:
/** 
 * INTERNAL Add the nested function string required for the type and its subtypes. The functions must be added in inverse order to resolve dependencies.
 */
protected void addNestedFunctionsForArgument(List functions,PLSQLargument argument,DatabaseType databaseType,Set<DatabaseType> processed){
  if ((databaseType == null) || !databaseType.isComplexDatabaseType() || databaseType.isJDBCType()|| processed.contains(databaseType)) {
    return;
  }
  ComplexDatabaseType type=(ComplexDatabaseType)databaseType;
  if (!type.hasCompatibleType()) {
    return;
  }
  processed.add(type);
  if (type instanceof PLSQLCollection) {
    DatabaseType nestedType=((PLSQLCollection)type).getNestedType();
    addNestedFunctionsForArgument(functions,argument,nestedType,processed);
  }
 else   if (type instanceof PLSQLrecord) {
    for (    PLSQLargument field : ((PLSQLrecord)type).getFields()) {
      DatabaseType nestedType=field.databaseType;
      addNestedFunctionsForArgument(functions,argument,nestedType,processed);
    }
  }
  TypeInfo info=this.typesInfo.get(type.getTypeName());
  if (info == null) {
    info=generateNestedFunction(type,argument.isNonAssociative);
  }
  if (argument.direction == IN) {
    if (!functions.contains(info.sql2PlConv)) {
      functions.add(info.sql2PlConv);
    }
  }
 else   if (argument.direction == INOUT) {
    if (!functions.contains(info.sql2PlConv)) {
      functions.add(info.sql2PlConv);
    }
    if (!functions.contains(info.pl2SqlConv)) {
      functions.add(info.pl2SqlConv);
    }
  }
 else   if (argument.direction == OUT) {
    if (!functions.contains(info.pl2SqlConv)) {
      functions.add(info.pl2SqlConv);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL Add the nested function string required for the type and its subtypes. The functions must be added in inverse order to resolve dependencies.
 */
protected void addNestedFunctionsForArgument(List functions,PLSQLargument argument,DatabaseType databaseType,Set<DatabaseType> processed){
  if ((databaseType == null) || !databaseType.isComplexDatabaseType() || databaseType.isJDBCType()|| argument.cursorOutput|| processed.contains(databaseType)) {
    return;
  }
  ComplexDatabaseType type=(ComplexDatabaseType)databaseType;
  if (!type.hasCompatibleType()) {
    return;
  }
  processed.add(type);
  if (type instanceof PLSQLCollection) {
    DatabaseType nestedType=((PLSQLCollection)type).getNestedType();
    addNestedFunctionsForArgument(functions,argument,nestedType,processed);
  }
 else   if (type instanceof PLSQLrecord) {
    for (    PLSQLargument field : ((PLSQLrecord)type).getFields()) {
      DatabaseType nestedType=field.databaseType;
      addNestedFunctionsForArgument(functions,argument,nestedType,processed);
    }
  }
  TypeInfo info=this.typesInfo.get(type.getTypeName());
  if (info == null) {
    info=generateNestedFunction(type,argument.isNonAssociative);
  }
  if (argument.direction == IN) {
    if (!functions.contains(info.sql2PlConv)) {
      functions.add(info.sql2PlConv);
    }
  }
 else   if (argument.direction == INOUT) {
    if (!functions.contains(info.sql2PlConv)) {
      functions.add(info.sql2PlConv);
    }
    if (!functions.contains(info.pl2SqlConv)) {
      functions.add(info.pl2SqlConv);
    }
  }
 else   if (argument.direction == OUT) {
    if (!functions.contains(info.pl2SqlConv)) {
      functions.add(info.pl2SqlConv);
    }
  }
}