Program: 65716
Project: 65716
Buggy source:
private void parse(Tree tree) throws SAXException {
switch (tree.getType()) {
case JSONLexer.PAIR:
{
      Tree valueTree=tree.getChild(1);
      if (valueTree.getType() == JSONLexer.ARRAY) {
        parse(valueTree);
      }
 else {
        Tree stringTree=tree.getChild(0);
        String localName=stringTree.getText().substring(1,stringTree.getText().length() - 1);
        contentHandler.startElement("String_Node_Str",localName,localName,attributes.setTree(valueTree));
        parse(valueTree);
        contentHandler.endElement("String_Node_Str",localName,localName);
      }
      break;
    }
case JSONLexer.STRING:
{
    String string=string(tree.getChild(0).getText());
    contentHandler.characters(string);
    break;
  }
case JSONLexer.NUMBER:
{
  contentHandler.characters(tree.getChild(0).getText());
  break;
}
case JSONLexer.TRUE:
{
contentHandler.characters(TRUE);
break;
}
case JSONLexer.FALSE:
{
contentHandler.characters(FALSE);
break;
}
case JSONLexer.NULL:
{
break;
}
case JSONLexer.ARRAY:
{
Tree parentStringTree=tree.getParent().getChild(0);
String parentLocalName=parentStringTree.getText().substring(1,parentStringTree.getText().length() - 1);
for (int x=0, size=tree.getChildCount(); x < size; x++) {
CommonTree nextChildTree=(CommonTree)tree.getChild(x);
contentHandler.startElement("String_Node_Str",parentLocalName,parentLocalName,attributes.setTree(nextChildTree));
parse(nextChildTree);
contentHandler.endElement("String_Node_Str",parentLocalName,parentLocalName);
}
break;
}
default :
{
for (int x=0, size=tree.getChildCount(); x < size; x++) {
parse((CommonTree)tree.getChild(x));
}
}
}
}

Fixed version (ground truth):
private void parse(Tree tree) throws SAXException {
switch (tree.getType()) {
case JSONLexer.PAIR:
{
      Tree valueTree=tree.getChild(1);
      if (valueTree.getType() == JSONLexer.ARRAY) {
        parse(valueTree);
      }
 else {
        Tree stringTree=tree.getChild(0);
        String localName=stringTree.getText().substring(1,stringTree.getText().length() - 1);
        if (attributePrefix != null && localName.startsWith(attributePrefix)) {
          break;
        }
 else {
          contentHandler.startElement("String_Node_Str",localName,localName,attributes.setTree(valueTree,attributePrefix));
        }
        parse(valueTree);
        contentHandler.endElement("String_Node_Str",localName,localName);
      }
      break;
    }
case JSONLexer.STRING:
{
    String string=string(tree.getChild(0).getText());
    contentHandler.characters(string);
    break;
  }
case JSONLexer.NUMBER:
{
  contentHandler.characters(tree.getChild(0).getText());
  break;
}
case JSONLexer.TRUE:
{
contentHandler.characters(TRUE);
break;
}
case JSONLexer.FALSE:
{
contentHandler.characters(FALSE);
break;
}
case JSONLexer.NULL:
{
break;
}
case JSONLexer.ARRAY:
{
Tree parentStringTree=tree.getParent().getChild(0);
String parentLocalName=parentStringTree.getText().substring(1,parentStringTree.getText().length() - 1);
for (int x=0, size=tree.getChildCount(); x < size; x++) {
CommonTree nextChildTree=(CommonTree)tree.getChild(x);
contentHandler.startElement("String_Node_Str",parentLocalName,parentLocalName,attributes.setTree(nextChildTree,attributePrefix));
parse(nextChildTree);
contentHandler.endElement("String_Node_Str",parentLocalName,parentLocalName);
}
break;
}
default :
{
for (int x=0, size=tree.getChildCount(); x < size; x++) {
parse((CommonTree)tree.getChild(x));
}
}
}
}