Program: 67193
Project: 67193
Buggy source:
/** 
 * INTERNAL: Allow the call to translate from the translation for predefined calls.
 */
public void translateQueryString(AbstractRecord translationRow,AbstractRecord modifyRow,AbstractSession session){
  if ((this.parameters == null) || getParameters().isEmpty()) {
    return;
  }
  if (getQueryString().indexOf(argumentMarker()) == -1) {
    return;
  }
  int lastIndex=0;
  int parameterIndex=0;
  String queryString=getQueryString();
  Writer writer=new CharArrayWriter(queryString.length() + 50);
  try {
    List parameterFields=getParameters();
    List parameterTypes=getParameterTypes();
    setParameters(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(parameterFields.size()));
    while (lastIndex != -1) {
      int tokenIndex=queryString.indexOf(argumentMarker(),lastIndex);
      String token;
      if (tokenIndex == -1) {
        token=queryString.substring(lastIndex,queryString.length());
        lastIndex=-1;
      }
 else {
        token=queryString.substring(lastIndex,tokenIndex);
      }
      writer.write(token);
      if (tokenIndex != -1) {
        Integer parameterType=(Integer)parameterTypes.get(parameterIndex);
        if (parameterType == MODIFY) {
          DatabaseField field=(DatabaseField)parameterFields.get(parameterIndex);
          Object value=modifyRow.get(field);
          appendParameter(writer,value,session);
        }
 else         if (parameterType == CUSTOM_MODIFY) {
          DatabaseField field=(DatabaseField)parameterFields.get(parameterIndex);
          Object value=modifyRow.get(field);
          if (value != null) {
            value=session.getDatasourcePlatform().getCustomModifyValueForCall(this,value,field,false);
            if ((value instanceof BindCallCustomParameter) && ((BindCallCustomParameter)value).shouldUseUnwrappedConnection()) {
              this.isNativeConnectionRequired=true;
            }
          }
          appendParameter(writer,value,session);
        }
 else         if (parameterType == TRANSLATION) {
          Object parameter=parameterFields.get(parameterIndex);
          Object value=null;
          if (parameter instanceof ParameterExpression) {
            value=((ParameterExpression)parameter).getValue(translationRow,session);
          }
 else {
            DatabaseField field=(DatabaseField)parameter;
            value=translationRow.get(field);
            if ((value == null) && (modifyRow != null)) {
              value=modifyRow.get(field);
            }
          }
          appendParameter(writer,value,session);
        }
 else         if (parameterType == LITERAL) {
          Object value=parameterFields.get(parameterIndex);
          if (value instanceof DatabaseField) {
            value=null;
          }
          appendParameter(writer,value,session);
        }
 else         if (parameterType == IN) {
          Object parameter=parameterFields.get(parameterIndex);
          Object value=getValueForInParameter(parameter,translationRow,modifyRow,session,false);
          appendParameter(writer,value,session);
        }
 else         if (parameterType == INOUT) {
          Object parameter=parameterFields.get(parameterIndex);
          Object value=getValueForInOutParameter(parameter,translationRow,modifyRow,session);
          appendParameter(writer,value,session);
        }
        lastIndex=tokenIndex + 1;
        parameterIndex++;
      }
    }
    setQueryString(writer.toString());
  }
 catch (  IOException exception) {
    throw ValidationException.fileError(exception);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Allow the call to translate from the translation for predefined calls.
 */
public void translateQueryString(AbstractRecord translationRow,AbstractRecord modifyRow,AbstractSession session){
  if ((this.parameters == null) || getParameters().isEmpty()) {
    return;
  }
  if (getQueryString().indexOf(argumentMarker()) == -1) {
    return;
  }
  int lastIndex=0;
  int parameterIndex=0;
  String queryString=getQueryString();
  Writer writer=new CharArrayWriter(queryString.length() + 50);
  try {
    List parameterFields=getParameters();
    List parameterTypes=getParameterTypes();
    setParameters(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(parameterFields.size()));
    while (lastIndex != -1) {
      int tokenIndex=queryString.indexOf(argumentMarker(),lastIndex);
      String token;
      if (tokenIndex == -1) {
        token=queryString.substring(lastIndex,queryString.length());
        lastIndex=-1;
      }
 else {
        if (this.shouldProcessTokenInQuotes) {
          token=queryString.substring(lastIndex,tokenIndex);
        }
 else {
          boolean hasPairedQuoteBeforeMark=true;
          int quotePairIndex=tokenIndex;
          do {
            quotePairIndex=queryString.lastIndexOf('\'',quotePairIndex - 1);
            if (quotePairIndex != -1 && quotePairIndex > lastIndex) {
              hasPairedQuoteBeforeMark=!hasPairedQuoteBeforeMark;
            }
 else {
              break;
            }
          }
 while (true);
          int endQuoteIndex=-1;
          if (!hasPairedQuoteBeforeMark) {
            endQuoteIndex=queryString.indexOf('\'',tokenIndex + 1);
          }
          if (endQuoteIndex != -1) {
            token=queryString.substring(lastIndex,endQuoteIndex + 1);
            tokenIndex=-1;
            lastIndex=endQuoteIndex + 1;
          }
 else {
            token=queryString.substring(lastIndex,tokenIndex);
            lastIndex=tokenIndex + 1;
          }
        }
      }
      writer.write(token);
      if (tokenIndex != -1) {
        Integer parameterType=(Integer)parameterTypes.get(parameterIndex);
        if (parameterType == MODIFY) {
          DatabaseField field=(DatabaseField)parameterFields.get(parameterIndex);
          Object value=modifyRow.get(field);
          appendParameter(writer,value,session);
        }
 else         if (parameterType == CUSTOM_MODIFY) {
          DatabaseField field=(DatabaseField)parameterFields.get(parameterIndex);
          Object value=modifyRow.get(field);
          if (value != null) {
            value=session.getDatasourcePlatform().getCustomModifyValueForCall(this,value,field,false);
            if ((value instanceof BindCallCustomParameter) && ((BindCallCustomParameter)value).shouldUseUnwrappedConnection()) {
              this.isNativeConnectionRequired=true;
            }
          }
          appendParameter(writer,value,session);
        }
 else         if (parameterType == TRANSLATION) {
          Object parameter=parameterFields.get(parameterIndex);
          Object value=null;
          if (parameter instanceof ParameterExpression) {
            value=((ParameterExpression)parameter).getValue(translationRow,session);
          }
 else {
            DatabaseField field=(DatabaseField)parameter;
            value=translationRow.get(field);
            if ((value == null) && (modifyRow != null)) {
              value=modifyRow.get(field);
            }
          }
          appendParameter(writer,value,session);
        }
 else         if (parameterType == LITERAL) {
          Object value=parameterFields.get(parameterIndex);
          if (value instanceof DatabaseField) {
            value=null;
          }
          appendParameter(writer,value,session);
        }
 else         if (parameterType == IN) {
          Object parameter=parameterFields.get(parameterIndex);
          Object value=getValueForInParameter(parameter,translationRow,modifyRow,session,false);
          appendParameter(writer,value,session);
        }
 else         if (parameterType == INOUT) {
          Object parameter=parameterFields.get(parameterIndex);
          Object value=getValueForInOutParameter(parameter,translationRow,modifyRow,session);
          appendParameter(writer,value,session);
        }
        lastIndex=tokenIndex + 1;
        parameterIndex++;
      }
    }
    setQueryString(writer.toString());
  }
 catch (  IOException exception) {
    throw ValidationException.fileError(exception);
  }
}