Program: 146675
Project: 146675
Buggy source:
public Case parse() throws InvalidStructureException, IOException, XmlPullParserException {
  this.checkNode("String_Node_Str");
  String caseId=parser.getAttributeValue(null,"String_Node_Str");
  if (caseId == null || caseId.equals("String_Node_Str")) {
    throw new InvalidStructureException("String_Node_Str",this.parser);
  }
  String dateModified=parser.getAttributeValue(null,"String_Node_Str");
  if (dateModified == null) {
    throw new InvalidStructureException("String_Node_Str",this.parser);
  }
  Date modified=DateUtils.parseDateTime(dateModified);
  boolean create=false;
  boolean update=false;
  boolean close=false;
  Case caseForBlock=null;
  while (this.nextTagInBlock("String_Node_Str")) {
    String action=parser.getName().toLowerCase();
    if (action.equals("String_Node_Str")) {
      String[] data=new String[3];
      while (this.nextTagInBlock("String_Node_Str")) {
        if (parser.getName().equals("String_Node_Str")) {
          data[0]=parser.nextText().trim();
        }
 else         if (parser.getName().equals("String_Node_Str")) {
          data[1]=parser.nextText().trim();
        }
 else         if (parser.getName().equals("String_Node_Str")) {
          data[2]=parser.nextText().trim();
        }
 else {
          throw new InvalidStructureException("String_Node_Str" + parser.getName(),parser);
        }
      }
      if (data[0] == null || data[2] == null) {
        throw new InvalidStructureException("String_Node_Str" + caseId,parser);
      }
      boolean overriden=false;
      if (acceptCreateOverwrites) {
        caseForBlock=retrieve(caseId);
        if (caseForBlock != null) {
          caseForBlock.setName(data[2]);
          caseForBlock.setTypeId(data[0]);
          overriden=true;
        }
      }
      if (caseForBlock == null) {
        caseForBlock=CreateCase(data[2],data[0]);
        caseForBlock.setCaseId(caseId);
        caseForBlock.setDateOpened(modified);
      }
      if (data[1] != null) {
        caseForBlock.setUserId(data[1]);
      }
      create=true;
      String succesfulAction=overriden ? "String_Node_Str" : "String_Node_Str";
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      if (caseForBlock == null) {
        throw new InvalidStructureException("String_Node_Str" + caseId,parser);
      }
      while (this.nextTagInBlock("String_Node_Str")) {
        String key=parser.getName();
        String value=parser.nextText().trim();
        if (key.equals("String_Node_Str")) {
          caseForBlock.setTypeId(value);
        }
 else         if (key.equals("String_Node_Str")) {
          caseForBlock.setName(value);
        }
 else         if (key.equals("String_Node_Str")) {
          caseForBlock.setDateOpened(DateUtils.parseDate(value));
        }
 else         if (key.equals("String_Node_Str")) {
          caseForBlock.setUserId(value);
        }
 else {
          caseForBlock.setProperty(key,value);
        }
      }
      update=true;
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      if (caseForBlock == null) {
        throw new InvalidStructureException("String_Node_Str" + caseId,parser);
      }
      caseForBlock.setClosed(true);
      commit(caseForBlock);
      close=true;
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      while (this.nextTagInBlock("String_Node_Str")) {
        String indexName=parser.getName();
        String caseType=parser.getAttributeValue(null,"String_Node_Str");
        String value=parser.nextText().trim();
        if (value.equals(caseId)) {
          throw new InvalidStructureException("String_Node_Str" + caseId + "String_Node_Str",parser);
        }
        if (value.equals("String_Node_Str")) {
          value=null;
        }
        String relationship=parser.getAttributeValue(null,"String_Node_Str");
        if (relationship == null) {
          relationship=CaseIndex.RELATIONSHIP_CHILD;
        }
        if (value == null) {
          caseForBlock.removeIndex(indexName);
        }
 else {
          caseForBlock.setIndex(new CaseIndex(indexName,caseType,value,relationship));
        }
      }
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      while (this.nextTagInBlock("String_Node_Str")) {
        String attachmentName=parser.getName();
        String src=parser.getAttributeValue(null,"String_Node_Str");
        String from=parser.getAttributeValue(null,"String_Node_Str");
        String fileName=parser.getAttributeValue(null,"String_Node_Str");
        if ((src == null || "String_Node_Str".equals(src)) && (from == null || "String_Node_Str".equals(from))) {
          this.removeAttachment(caseForBlock,attachmentName);
          caseForBlock.removeAttachment(attachmentName);
          continue;
        }
        String reference=this.processAttachment(src,from,fileName,parser);
        if (reference != null) {
          caseForBlock.updateAttachment(attachmentName,reference);
        }
      }
    }
  }
  if (caseForBlock != null) {
    caseForBlock.setLastModified(modified);
    commit(caseForBlock);
  }
  if (create) {
    tallies[0]++;
  }
 else   if (close) {
    tallies[2]++;
  }
 else   if (update) {
    tallies[1]++;
  }
  return null;
}

Fixed version (ground truth):
public Case parse() throws InvalidStructureException, IOException, XmlPullParserException {
  this.checkNode("String_Node_Str");
  String caseId=parser.getAttributeValue(null,"String_Node_Str");
  if (caseId == null || caseId.equals("String_Node_Str")) {
    throw new InvalidStructureException("String_Node_Str",this.parser);
  }
  String dateModified=parser.getAttributeValue(null,"String_Node_Str");
  if (dateModified == null) {
    throw new InvalidStructureException("String_Node_Str",this.parser);
  }
  Date modified=DateUtils.parseDateTime(dateModified);
  boolean create=false;
  boolean update=false;
  boolean close=false;
  Case caseForBlock=null;
  while (this.nextTagInBlock("String_Node_Str")) {
    String action=parser.getName().toLowerCase();
    if (action.equals("String_Node_Str")) {
      String[] data=new String[3];
      while (this.nextTagInBlock("String_Node_Str")) {
        if (parser.getName().equals("String_Node_Str")) {
          data[0]=parser.nextText().trim();
        }
 else         if (parser.getName().equals("String_Node_Str")) {
          data[1]=parser.nextText().trim();
        }
 else         if (parser.getName().equals("String_Node_Str")) {
          data[2]=parser.nextText().trim();
        }
 else {
          throw new InvalidStructureException("String_Node_Str" + parser.getName(),parser);
        }
      }
      if (data[0] == null || data[2] == null) {
        throw new InvalidStructureException("String_Node_Str" + caseId,parser);
      }
      boolean overriden=false;
      if (acceptCreateOverwrites) {
        caseForBlock=retrieve(caseId);
        if (caseForBlock != null) {
          caseForBlock.setName(data[2]);
          caseForBlock.setTypeId(data[0]);
          overriden=true;
        }
      }
      if (caseForBlock == null) {
        caseForBlock=CreateCase(data[2],data[0]);
        caseForBlock.setCaseId(caseId);
        caseForBlock.setDateOpened(modified);
      }
      if (data[1] != null) {
        caseForBlock.setUserId(data[1]);
      }
      create=true;
      String succesfulAction=overriden ? "String_Node_Str" : "String_Node_Str";
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      if (caseForBlock == null) {
        throw new InvalidStructureException("String_Node_Str" + caseId,parser);
      }
      while (this.nextTagInBlock("String_Node_Str")) {
        String key=parser.getName();
        String value=parser.nextText().trim();
        if (key.equals("String_Node_Str")) {
          caseForBlock.setTypeId(value);
        }
 else         if (key.equals("String_Node_Str")) {
          caseForBlock.setName(value);
        }
 else         if (key.equals("String_Node_Str")) {
          caseForBlock.setDateOpened(DateUtils.parseDate(value));
        }
 else         if (key.equals("String_Node_Str")) {
          caseForBlock.setUserId(value);
        }
 else {
          caseForBlock.setProperty(key,value);
        }
      }
      update=true;
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      if (caseForBlock == null) {
        throw new InvalidStructureException("String_Node_Str" + caseId,parser);
      }
      caseForBlock.setClosed(true);
      commit(caseForBlock);
      close=true;
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      while (this.nextTagInBlock("String_Node_Str")) {
        String indexName=parser.getName();
        String caseType=parser.getAttributeValue(null,"String_Node_Str");
        String relationship=parser.getAttributeValue(null,"String_Node_Str");
        if (relationship == null) {
          relationship=CaseIndex.RELATIONSHIP_CHILD;
        }
        String value=parser.nextText().trim();
        if (value.equals(caseId)) {
          throw new InvalidStructureException("String_Node_Str" + caseId + "String_Node_Str",parser);
        }
        if (value.equals("String_Node_Str")) {
          value=null;
        }
        if (value == null) {
          caseForBlock.removeIndex(indexName);
        }
 else {
          caseForBlock.setIndex(new CaseIndex(indexName,caseType,value,relationship));
        }
      }
    }
 else     if (action.equals("String_Node_Str")) {
      if (caseForBlock == null) {
        caseForBlock=retrieve(caseId);
      }
      while (this.nextTagInBlock("String_Node_Str")) {
        String attachmentName=parser.getName();
        String src=parser.getAttributeValue(null,"String_Node_Str");
        String from=parser.getAttributeValue(null,"String_Node_Str");
        String fileName=parser.getAttributeValue(null,"String_Node_Str");
        if ((src == null || "String_Node_Str".equals(src)) && (from == null || "String_Node_Str".equals(from))) {
          this.removeAttachment(caseForBlock,attachmentName);
          caseForBlock.removeAttachment(attachmentName);
          continue;
        }
        String reference=this.processAttachment(src,from,fileName,parser);
        if (reference != null) {
          caseForBlock.updateAttachment(attachmentName,reference);
        }
      }
    }
  }
  if (caseForBlock != null) {
    caseForBlock.setLastModified(modified);
    commit(caseForBlock);
  }
  if (create) {
    tallies[0]++;
  }
 else   if (close) {
    tallies[2]++;
  }
 else   if (update) {
    tallies[1]++;
  }
  return null;
}