Program: 64218
Project: 64218
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 {
        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 {
        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 {
        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)) {
    boolean multipleCursors=call.getParameterTypes().contains(call.OUT_CURSOR);
    if (callByIndex) {
      call.useUnnamedCursorOutputAsResultSet();
    }
 else {
      call.useNamedCursorOutputAsResultSet(m_queryParameter);
      call.setCursorOrdinalPosition(m_queryParameter,index);
    }
    if (multipleCursors) {
      call.setIsMultipleCursorOutputProcedure(true);
      call.setIsCursorOutputProcedure(false);
    }
  }
}

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()) {
          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()) {
          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)) {
    boolean multipleCursors=call.getParameterTypes().contains(call.OUT_CURSOR);
    if (callByIndex) {
      call.useUnnamedCursorOutputAsResultSet();
    }
 else {
      call.useNamedCursorOutputAsResultSet(m_queryParameter);
      call.setCursorOrdinalPosition(m_queryParameter,index);
    }
    if (multipleCursors) {
      call.setIsMultipleCursorOutputProcedure(true);
      call.setIsCursorOutputProcedure(false);
    }
  }
}