Program: 63997
Project: 63997
Buggy source:
/** 
 * INTERNAL:
 */
public void processArgument(StoredProcedureCall call,boolean callByIndex,int index){
  boolean shouldCallByIndex=process(call,index);
  if (!callByIndex) {
    callByIndex=shouldCallByIndex;
  }
  if (m_mode.equals(JPA_PARAMETER_IN)) {
    if (hasType()) {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter,getJavaClass(m_type));
      }
 else {
        if (hasJdbcType() && hasJdbcTypeName()) {
          OracleArrayTypeMetadata aType=null;
          if (hasTypeName() && (aType=getArrayTypeMetadata(m_typeName)) != null) {
            call.addNamedArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type),buildNestedField(aType));
          }
 else {
            call.addNamedArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type));
          }
        }
 else {
          call.addNamedArgument(m_name,m_queryParameter,getJavaClass(m_type));
        }
      }
    }
 else     if (hasJdbcType() && hasJdbcTypeName()) {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
 else {
        call.addNamedArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
    }
 else     if (hasJdbcType()) {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter,m_jdbcType);
      }
 else {
        call.addNamedArgument(m_name,m_queryParameter,m_jdbcType);
      }
    }
 else {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter);
      }
 else {
        call.addNamedArgument(m_name,m_queryParameter);
      }
    }
  }
 else   if (m_mode.equals(JPA_PARAMETER_OUT)) {
    if (hasType()) {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter,getJavaClass(m_type));
      }
 else {
        if (hasJdbcType() && hasJdbcTypeName()) {
          OracleArrayTypeMetadata aType=null;
          if (hasTypeName() && (aType=getArrayTypeMetadata(m_typeName)) != null) {
            call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type),buildNestedField(aType));
          }
 else {
            call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type));
          }
        }
 else {
          call.addNamedOutputArgument(m_name,m_queryParameter,getJavaClass(m_type));
        }
      }
    }
 else     if (hasJdbcType() && hasJdbcTypeName()) {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
 else {
        call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
    }
 else     if (hasJdbcType()) {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter,m_jdbcType);
      }
 else {
        call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType);
      }
    }
 else {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter);
      }
 else {
        call.addNamedOutputArgument(m_name,m_queryParameter);
      }
    }
    setDatabaseFieldSettings((DatabaseField)call.getParameters().get(call.getParameters().size() - 1));
  }
 else   if (m_mode.equals(Direction.IN_OUT.name()) || m_mode.equals(JPA_PARAMETER_INOUT)) {
    if (hasType()) {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter,m_queryParameter,getJavaClass(m_type));
      }
 else {
        if (hasJdbcType() && hasJdbcTypeName()) {
          call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type));
        }
 else {
          call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,getJavaClass(m_type));
        }
      }
    }
 else     if (hasJdbcType() && hasJdbcTypeName()) {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
 else {
        call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
    }
 else     if (hasJdbcType()) {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter,m_queryParameter,m_jdbcType);
      }
 else {
        call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType);
      }
    }
 else {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter);
      }
 else {
        call.addNamedInOutputArgument(m_name,m_queryParameter);
      }
    }
    Object[] array=(Object[])call.getParameters().get(call.getParameters().size() - 1);
    if (array[0] == array[1]) {
      array[1]=((DatabaseField)array[1]).clone();
    }
    setDatabaseFieldSettings((DatabaseField)array[1]);
  }
 else   if (m_mode.equals(Direction.OUT_CURSOR.name()) || m_mode.equals(JPA_PARAMETER_REF_CURSOR)) {
    if (callByIndex) {
      call.useUnnamedCursorOutputAsResultSet(index);
    }
 else {
      call.useNamedCursorOutputAsResultSet(m_queryParameter);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void processArgument(StoredProcedureCall call,boolean callByIndex,int index){
  boolean shouldCallByIndex=process(call,index);
  if (!callByIndex) {
    callByIndex=shouldCallByIndex;
  }
  if (m_mode.equals(JPA_PARAMETER_IN)) {
    if (hasType()) {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter,getJavaClass(m_type));
      }
 else {
        if (hasJdbcType() && hasJdbcTypeName()) {
          OracleArrayTypeMetadata aType=null;
          if (hasTypeName() && (aType=getArrayTypeMetadata(m_typeName)) != null) {
            call.addNamedArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type),buildNestedField(aType));
          }
 else {
            call.addNamedArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type));
          }
        }
 else {
          call.addNamedArgument(m_name,m_queryParameter,getJavaClass(m_type));
        }
      }
    }
 else     if (hasJdbcType() && hasJdbcTypeName()) {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
 else {
        call.addNamedArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
    }
 else     if (hasJdbcType()) {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter,m_jdbcType);
      }
 else {
        call.addNamedArgument(m_name,m_queryParameter,m_jdbcType);
      }
    }
 else {
      if (callByIndex) {
        call.addUnamedArgument(m_queryParameter);
      }
 else {
        call.addNamedArgument(m_name,m_queryParameter);
      }
    }
  }
 else   if (m_mode.equals(JPA_PARAMETER_OUT)) {
    if (hasType()) {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter,getJavaClass(m_type));
      }
 else {
        if (hasJdbcType() && hasJdbcTypeName()) {
          OracleArrayTypeMetadata aType=null;
          if (hasTypeName() && (aType=getArrayTypeMetadata(m_typeName)) != null) {
            call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type),buildNestedField(aType));
          }
 else {
            call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type));
          }
        }
 else {
          call.addNamedOutputArgument(m_name,m_queryParameter,getJavaClass(m_type));
        }
      }
    }
 else     if (hasJdbcType() && hasJdbcTypeName()) {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
 else {
        call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
    }
 else     if (hasJdbcType()) {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter,m_jdbcType);
      }
 else {
        call.addNamedOutputArgument(m_name,m_queryParameter,m_jdbcType);
      }
    }
 else {
      if (callByIndex) {
        call.addUnamedOutputArgument(m_queryParameter);
      }
 else {
        call.addNamedOutputArgument(m_name,m_queryParameter);
      }
    }
    setDatabaseFieldSettings((DatabaseField)call.getParameters().get(call.getParameters().size() - 1));
  }
 else   if (m_mode.equals(Direction.IN_OUT.name()) || m_mode.equals(JPA_PARAMETER_INOUT)) {
    if (hasType()) {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter,m_queryParameter,getJavaClass(m_type));
      }
 else {
        if (hasJdbcType() && hasJdbcTypeName()) {
          OracleArrayTypeMetadata aType=null;
          if (hasTypeName() && (aType=getArrayTypeMetadata(m_typeName)) != null) {
            call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type),buildNestedField(aType));
          }
 else {
            call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName,getJavaClass(m_type));
          }
        }
 else {
          call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,getJavaClass(m_type));
        }
      }
    }
 else     if (hasJdbcType() && hasJdbcTypeName()) {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
 else {
        call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType,m_jdbcTypeName);
      }
    }
 else     if (hasJdbcType()) {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter,m_queryParameter,m_jdbcType);
      }
 else {
        call.addNamedInOutputArgument(m_name,m_queryParameter,m_queryParameter,m_jdbcType);
      }
    }
 else {
      if (callByIndex) {
        call.addUnamedInOutputArgument(m_queryParameter);
      }
 else {
        call.addNamedInOutputArgument(m_name,m_queryParameter);
      }
    }
    Object[] array=(Object[])call.getParameters().get(call.getParameters().size() - 1);
    if (array[0] == array[1]) {
      array[1]=((DatabaseField)array[1]).clone();
    }
    setDatabaseFieldSettings((DatabaseField)array[1]);
  }
 else   if (m_mode.equals(Direction.OUT_CURSOR.name()) || m_mode.equals(JPA_PARAMETER_REF_CURSOR)) {
    if (callByIndex) {
      call.useUnnamedCursorOutputAsResultSet(index);
    }
 else {
      call.useNamedCursorOutputAsResultSet(m_queryParameter);
    }
  }
}