Program: 65728
Project: 65728
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);
        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));
}
}
}
}

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;
        }
        String uri=XMLConstants.EMPTY_STRING;
        if (namespaceAware && namespaces != null) {
          int nsIndex=localName.indexOf(namespaceSeperator);
          if (nsIndex > -1) {
            String prefix=localName.substring(0,nsIndex);
            localName=localName.substring(nsIndex + namespaceSeperator.length());
            uri=namespaces.resolveNamespacePrefix(prefix);
          }
        }
        contentHandler.startElement(uri,localName,localName,attributes.setTree(valueTree,attributePrefix,namespaces,namespaceSeperator,namespaceAware));
        parse(valueTree);
        contentHandler.endElement(uri,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);
String uri=XMLConstants.EMPTY_STRING;
if (namespaceAware && namespaces != null) {
int nsIndex=parentLocalName.indexOf(namespaceSeperator);
if (nsIndex > -1) {
String prefix=parentLocalName.substring(0,nsIndex);
parentLocalName=parentLocalName.substring(nsIndex + namespaceSeperator.length());
uri=namespaces.resolveNamespacePrefix(prefix);
}
}
for (int x=0, size=tree.getChildCount(); x < size; x++) {
CommonTree nextChildTree=(CommonTree)tree.getChild(x);
contentHandler.startElement(uri,parentLocalName,parentLocalName,attributes.setTree(nextChildTree,attributePrefix,namespaces,namespaceSeperator,namespaceAware));
parse(nextChildTree);
contentHandler.endElement(uri,parentLocalName,parentLocalName);
}
break;
}
default :
{
for (int x=0, size=tree.getChildCount(); x < size; x++) {
parse((CommonTree)tree.getChild(x));
}
}
}
}