Program: 10371
Project: 10371
Buggy source:
/** 
 * Checks and transforms   {@code code}. If successful, results are stored in this instance and can be queried using the appropriate methods.
 * @param code the list of contract expressions to parse
 * @param lineNumbers line numbers associated with {@code code}
 * @param sourceInfo optional source information
 * @return {@code true} if there was no errors
 */
@Requires({"String_Node_Str","String_Node_Str","String_Node_Str"}) @Ensures({"String_Node_Str","String_Node_Str"}) @SuppressWarnings("String_Node_Str") public boolean transform(List<String> code,List<Long> lineNumbers,Object sourceInfo){
  oldParameters=new ArrayList<VariableModel>();
  oldParametersCode=new ArrayList<String>();
  oldParametersLineNumbers=new ArrayList<Long>();
  newCode=new ArrayList<String>();
  parsed=true;
  Iterator<Long> iterLineNumber=lineNumbers.iterator();
  code:   for (  String expr : code) {
    Long lineNumber=iterLineNumber.hasNext() ? iterLineNumber.next() : null;
    BalancedTokenizer tokenizer=new BalancedTokenizer(new StringReader(expr));
    int currentLevel=0;
    int newLevel=0;
    StringBuilder buffer=new StringBuilder();
    StringBuilder oldBuffer=null;
    String oldName=null;
    int oldContext=-1;
    ArrayDeque<Integer> impliesContext=new ArrayDeque<Integer>();
    int impliesCount=0;
    while (tokenizer.hasNext()) {
      Token token=tokenizer.next();
      newLevel=tokenizer.getCurrentLevel();
      StringBuilder currentBuffer=oldBuffer != null ? oldBuffer : buffer;
      if (newLevel == 0 && token.text.equals("String_Node_Str")) {
        diagnosticManager.error("String_Node_Str",expr,token.offset,token.offset,token.offset,sourceInfo);
        parsed=false;
        continue code;
      }
      if (newLevel < currentLevel) {
        appendImpliesTrail(currentBuffer,impliesCount);
        impliesCount=impliesContext.pop();
      }
 else       if (newLevel > currentLevel) {
        impliesContext.push(impliesCount);
        impliesCount=0;
      }
      if (oldBuffer != null) {
        if (newLevel == oldContext) {
          String oldExpr=oldBuffer.toString();
          oldParameters.add(new VariableModel(ElementKind.PARAMETER,oldName,new ClassName("String_Node_Str")));
          oldParametersCode.add(oldExpr);
          oldParametersLineNumbers.add(lineNumber);
          buffer.append("String_Node_Str");
          buffer.append(JavaUtils.BEGIN_GENERATED_CODE);
          buffer.append(MAGIC_CAST_METHOD);
          buffer.append("String_Node_Str");
          buffer.append(oldName);
          buffer.append("String_Node_Str");
          buffer.append("String_Node_Str");
          buffer.append(JavaUtils.END_GENERATED_CODE);
          buffer.append(oldExpr);
          buffer.append(JavaUtils.BEGIN_GENERATED_CODE);
          buffer.append("String_Node_Str");
          buffer.append(JavaUtils.END_GENERATED_CODE);
          buffer.append("String_Node_Str");
          oldBuffer=null;
          oldContext=-1;
        }
 else {
switch (token.kind) {
case WORD:
            if (token.text.equals("String_Node_Str")) {
              diagnosticManager.error("String_Node_Str",expr,token.offset,token.offset,token.offset,sourceInfo);
              parsed=false;
              continue code;
            }
          oldBuffer.append(token.text);
        break;
default :
      impliesCount+=transformCommon(oldBuffer,tokenizer,token);
  }
}
}
 else {
switch (token.kind) {
case WORD:
  if (acceptOld && token.text.equals("String_Node_Str")) {
    if (!tokenizer.hasNext() || !tokenizer.next().text.equals("String_Node_Str")) {
      int errorPos=tokenizer.getCurrentOffset();
      diagnosticManager.error("String_Node_Str",expr,errorPos,errorPos,errorPos,sourceInfo);
      parsed=false;
      continue code;
    }
    oldName=JavaUtils.OLD_VARIABLE_PREFIX + oldId++;
    oldBuffer=new StringBuilder();
    oldContext=currentLevel;
    break;
  }
default :
impliesCount+=transformCommon(buffer,tokenizer,token);
}
}
currentLevel=newLevel;
}
appendImpliesTrail(buffer,impliesCount);
if (tokenizer.hasErrors()) {
int errorPos=tokenizer.getCurrentOffset();
diagnosticManager.error(tokenizer.getErrorMessage(),expr,errorPos,errorPos,errorPos,sourceInfo);
parsed=false;
continue code;
}
newCode.add(buffer.toString());
}
return parsed;
}

Fixed version (ground truth):
/** 
 * Checks and transforms   {@code code}. If successful, results are stored in this instance and can be queried using the appropriate methods.
 * @param code the list of contract expressions to parse
 * @param lineNumbers line numbers associated with {@code code}
 * @param sourceInfo optional source information
 * @return {@code true} if there was no errors
 */
@Requires({"String_Node_Str","String_Node_Str","String_Node_Str"}) @Ensures({"String_Node_Str","String_Node_Str"}) @SuppressWarnings("String_Node_Str") public boolean transform(List<String> code,List<Long> lineNumbers,Object sourceInfo){
  oldParameters=new ArrayList<VariableModel>();
  oldParametersCode=new ArrayList<String>();
  oldParametersLineNumbers=new ArrayList<Long>();
  newCode=new ArrayList<String>();
  parsed=true;
  Iterator<Long> iterLineNumber=lineNumbers.iterator();
  code:   for (  String expr : code) {
    Long lineNumber=iterLineNumber.hasNext() ? iterLineNumber.next() : null;
    BalancedTokenizer tokenizer=new BalancedTokenizer(new StringReader(expr));
    int currentLevel=0;
    int newLevel=0;
    StringBuilder buffer=new StringBuilder();
    StringBuilder oldBuffer=null;
    String oldName=null;
    int oldContext=-1;
    ArrayDeque<Integer> impliesContext=new ArrayDeque<Integer>();
    int impliesCount=0;
    while (tokenizer.hasNext()) {
      Token token=tokenizer.next();
      newLevel=tokenizer.getCurrentLevel();
      StringBuilder currentBuffer=oldBuffer != null ? oldBuffer : buffer;
      if (newLevel == 0 && token.text.equals("String_Node_Str")) {
        diagnosticManager.error("String_Node_Str",expr,token.offset,token.offset,token.offset,sourceInfo);
        parsed=false;
        continue code;
      }
      if (newLevel < currentLevel) {
        appendImpliesTrail(currentBuffer,impliesCount);
        impliesCount=impliesContext.pop();
      }
 else       if (newLevel > currentLevel) {
        impliesContext.push(impliesCount);
        impliesCount=0;
      }
      if (oldBuffer != null) {
        if (newLevel == oldContext) {
          String oldExpr=oldBuffer.toString();
          oldParameters.add(new VariableModel(ElementKind.PARAMETER,oldName,new ClassName("String_Node_Str")));
          oldParametersCode.add(oldExpr);
          oldParametersLineNumbers.add(lineNumber);
          buffer.append("String_Node_Str");
          buffer.append(JavaUtils.BEGIN_GENERATED_CODE);
          buffer.append(MAGIC_CAST_METHOD);
          buffer.append("String_Node_Str");
          buffer.append(oldName);
          buffer.append("String_Node_Str");
          buffer.append("String_Node_Str");
          buffer.append(JavaUtils.END_GENERATED_CODE);
          buffer.append(oldExpr);
          buffer.append(JavaUtils.BEGIN_GENERATED_CODE);
          buffer.append("String_Node_Str");
          buffer.append(JavaUtils.END_GENERATED_CODE);
          buffer.append("String_Node_Str");
          oldBuffer=null;
          oldContext=-1;
        }
 else {
switch (token.kind) {
case WORD:
            if (token.text.equals("String_Node_Str")) {
              diagnosticManager.error("String_Node_Str",expr,token.offset,token.offset,token.offset,sourceInfo);
              parsed=false;
              continue code;
            }
          oldBuffer.append(token.text);
        break;
default :
      impliesCount+=transformCommon(oldBuffer,tokenizer,token);
  }
}
}
 else {
switch (token.kind) {
case WORD:
  if (acceptOld && token.text.equals("String_Node_Str")) {
    Token afterOld=null;
    if (!tokenizer.hasNext() || !((afterOld=tokenizer.next()).text.equals("String_Node_Str") || (afterOld.kind == TokenKind.SPACE && tokenizer.hasNext() && tokenizer.next().text.equals("String_Node_Str")))) {
      int errorPos=afterOld != null ? afterOld.offset : tokenizer.getCurrentOffset();
      diagnosticManager.error("String_Node_Str",expr,errorPos,errorPos,errorPos,sourceInfo);
      parsed=false;
      continue code;
    }
    oldName=JavaUtils.OLD_VARIABLE_PREFIX + oldId++;
    if (afterOld.kind == TokenKind.SPACE) {
      oldBuffer=new StringBuilder(afterOld.text);
    }
 else {
      oldBuffer=new StringBuilder();
    }
    oldContext=currentLevel;
    break;
  }
default :
impliesCount+=transformCommon(buffer,tokenizer,token);
}
}
currentLevel=newLevel;
}
appendImpliesTrail(buffer,impliesCount);
if (tokenizer.hasErrors()) {
int errorPos=tokenizer.getCurrentOffset();
diagnosticManager.error(tokenizer.getErrorMessage(),expr,errorPos,errorPos,errorPos,sourceInfo);
parsed=false;
continue code;
}
newCode.add(buffer.toString());
}
return parsed;
}