Program: 92467
Project: 92467
Buggy source:
/** 
 * Returns the difference score between the node and the target user agent working from right to left.
 * @param state current working state of the matching process
 * @param node
 * @return
 * @throws IOException
 */
@Override protected int getScore(MatchState state,Node node) throws IOException {
  int score=0;
  int nodeIndex=node.getCharacters().length - 1, targetIndex=node.position + node.getLength();
  if (targetIndex >= state.getTargetUserAgentArray().length) {
    score=targetIndex - state.getTargetUserAgentArray().length;
    nodeIndex-=score;
    targetIndex=state.getTargetUserAgentArray().length - 1;
  }
  while (nodeIndex >= 0 && score < state.getLowestScore()) {
    int difference=Math.abs(state.getTargetUserAgentArray()[targetIndex] - node.getCharacters()[nodeIndex]);
    if (difference != 0) {
      int numericDifference=0;
      int newNodeIndex=nodeIndex + 1;
      int newTargetIndex=targetIndex + 1;
      while (newNodeIndex < node.getLength() && newTargetIndex < state.getTargetUserAgentArray().length && getIsNumeric(state.getTargetUserAgentArray()[newTargetIndex]) && getIsNumeric(node.getCharacters()[newNodeIndex])) {
        newNodeIndex++;
        newTargetIndex++;
      }
      nodeIndex=newNodeIndex - 1;
      targetIndex=newTargetIndex - 1;
      int characters=0;
      while (nodeIndex >= 0 && getIsNumeric(state.getTargetUserAgentArray()[targetIndex]) && getIsNumeric(node.getCharacters()[nodeIndex])) {
        nodeIndex--;
        targetIndex--;
        characters++;
      }
      if (characters > 1) {
        numericDifference=Math.abs(getNumber(state.getTargetUserAgentArray(),targetIndex + 1,characters) - getNumber(node.getCharacters(),nodeIndex + 1,characters));
      }
      if (numericDifference != 0) {
        score+=numericDifference;
      }
 else {
        score+=(difference * 10);
      }
    }
    nodeIndex--;
    targetIndex--;
  }
  return score;
}

Fixed version (ground truth):
/** 
 * Returns the difference score between the node and the target user agent working from right to left.
 * @param state current working state of the matching process
 * @param node
 * @return difference score
 * @throws IOException
 */
@Override protected int getScore(MatchState state,Node node) throws IOException {
  int score=0;
  int nodeIndex=node.getCharacters().length - 1, targetIndex=node.position + node.getLength();
  if (targetIndex >= state.getTargetUserAgentArray().length) {
    score=targetIndex - state.getTargetUserAgentArray().length;
    nodeIndex-=score;
    targetIndex=state.getTargetUserAgentArray().length - 1;
  }
  while (nodeIndex >= 0 && score < state.getLowestScore()) {
    int difference=Math.abs(state.getTargetUserAgentArray()[targetIndex] - node.getCharacters()[nodeIndex]);
    if (difference != 0) {
      int numericDifference=0;
      int newNodeIndex=nodeIndex + 1;
      int newTargetIndex=targetIndex + 1;
      while (newNodeIndex < node.getLength() && newTargetIndex < state.getTargetUserAgentArray().length && BaseEntity.getIsNumeric(state.getTargetUserAgentArray()[newTargetIndex]) && BaseEntity.getIsNumeric(node.getCharacters()[newNodeIndex])) {
        newNodeIndex++;
        newTargetIndex++;
      }
      nodeIndex=newNodeIndex - 1;
      targetIndex=newTargetIndex - 1;
      int characters=0;
      while (nodeIndex >= 0 && BaseEntity.getIsNumeric(state.getTargetUserAgentArray()[targetIndex]) && BaseEntity.getIsNumeric(node.getCharacters()[nodeIndex])) {
        nodeIndex--;
        targetIndex--;
        characters++;
      }
      if (characters > 1) {
        numericDifference=Math.abs(BaseEntity.getNumber(state.getTargetUserAgentArray(),targetIndex + 1,characters) - BaseEntity.getNumber(node.getCharacters(),nodeIndex + 1,characters));
      }
      if (numericDifference != 0) {
        score+=numericDifference;
      }
 else {
        score+=(difference * 10);
      }
    }
    nodeIndex--;
    targetIndex--;
  }
  return score;
}