Program: 146746
Project: 146746
Buggy source:
public Detail parse() throws InvalidStructureException, IOException, XmlPullParserException {
  checkNode("String_Node_Str");
  String id=parser.getAttributeValue(null,"String_Node_Str");
  Text background=new Text();
  getNextTagInBlock("String_Node_Str");
  checkNode("String_Node_Str");
  String titleForm=parser.getAttributeValue(null,"String_Node_Str");
  getNextTagInBlock("String_Node_Str");
  Text title=new TextParser(parser).parse();
  Action action=null;
  Vector<Detail> subdetails=new Vector<Detail>();
  Vector<DetailField> fields=new Vector<DetailField>();
  OrderedHashtable<String,String> variables=new OrderedHashtable<String,String>();
  while (nextTagInBlock("String_Node_Str")) {
    if ("String_Node_Str".equals(parser.getName().toLowerCase())) {
      while (nextTagInBlock("String_Node_Str")) {
        String function=parser.getAttributeValue(null,"String_Node_Str");
        if (function == null) {
          throw new InvalidStructureException("String_Node_Str" + parser.getName(),parser);
        }
        try {
          XPathParseTool.parseXPath(function);
        }
 catch (        XPathSyntaxException e) {
          e.printStackTrace();
          throw new InvalidStructureException("String_Node_Str" + function + "String_Node_Str"+ e.getMessage(),parser);
        }
        variables.put(parser.getName(),function);
      }
      continue;
    }
    if (ActionParser.NAME_ACTION.equalsIgnoreCase(parser.getName())) {
      action=new ActionParser(parser).parse();
      continue;
    }
    DetailField.Builder builder=new DetailField().new Builder();
    if (parser.getName().equals("String_Node_Str")) {
      subdetails.addElement((new DetailParser(parser)).parse());
    }
 else {
      checkNode("String_Node_Str");
      String sortDefault=parser.getAttributeValue(null,"String_Node_Str");
      if (sortDefault != null && sortDefault.equals("String_Node_Str")) {
        builder.setSortOrder(1);
      }
      String relevancy=parser.getAttributeValue(null,"String_Node_Str");
      if (relevancy != null) {
        try {
          XPathParseTool.parseXPath(relevancy);
          builder.setRelevancy(relevancy);
        }
 catch (        XPathSyntaxException e) {
          e.printStackTrace();
          throw new InvalidStructureException("String_Node_Str" + relevancy + "String_Node_Str",parser);
        }
      }
      if (nextTagInBlock("String_Node_Str")) {
        if (parser.getName().toLowerCase().equals("String_Node_Str")) {
          StyleParser styleParser=new StyleParser(builder,parser);
          styleParser.parse();
          GridParser gridParser=new GridParser(builder,parser);
          gridParser.parse();
          parser.nextTag();
          parser.nextTag();
        }
        checkNode("String_Node_Str");
        builder.setHeaderHint(getWidth());
        String form=parser.getAttributeValue(null,"String_Node_Str");
        builder.setHeaderForm(form == null ? "String_Node_Str" : form);
        parser.nextTag();
        checkNode("String_Node_Str");
        Text header=new TextParser(parser).parse();
        builder.setHeader(header);
      }
 else {
        throw new InvalidStructureException("String_Node_Str",parser);
      }
      if (nextTagInBlock("String_Node_Str")) {
        checkNode("String_Node_Str");
        builder.setTemplateHint(getWidth());
        String form=parser.getAttributeValue(null,"String_Node_Str");
        if (form == null) {
          form="String_Node_Str";
        }
        builder.setTemplateForm(form);
        parser.nextTag();
        DetailTemplate template;
        if (form.equals("String_Node_Str")) {
          template=new GraphParser(parser).parse();
        }
 else {
          checkNode("String_Node_Str");
          template=new TextParser(parser).parse();
        }
        builder.setTemplate(template);
      }
 else {
        throw new InvalidStructureException("String_Node_Str",parser);
      }
      if (nextTagInBlock("String_Node_Str")) {
        checkNode(new String[]{"String_Node_Str","String_Node_Str"});
        String name=parser.getName().toLowerCase();
        if (name.equals("String_Node_Str")) {
          String order=parser.getAttributeValue(null,"String_Node_Str");
          if (order != null && order != "String_Node_Str") {
            try {
              builder.setSortOrder(Integer.parseInt(order));
            }
 catch (            NumberFormatException nfe) {
            }
          }
          String direction=parser.getAttributeValue(null,"String_Node_Str");
          if ("String_Node_Str".equals(direction)) {
            builder.setSortDirection(DetailField.DIRECTION_ASCENDING);
          }
 else           if ("String_Node_Str".equals(direction)) {
            builder.setSortDirection(DetailField.DIRECTION_DESCENDING);
          }
 else {
          }
          String type=parser.getAttributeValue(null,"String_Node_Str");
          if ("String_Node_Str".equals(type)) {
            builder.setSortType(Constants.DATATYPE_INTEGER);
          }
 else           if ("String_Node_Str".equals(type)) {
            builder.setSortType(Constants.DATATYPE_DECIMAL);
          }
 else           if ("String_Node_Str".equals(type)) {
            builder.setSortType(Constants.DATATYPE_TEXT);
          }
 else {
          }
          if (nextTagInBlock("String_Node_Str")) {
            checkNode("String_Node_Str");
            Text sort=new TextParser(parser).parse();
            builder.setSort(sort);
          }
        }
 else         if (name.equals("String_Node_Str")) {
          if (nextTagInBlock("String_Node_Str")) {
            checkNode("String_Node_Str");
            background=new TextParser(parser).parse();
            builder.setBackground(background);
          }
        }
      }
      fields.addElement(builder.build());
    }
  }
  Detail d=new Detail(id,title,titleForm,subdetails,fields,variables,action);
  return d;
}

Fixed version (ground truth):
public Detail parse() throws InvalidStructureException, IOException, XmlPullParserException {
  checkNode("String_Node_Str");
  String id=parser.getAttributeValue(null,"String_Node_Str");
  Text background=new Text();
  getNextTagInBlock("String_Node_Str");
  checkNode("String_Node_Str");
  String titleForm=parser.getAttributeValue(null,"String_Node_Str");
  getNextTagInBlock("String_Node_Str");
  Text title=new TextParser(parser).parse();
  Action action=null;
  Vector<Detail> subdetails=new Vector<Detail>();
  Vector<DetailField> fields=new Vector<DetailField>();
  OrderedHashtable<String,String> variables=new OrderedHashtable<String,String>();
  while (nextTagInBlock("String_Node_Str")) {
    if ("String_Node_Str".equals(parser.getName().toLowerCase())) {
      while (nextTagInBlock("String_Node_Str")) {
        String function=parser.getAttributeValue(null,"String_Node_Str");
        if (function == null) {
          throw new InvalidStructureException("String_Node_Str" + parser.getName(),parser);
        }
        try {
          XPathParseTool.parseXPath(function);
        }
 catch (        XPathSyntaxException e) {
          e.printStackTrace();
          throw new InvalidStructureException("String_Node_Str" + function + "String_Node_Str"+ e.getMessage(),parser);
        }
        variables.put(parser.getName(),function);
      }
      continue;
    }
    if (ActionParser.NAME_ACTION.equalsIgnoreCase(parser.getName())) {
      action=new ActionParser(parser).parse();
      continue;
    }
    DetailField.Builder builder=new DetailField().new Builder();
    if (parser.getName().equals("String_Node_Str")) {
      subdetails.addElement((new DetailParser(parser)).parse());
    }
 else {
      checkNode("String_Node_Str");
      String sortDefault=parser.getAttributeValue(null,"String_Node_Str");
      if (sortDefault != null && sortDefault.equals("String_Node_Str")) {
        builder.setSortOrder(1);
      }
      String relevancy=parser.getAttributeValue(null,"String_Node_Str");
      if (relevancy != null) {
        try {
          XPathParseTool.parseXPath(relevancy);
          builder.setRelevancy(relevancy);
        }
 catch (        XPathSyntaxException e) {
          e.printStackTrace();
          throw new InvalidStructureException("String_Node_Str" + relevancy + "String_Node_Str",parser);
        }
      }
      if (nextTagInBlock("String_Node_Str")) {
        if (parser.getName().toLowerCase().equals("String_Node_Str")) {
          StyleParser styleParser=new StyleParser(builder,parser);
          styleParser.parse();
          GridParser gridParser=new GridParser(builder,parser);
          gridParser.parse();
          parser.nextTag();
          parser.nextTag();
        }
        checkNode("String_Node_Str");
        builder.setHeaderHint(getWidth());
        String form=parser.getAttributeValue(null,"String_Node_Str");
        builder.setHeaderForm(form == null ? "String_Node_Str" : form);
        parser.nextTag();
        checkNode("String_Node_Str");
        Text header=new TextParser(parser).parse();
        builder.setHeader(header);
      }
 else {
        throw new InvalidStructureException("String_Node_Str",parser);
      }
      if (nextTagInBlock("String_Node_Str")) {
        checkNode("String_Node_Str");
        builder.setTemplateHint(getWidth());
        String form=parser.getAttributeValue(null,"String_Node_Str");
        if (form == null) {
          form="String_Node_Str";
        }
        builder.setTemplateForm(form);
        parser.nextTag();
        DetailTemplate template;
        if (form.equals("String_Node_Str")) {
          template=new GraphParser(parser).parse();
        }
 else {
          checkNode("String_Node_Str");
          try {
            template=new TextParser(parser).parse();
            builder.setTemplate(template);
          }
 catch (          InvalidStructureException ise) {
            throw new InvalidStructureException("String_Node_Str" + id + "String_Node_Str"+ ise.getMessage(),parser);
          }
        }
      }
 else {
        throw new InvalidStructureException("String_Node_Str",parser);
      }
      if (nextTagInBlock("String_Node_Str")) {
        checkNode(new String[]{"String_Node_Str","String_Node_Str"});
        String name=parser.getName().toLowerCase();
        if (name.equals("String_Node_Str")) {
          String order=parser.getAttributeValue(null,"String_Node_Str");
          if (order != null && order != "String_Node_Str") {
            try {
              builder.setSortOrder(Integer.parseInt(order));
            }
 catch (            NumberFormatException nfe) {
            }
          }
          String direction=parser.getAttributeValue(null,"String_Node_Str");
          if ("String_Node_Str".equals(direction)) {
            builder.setSortDirection(DetailField.DIRECTION_ASCENDING);
          }
 else           if ("String_Node_Str".equals(direction)) {
            builder.setSortDirection(DetailField.DIRECTION_DESCENDING);
          }
 else {
          }
          String type=parser.getAttributeValue(null,"String_Node_Str");
          if ("String_Node_Str".equals(type)) {
            builder.setSortType(Constants.DATATYPE_INTEGER);
          }
 else           if ("String_Node_Str".equals(type)) {
            builder.setSortType(Constants.DATATYPE_DECIMAL);
          }
 else           if ("String_Node_Str".equals(type)) {
            builder.setSortType(Constants.DATATYPE_TEXT);
          }
 else {
          }
          if (nextTagInBlock("String_Node_Str")) {
            checkNode("String_Node_Str");
            Text sort=new TextParser(parser).parse();
            builder.setSort(sort);
          }
        }
 else         if (name.equals("String_Node_Str")) {
          if (nextTagInBlock("String_Node_Str")) {
            checkNode("String_Node_Str");
            background=new TextParser(parser).parse();
            builder.setBackground(background);
          }
        }
      }
      fields.addElement(builder.build());
    }
  }
  Detail d=new Detail(id,title,titleForm,subdetails,fields,variables,action);
  return d;
}