Program: 65189
Project: 65189
Buggy source:
@Override public void initializeCall(XRServiceAdapter xrService,QueryOperation queryOperation,DatabaseQuery databaseQuery){
  StoredProcedureCall spCall=createCall();
  if (getName() != null) {
    spCall.setProcedureName(getName());
  }
 else {
    spCall.setProcedureName(queryOperation.getName());
  }
  QName resultType=queryOperation.getResultType();
  if ((getInOutArguments().size() + getOutArguments().size()) > 1 && !queryOperation.isSimpleXMLFormat()) {
    throw DBWSException.multipleOutputArgumentsOnlySupportedForSimpleXML();
  }
  for (  Parameter p : queryOperation.getParameters()) {
    ProcedureArgument arg=findInOutArgument(p.getName());
    String argName=p.getName();
    if (arg != null) {
      argName=arg.getName();
    }
    if (arg != null && arg instanceof ProcedureOutputArgument) {
      if (isCursorType(xrService,p.getType())) {
        throw DBWSException.inoutCursorArgumentsNotSupported();
      }
      spCall.addNamedInOutputArgument(argName,p.getName());
    }
 else {
      spCall.addNamedArgument(argName,p.getName());
    }
  }
  if (queryOperation.hasResponse()) {
    if (!queryOperation.isSimpleXMLFormat() || (spCall.isStoredFunctionCall() && !isCursorType(xrService,resultType))) {
      setSingleResult(xrService,spCall,resultType);
    }
 else {
      if (spCall.isStoredFunctionCall() && isCursorType(xrService,resultType)) {
        spCall.useUnnamedCursorOutputAsResultSet();
      }
 else       if (getOutArguments().isEmpty()) {
        spCall.setReturnsResultSet(true);
      }
 else {
        for (        ProcedureOutputArgument arg : getOutArguments()) {
          if (arg.getResultType() != null && isCursorType(xrService,arg.getResultType())) {
            spCall.useNamedCursorOutputAsResultSet(arg.getName());
          }
 else {
            spCall.addNamedOutputArgument(arg.getName());
          }
        }
      }
    }
  }
  databaseQuery.setCall(spCall);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void initializeCall(XRServiceAdapter xrService,QueryOperation queryOperation,DatabaseQuery databaseQuery){
  StoredProcedureCall spCall=createCall();
  if (getName() != null) {
    spCall.setProcedureName(getName());
  }
 else {
    spCall.setProcedureName(queryOperation.getName());
  }
  QName resultType=queryOperation.getResultType();
  if ((getInOutArguments().size() + getOutArguments().size()) > 1 && !queryOperation.isSimpleXMLFormat()) {
    throw DBWSException.multipleOutputArgumentsOnlySupportedForSimpleXML();
  }
  for (  Parameter p : queryOperation.getParameters()) {
    ProcedureArgument arg=findInOutArgument(p.getName());
    String argName=p.getName();
    if (arg != null) {
      argName=arg.getName();
    }
    if (arg != null && arg instanceof ProcedureOutputArgument) {
      if (isCursorType(xrService,p.getType())) {
        throw DBWSException.inoutCursorArgumentsNotSupported();
      }
      spCall.addNamedInOutputArgument(argName,p.getName());
    }
 else {
      spCall.addNamedArgument(argName,p.getName());
    }
  }
  if (queryOperation.hasResponse()) {
    if (!queryOperation.isSimpleXMLFormat() || (spCall.isStoredFunctionCall() && !isCursorType(xrService,resultType))) {
      setSingleResult(xrService,spCall,resultType);
    }
 else {
      if (spCall.isStoredFunctionCall() && isCursorType(xrService,resultType)) {
        spCall.setIsCursorOutputProcedure(true);
        spCall.getParameters().remove(0);
        spCall.getParameters().add(0,new DatabaseField(CURSOR_STR));
      }
 else       if (getOutArguments().isEmpty()) {
        spCall.setReturnsResultSet(true);
      }
 else {
        for (        ProcedureOutputArgument arg : getOutArguments()) {
          if (arg.getResultType() != null && isCursorType(xrService,arg.getResultType())) {
            spCall.useNamedCursorOutputAsResultSet(arg.getName());
          }
 else {
            spCall.addNamedOutputArgument(arg.getName());
          }
        }
      }
    }
  }
  databaseQuery.setCall(spCall);
}