Program: 135927
Project: 135927
Buggy source:
/** 
 * Looks for line and column number in str starting at idx, and returns a 3-element array val with val[0] = the line number and val[1] = the column number, and val[2] the index at the end of the column number. It returns -1 for a number it doesn't find, and may leave val[3] off the end of the array. It works (but of course finds nothing if idx >= str.length(). This is a kludge that assumes that the line number is preceded either by " line " or by "line " that begins the error message, and that the column number is preceded by either " column " or " col ".
 */
private static final int[] findLineAndColumn(final int idx,final String message){
  int[] val={-1,-1,message.length()};
  int beginIndex=message.indexOf("String_Node_Str",idx);
  int offset=5;
  if (beginIndex != idx) {
    beginIndex=-1;
  }
  if (beginIndex == -1) {
    beginIndex=message.indexOf("String_Node_Str",idx);
    offset=6;
  }
  if (beginIndex != -1) {
    beginIndex=beginIndex + offset;
    while ((beginIndex < message.length()) && !Character.isDigit(message.charAt(beginIndex))) {
      beginIndex++;
    }
    int endIndex=beginIndex + 1;
    while ((endIndex < message.length()) && Character.isDigit(message.charAt(endIndex))) {
      endIndex++;
    }
    if (beginIndex < message.length()) {
      val[0]=Integer.parseInt(message.substring(beginIndex,endIndex));
      beginIndex=message.indexOf("String_Node_Str",endIndex);
      int colOffset=0;
      if (beginIndex != -1) {
        colOffset=8;
      }
      int otherIndex=message.indexOf("String_Node_Str",endIndex);
      if ((otherIndex != -1) && ((beginIndex == -1) || (otherIndex < beginIndex))) {
        beginIndex=otherIndex;
        colOffset=5;
      }
      if (beginIndex != -1) {
        beginIndex=beginIndex + colOffset;
        while ((beginIndex < message.length()) && !Character.isDigit(message.charAt(beginIndex))) {
          beginIndex++;
        }
        endIndex=beginIndex + 1;
        while ((endIndex < message.length()) && Character.isDigit(message.charAt(endIndex))) {
          endIndex++;
        }
        if (beginIndex < message.length()) {
          val[1]=Integer.parseInt(message.substring(beginIndex,endIndex));
          val[2]=endIndex;
        }
      }
    }
  }
  return val;
}

Fixed version (ground truth):
/** 
 * Looks for line and column number in str starting at idx, and returns a 3-element array val with val[0] = the line number and val[1] = the column number, and val[2] the index at the end of the column number. It returns -1 for a number it doesn't find, and may leave val[3] off the end of the array. It works (but of course finds nothing if idx >= str.length(). This is a kludge that assumes that the line number is preceded either by " line " or by "line " that begins the error message, and that the column number is preceded by either " column " or " col ". Bug found on 17 Oct 2010:  On some errors, SANY returns an error message with location line 2147483647, col 2147483647 to line -2147483648, col -2147483648 One such error is caused by BY DEF Foo.x' in a proof.  Such a line or column number produces a java.lang.NumberFormatException when Integer.parseInt is called to parse it.  Perhaps this should be fixed in SANY.   However, even if that were to be fixed, it seems like a good idea to catch the  exception here in case there are other cases in which SANY produces a malformed location.  So this was done by LL on 17 Oct 2010.  The fix is to return values of -1 when an exception is thrown, hoping that the comment is accurate and the return value of -1 is expected by the caller.
 */
private static final int[] findLineAndColumn(final int idx,final String message){
  int[] val={-1,-1,message.length()};
  int beginIndex=message.indexOf("String_Node_Str",idx);
  int offset=5;
  if (beginIndex != idx) {
    beginIndex=-1;
  }
  if (beginIndex == -1) {
    beginIndex=message.indexOf("String_Node_Str",idx);
    offset=6;
  }
  if (beginIndex != -1) {
    beginIndex=beginIndex + offset;
    while ((beginIndex < message.length()) && !Character.isDigit(message.charAt(beginIndex))) {
      beginIndex++;
    }
    int endIndex=beginIndex + 1;
    while ((endIndex < message.length()) && Character.isDigit(message.charAt(endIndex))) {
      endIndex++;
    }
    if (beginIndex < message.length()) {
      try {
        val[0]=Integer.parseInt(message.substring(beginIndex,endIndex));
      }
 catch (      Exception e) {
        val[0]=-1;
      }
      beginIndex=message.indexOf("String_Node_Str",endIndex);
      int colOffset=0;
      if (beginIndex != -1) {
        colOffset=8;
      }
      int otherIndex=message.indexOf("String_Node_Str",endIndex);
      if ((otherIndex != -1) && ((beginIndex == -1) || (otherIndex < beginIndex))) {
        beginIndex=otherIndex;
        colOffset=5;
      }
      if (beginIndex != -1) {
        beginIndex=beginIndex + colOffset;
        while ((beginIndex < message.length()) && !Character.isDigit(message.charAt(beginIndex))) {
          beginIndex++;
        }
        endIndex=beginIndex + 1;
        while ((endIndex < message.length()) && Character.isDigit(message.charAt(endIndex))) {
          endIndex++;
        }
        if (beginIndex < message.length()) {
          try {
            val[1]=Integer.parseInt(message.substring(beginIndex,endIndex));
          }
 catch (          Exception e) {
            val[1]=-1;
          }
          val[2]=endIndex;
        }
      }
    }
  }
  return val;
}