Program: 51563
Project: 51563
Buggy source:
/** 
 * This method parses a String and tries to find a label, opCode and all the other parts of a Command line.
 * @param symbolicOpCode Symbolic form of an operation code. 
 */
public String[] parseLine(String symbolicOpcode){
  String label="String_Node_Str";
  String opcode="String_Node_Str";
  String firstRegister="String_Node_Str";
  String addressingMode="String_Node_Str";
  String secondRegister="String_Node_Str";
  String address="String_Node_Str";
  String[] parsedLine;
  String wordTemp="String_Node_Str";
  int nextToCheck=0;
  int fieldEnd=0;
  fieldEnd=symbolicOpcode.indexOf("String_Node_Str");
  if (fieldEnd != -1) {
    symbolicOpcode=symbolicOpcode.substring(0,fieldEnd);
  }
  symbolicOpcode=symbolicOpcode.replace('\t',' ');
  symbolicOpcode=symbolicOpcode.toLowerCase();
  symbolicOpcode=symbolicOpcode.trim();
  String[] lineAsArray=symbolicOpcode.split("String_Node_Str");
  int lineAsArrayIndex=0;
  if (lineAsArrayIndex == lineAsArray.length) {
    parsedLine=new String[6];
    for (int i=0; i < parsedLine.length; ++i)     parsedLine[i]="String_Node_Str";
    return parsedLine;
  }
  wordTemp=lineAsArray[lineAsArrayIndex];
  if (symbolicInterpreter.getOpcode(wordTemp) == -1) {
    if (!validLabelName(wordTemp))     return null;
    label=wordTemp;
    ++lineAsArrayIndex;
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    opcode=lineAsArray[lineAsArrayIndex];
    ++lineAsArrayIndex;
    if (symbolicInterpreter.getOpcode(opcode) < 0) {
      return null;
    }
  }
 else {
    return null;
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    if (lineAsArray[lineAsArrayIndex].charAt(lineAsArray[lineAsArrayIndex].length() - 1) == ',') {
      if (symbolicInterpreter.getRegisterId(lineAsArray[lineAsArrayIndex].substring(0,lineAsArray[lineAsArrayIndex].length() - 1)) != -1) {
        firstRegister=lineAsArray[lineAsArrayIndex].substring(0,lineAsArray[lineAsArrayIndex].length() - 1);
        ++lineAsArrayIndex;
      }
    }
 else {
      if (symbolicInterpreter.getRegisterId(lineAsArray[lineAsArrayIndex]) != -1) {
        firstRegister=lineAsArray[lineAsArrayIndex];
        ++lineAsArrayIndex;
      }
    }
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    if (lineAsArray[lineAsArrayIndex].charAt(0) == '=' || lineAsArray[lineAsArrayIndex].charAt(0) == '@') {
      addressingMode="String_Node_Str" + lineAsArray[lineAsArrayIndex].charAt(0);
    }
 else {
      addressingMode="String_Node_Str";
    }
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    if (lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str") != -1) {
      if (lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str") < lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str")) {
        return null;
      }
 else {
        address=lineAsArray[lineAsArrayIndex].substring(addressingMode.length(),lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str"));
        secondRegister=lineAsArray[lineAsArrayIndex].substring(lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str") + 1,lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str"));
        if (symbolicInterpreter.getRegisterId(secondRegister) == -1) {
          return null;
        }
      }
    }
 else {
      address=lineAsArray[lineAsArrayIndex].substring(addressingMode.length());
    }
  }
  if (symbolicInterpreter.getRegisterId(address) != -1) {
    secondRegister=address;
    address="String_Node_Str";
  }
  if (opcode.length() > 0) {
    if (opcode.charAt(0) == 'j' || opcode.charAt(0) == 'J') {
      if (opcode.toLowerCase().matches("String_Node_Str" + "String_Node_Str" + "String_Node_Str")) {
        if (firstRegister.equals("String_Node_Str"))         return null;
      }
      if (addressingMode.equals("String_Node_Str") || address.equals("String_Node_Str"))       return null;
    }
 else {
      if (opcode.equalsIgnoreCase("String_Node_Str")) {
      }
 else {
        if (opcode.equalsIgnoreCase("String_Node_Str")) {
          if (addressingMode.equals("String_Node_Str") || addressingMode.equals("String_Node_Str") || !address.equals("String_Node_Str"))           return null;
        }
 else {
          if (firstRegister.equals("String_Node_Str") || (address.equals("String_Node_Str") && secondRegister.equals("String_Node_Str")))           return null;
        }
      }
    }
  }
  if (addressingMode.equals("String_Node_Str") && address.equals("String_Node_Str"))   return null;
  if (opcode.equalsIgnoreCase("String_Node_Str") && address.equals("String_Node_Str"))   return null;
  if (opcode.equalsIgnoreCase("String_Node_Str") && addressingMode.equals("String_Node_Str"))   return null;
  if (opcode.equals("String_Node_Str") && (!label.equals("String_Node_Str") || !firstRegister.equals("String_Node_Str") || !addressingMode.equals("String_Node_Str")|| !address.equals("String_Node_Str")|| !secondRegister.equals("String_Node_Str"))) {
    return null;
  }
  parsedLine=new String[6];
  parsedLine[0]=label.trim();
  parsedLine[1]=opcode.trim();
  parsedLine[2]=firstRegister.trim();
  parsedLine[3]=addressingMode.trim();
  parsedLine[4]=address.trim();
  parsedLine[5]=secondRegister.trim();
  return parsedLine;
}

Fixed version (ground truth):
/** 
 * This method parses a String and tries to find a label, opCode and all the other parts of a Command line.
 * @param symbolicOpCode Symbolic form of an operation code. 
 */
public String[] parseLine(String symbolicOpcode){
  String label="String_Node_Str";
  String opcode="String_Node_Str";
  String firstRegister="String_Node_Str";
  String addressingMode="String_Node_Str";
  String secondRegister="String_Node_Str";
  String address="String_Node_Str";
  String[] parsedLine;
  String wordTemp="String_Node_Str";
  int nextToCheck=0;
  int fieldEnd=0;
  fieldEnd=symbolicOpcode.indexOf("String_Node_Str");
  if (fieldEnd != -1) {
    symbolicOpcode=symbolicOpcode.substring(0,fieldEnd);
  }
  symbolicOpcode=symbolicOpcode.replace('\t',' ');
  symbolicOpcode=symbolicOpcode.toLowerCase();
  symbolicOpcode=symbolicOpcode.trim();
  if (symbolicOpcode.length() == 0) {
    parsedLine=new String[6];
    for (int i=0; i < parsedLine.length; ++i)     parsedLine[i]="String_Node_Str";
    return parsedLine;
  }
  String[] lineAsArray=symbolicOpcode.split("String_Node_Str");
  int lineAsArrayIndex=0;
  wordTemp=lineAsArray[lineAsArrayIndex];
  if (symbolicInterpreter.getOpcode(wordTemp) == -1) {
    if (!validLabelName(wordTemp))     return null;
    label=wordTemp;
    ++lineAsArrayIndex;
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    opcode=lineAsArray[lineAsArrayIndex];
    ++lineAsArrayIndex;
    if (symbolicInterpreter.getOpcode(opcode) < 0) {
      return null;
    }
  }
 else {
    return null;
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    if (lineAsArray[lineAsArrayIndex].charAt(lineAsArray[lineAsArrayIndex].length() - 1) == ',') {
      if (symbolicInterpreter.getRegisterId(lineAsArray[lineAsArrayIndex].substring(0,lineAsArray[lineAsArrayIndex].length() - 1)) != -1) {
        firstRegister=lineAsArray[lineAsArrayIndex].substring(0,lineAsArray[lineAsArrayIndex].length() - 1);
        ++lineAsArrayIndex;
      }
    }
 else {
      if (symbolicInterpreter.getRegisterId(lineAsArray[lineAsArrayIndex]) != -1) {
        firstRegister=lineAsArray[lineAsArrayIndex];
        ++lineAsArrayIndex;
      }
    }
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    if (lineAsArray[lineAsArrayIndex].charAt(0) == '=' || lineAsArray[lineAsArrayIndex].charAt(0) == '@') {
      addressingMode="String_Node_Str" + lineAsArray[lineAsArrayIndex].charAt(0);
    }
 else {
      addressingMode="String_Node_Str";
    }
  }
  if (lineAsArrayIndex < lineAsArray.length) {
    if (lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str") != -1) {
      if (lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str") < lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str")) {
        return null;
      }
 else {
        address=lineAsArray[lineAsArrayIndex].substring(addressingMode.length(),lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str"));
        secondRegister=lineAsArray[lineAsArrayIndex].substring(lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str") + 1,lineAsArray[lineAsArrayIndex].indexOf("String_Node_Str"));
        if (symbolicInterpreter.getRegisterId(secondRegister) == -1) {
          return null;
        }
      }
    }
 else {
      address=lineAsArray[lineAsArrayIndex].substring(addressingMode.length());
    }
  }
  if (symbolicInterpreter.getRegisterId(address) != -1) {
    secondRegister=address;
    address="String_Node_Str";
  }
  if (opcode.length() > 0) {
    if (opcode.charAt(0) == 'j' || opcode.charAt(0) == 'J') {
      if (opcode.toLowerCase().matches("String_Node_Str" + "String_Node_Str" + "String_Node_Str")) {
        if (firstRegister.equals("String_Node_Str"))         return null;
      }
      if (addressingMode.equals("String_Node_Str") || address.equals("String_Node_Str"))       return null;
    }
 else {
      if (opcode.equalsIgnoreCase("String_Node_Str")) {
      }
 else {
        if (opcode.equalsIgnoreCase("String_Node_Str")) {
          if (addressingMode.equals("String_Node_Str") || addressingMode.equals("String_Node_Str") || !address.equals("String_Node_Str"))           return null;
        }
 else {
          if (firstRegister.equals("String_Node_Str") || (address.equals("String_Node_Str") && secondRegister.equals("String_Node_Str")))           return null;
        }
      }
    }
  }
  if (addressingMode.equals("String_Node_Str") && address.equals("String_Node_Str"))   return null;
  if (opcode.equalsIgnoreCase("String_Node_Str") && address.equals("String_Node_Str"))   return null;
  if (opcode.equalsIgnoreCase("String_Node_Str") && addressingMode.equals("String_Node_Str"))   return null;
  if (opcode.equals("String_Node_Str") && (!label.equals("String_Node_Str") || !firstRegister.equals("String_Node_Str") || !addressingMode.equals("String_Node_Str")|| !address.equals("String_Node_Str")|| !secondRegister.equals("String_Node_Str"))) {
    return null;
  }
  parsedLine=new String[6];
  parsedLine[0]=label.trim();
  parsedLine[1]=opcode.trim();
  parsedLine[2]=firstRegister.trim();
  parsedLine[3]=addressingMode.trim();
  parsedLine[4]=address.trim();
  parsedLine[5]=secondRegister.trim();
  return parsedLine;
}