Program: 68859
Project: 68859
Buggy source:
/** 
 * INTERNAL: Called by prepare method only. May be overridden.
 */
protected void prepareInternal(AbstractSession session){
  if (isCursorOutputProcedure()) {
    int nFirstOutParameterIndex=-1;
    boolean hasFoundOutCursor=false;
    for (int index=0; index < parameters.size(); index++) {
      Integer parameterType=(Integer)parameterTypes.elementAt(index);
      if (parameterType == DatasourceCall.OUT_CURSOR) {
        if (hasFoundOutCursor) {
          throw ValidationException.multipleCursorsNotSupported(toString());
        }
 else {
          hasFoundOutCursor=true;
        }
      }
 else       if (parameterType == DatasourceCall.OUT) {
        if (nFirstOutParameterIndex == -1) {
          nFirstOutParameterIndex=index;
        }
      }
 else       if (parameterType == null) {
        throw ValidationException.wrongUsageOfSetCustomArgumentTypeMethod(toString());
      }
    }
    if (!hasFoundOutCursor && (nFirstOutParameterIndex >= 0)) {
      parameterTypes.setElementAt(DatasourceCall.OUT_CURSOR,nFirstOutParameterIndex);
    }
  }
  for (int i=0; i < getParameters().size(); i++) {
    Object parameter=getParameters().elementAt(i);
    Integer parameterType=(Integer)getParameterTypes().elementAt(i);
    if (parameterType == MODIFY) {
      DatabaseField field=(DatabaseField)parameter;
      if ((field.getType() == null) || session.getPlatform().shouldUseCustomModifyForCall(field)) {
        getParameterTypes().setElementAt(CUSTOM_MODIFY,i);
      }
    }
 else     if (parameterType == INOUT) {
      setShouldBuildOutputRow(true);
      setIsCallableStatementRequired(true);
      DatabaseField outField=(DatabaseField)((Object[])parameter)[1];
      if (outField.getType() == null) {
        DatabaseField typeOutField=getFieldWithTypeFromDescriptor(outField);
        if (typeOutField != null) {
          outField=(DatabaseField)typeOutField.clone();
        }
      }
      if (outField.getType() != null) {
        OutputParameterForCallableStatement outParameter=new OutputParameterForCallableStatement(outField,session);
        ((Object[])parameter)[1]=outParameter;
      }
    }
 else     if ((parameterType == OUT) || (parameterType == OUT_CURSOR)) {
      boolean isCursor=parameterType == OUT_CURSOR;
      if (!isCursor) {
        setShouldBuildOutputRow(true);
      }
      setIsCallableStatementRequired(true);
      DatabaseField outField=(DatabaseField)parameter;
      if (outField.getType() == null) {
        DatabaseField typeOutField=getFieldWithTypeFromDescriptor(outField);
        if (typeOutField != null) {
          outField=(DatabaseField)typeOutField.clone();
        }
      }
      OutputParameterForCallableStatement outParameter=new OutputParameterForCallableStatement(outField,session,isCursor);
      getParameters().setElementAt(outParameter,i);
      getParameterTypes().setElementAt(LITERAL,i);
    }
  }
  if (this.returnsResultSet == FalseUndefinedTrue.Undefined) {
    setReturnsResultSet(!isCallableStatementRequired());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Called by prepare method only. May be overridden.
 */
protected void prepareInternal(AbstractSession session){
  prepareInternalParameters(session);
}