Program: 168723
Project: 168723
Buggy source:
/** 
 * Parses the byte array for json data and create lazy objects
 * @param bts byte array
 * @param start start offset
 * @param end the end index
 * @param events JSONListener, all events will be sent to this instance.
 */
public static final int lazyParse(final char[] bts,final int start,final int end,final JSONListener events){
  final int btsLen=end;
  char bt;
  int idx=CharArrayTool.skipWhiteSpace(bts,start,btsLen);
  bt=CharArrayTool.getChar(bts,idx);
  if (bt == '{') {
    events.objectStart();
    int strStart=CharArrayTool.indexOf(bts,idx + 1,end,'"') + 1;
    idx=CharArrayTool.endOfString(bts,strStart,end);
    events.string(StringUtil.fastToString(bts,strStart,idx - strStart));
    idx=CharArrayTool.indexOf(bts,idx + 1,end,':');
    idx++;
  }
 else   if (bt == '[') {
    events.arrStart();
    idx=CharArrayTool.skipWhiteSpace(bts,idx + 1,btsLen);
  }
 else   throw new RuntimeException("String_Node_Str" + bt);
  if (idx >= btsLen) {
    events.objectEnd();
    return btsLen;
  }
  int endIndex;
  for (; idx < btsLen; idx++) {
    idx=CharArrayTool.skipWhiteSpace(bts,idx,btsLen);
    bt=CharArrayTool.getChar(bts,idx);
switch (bt) {
case '"':
      final int strStart2=idx + 1;
    idx=CharArrayTool.endOfString(bts,strStart2,end);
  events.string(StringUtil.fastToString(bts,strStart2,idx - strStart2));
break;
case '-':
idx++;
bt=CharArrayTool.getChar(bts,idx);
if (Character.isDigit(bt)) {
endIndex=CharArrayTool.indexFirstNonNumeric(bts,idx,end);
if (bts[endIndex] == '.') {
idx--;
int idx2=CharArrayTool.indexFirstNonNumeric(bts,endIndex + 1,end);
parseDouble(bts,idx,idx2,events);
idx=idx2 - 1;
}
 else {
parseInt(bts,idx,endIndex,events,true);
idx=endIndex - 1;
}
}
break;
case 'F':
events.number(Boolean.FALSE);
idx+=4;
break;
case 'T':
events.number(Boolean.TRUE);
idx+=3;
break;
case '[':
endIndex=CharArrayTool.indexOfEndOfObject(bts,idx + 1,btsLen,'[',']');
events.lazyArr(bts,idx,endIndex);
idx=endIndex;
break;
case 'f':
events.number(Boolean.FALSE);
idx+=4;
break;
case '}':
events.objectEnd();
break;
case 'n':
events.string(null);
idx+=3;
break;
case 't':
events.number(Boolean.TRUE);
idx+=3;
break;
case '{':
endIndex=CharArrayTool.indexOfEndOfObject(bts,idx + 1,btsLen,'{','}');
events.lazyObject(bts,idx,endIndex);
idx=endIndex;
break;
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
endIndex=CharArrayTool.indexFirstNonNumeric(bts,idx,end);
if (bts[endIndex] == '.') {
int idx2=CharArrayTool.indexFirstNonNumeric(bts,endIndex + 1,end);
parseDouble(bts,idx,idx2,events);
idx=idx2 - 1;
}
 else {
parseInt(bts,idx,endIndex,events,false);
idx=endIndex - 1;
}
break;
default :
break;
}
}
return idx;
}

Fixed version (ground truth):
/** 
 * Parses the byte array for json data and create lazy objects
 * @param bts byte array
 * @param start start offset
 * @param end the end index
 * @param events JSONListener, all events will be sent to this instance.
 */
public static final int lazyParse(final char[] bts,final int start,final int end,final JSONListener events){
  final int btsLen=end;
  char bt;
  int idx=CharArrayTool.skipWhiteSpace(bts,start,btsLen);
  bt=CharArrayTool.getChar(bts,idx);
  if (bt == '{') {
    events.objectStart();
    int strStart=CharArrayTool.indexOf(bts,idx + 1,end,'"') + 1;
    idx=CharArrayTool.endOfString(bts,strStart,end);
    events.string(StringUtil.fastToString(bts,strStart,idx - strStart));
    idx=CharArrayTool.indexOf(bts,idx + 1,end,':');
    idx++;
  }
 else   if (bt == '[') {
    events.arrStart();
    idx=CharArrayTool.skipWhiteSpace(bts,idx + 1,btsLen);
  }
 else   throw new RuntimeException("String_Node_Str" + bt);
  if (idx >= btsLen) {
    events.objectEnd();
    return btsLen;
  }
  int endIndex;
  for (; idx < btsLen; idx++) {
    idx=CharArrayTool.skipWhiteSpace(bts,idx,btsLen);
    bt=CharArrayTool.getChar(bts,idx);
switch (bt) {
case '"':
      final int strStart2=idx + 1;
    idx=CharArrayTool.endOfString(bts,strStart2,end);
  events.string(StringUtil.fastToString(bts,strStart2,idx - strStart2));
break;
case '-':
idx++;
bt=CharArrayTool.getChar(bts,idx);
if (Character.isDigit(bt)) {
endIndex=CharArrayTool.indexFirstNonNumeric(bts,idx,end);
if (bts[endIndex] == '.') {
idx--;
int idx2=CharArrayTool.indexFirstNonNumeric(bts,endIndex + 1,end);
parseDouble(bts,idx,idx2,events);
idx=idx2 - 1;
}
 else {
parseInt(bts,idx,endIndex,events,true);
idx=endIndex - 1;
}
}
break;
case 'F':
events.number(Boolean.FALSE);
idx+=4;
break;
case 'T':
events.number(Boolean.TRUE);
idx+=3;
break;
case '[':
endIndex=CharArrayTool.indexOfEndOfList(bts,idx + 1,btsLen);
events.lazyArr(bts,idx,endIndex);
idx=endIndex;
break;
case 'f':
events.number(Boolean.FALSE);
idx+=4;
break;
case '}':
events.objectEnd();
break;
case 'n':
events.string(null);
idx+=3;
break;
case 't':
events.number(Boolean.TRUE);
idx+=3;
break;
case '{':
endIndex=CharArrayTool.indexOfEndOfObject(bts,idx + 1,btsLen);
events.lazyObject(bts,idx,endIndex);
idx=endIndex;
break;
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
endIndex=CharArrayTool.indexFirstNonNumeric(bts,idx,end);
if (bts[endIndex] == '.') {
int idx2=CharArrayTool.indexFirstNonNumeric(bts,endIndex + 1,end);
parseDouble(bts,idx,idx2,events);
idx=idx2 - 1;
}
 else {
parseInt(bts,idx,endIndex,events,false);
idx=endIndex - 1;
}
break;
default :
break;
}
}
return idx;
}