Program: 149191
Project: 149191
Buggy source:
private static void generateUUIDForElement(Document schema,String dataCluster,String concept,Element conceptRoot) throws Exception {
  NodeList uuidLists=getUUIDNodes(schema,concept);
  for (int i=0; i < uuidLists.getLength(); i++) {
    Element element=(Element)uuidLists.item(i);
    String name=Util.getFirstTextNode(element,"String_Node_Str");
    String type=Util.getFirstTextNode(element,"String_Node_Str");
    String value=null;
    for (int j=0; j < conceptRoot.getChildNodes().getLength(); j++) {
      Node node=conceptRoot.getChildNodes().item(j);
      if (node.getNodeType() != Node.ELEMENT_NODE)       continue;
      if (node.getChildNodes().getLength() > 1) {
        generateUUIDForElement(schema,dataCluster,node.getNodeName(),(Element)node);
      }
 else {
        if (node.getNodeName().equalsIgnoreCase(name)) {
          if (node.getTextContent() == null || node.getTextContent().length() == 0) {
            if (EUUIDCustomType.AUTO_INCREMENT.getName().equalsIgnoreCase(type)) {
              value=String.valueOf(AutoIncrementGenerator.generateNum(LocalUser.getLocalUser().getUniverse().getName(),dataCluster,concept + "String_Node_Str" + name));
            }
            if (EUUIDCustomType.UUID.getName().equalsIgnoreCase(type)) {
              value=String.valueOf(UUID.randomUUID().toString());
            }
            node.setTextContent(value);
          }
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void generateUUIDForElement(Document schema,String dataCluster,String concept,Element conceptRoot) throws Exception {
  NodeList uuidLists=getUUIDNodes(schema,concept);
  for (int i=0; i < uuidLists.getLength(); i++) {
    Element element=(Element)uuidLists.item(i);
    String name=Util.getFirstTextNode(element,"String_Node_Str");
    String type=Util.getFirstTextNode(element,"String_Node_Str");
    String value=null;
    for (int j=0; j < conceptRoot.getChildNodes().getLength(); j++) {
      Node node=conceptRoot.getChildNodes().item(j);
      if (node.getNodeType() != Node.ELEMENT_NODE)       continue;
      if (node.getChildNodes().getLength() > 1) {
        generateUUIDForElement(schema,dataCluster,node.getNodeName(),(Element)node);
      }
 else {
        if (node.getNodeName().equalsIgnoreCase(name)) {
          if (node.getTextContent() == null || node.getTextContent().length() == 0) {
            if (EUUIDCustomType.AUTO_INCREMENT.getName().equalsIgnoreCase(type)) {
              String id=String.valueOf(AutoIncrementGenerator.generateNum(LocalUser.getLocalUser().getUniverse().getName(),dataCluster,concept + "String_Node_Str" + name));
              ItemPOJOPK pk=new ItemPOJOPK(new DataClusterPOJOPK(dataCluster),concept,new String[]{id});
              ItemPOJO pojo=ItemPOJO.load(pk);
              while (pojo != null) {
                id=String.valueOf(AutoIncrementGenerator.generateNum(LocalUser.getLocalUser().getUniverse().getName(),dataCluster,concept + "String_Node_Str" + name));
                pk=new ItemPOJOPK(new DataClusterPOJOPK(dataCluster),concept,new String[]{id});
                pojo=ItemPOJO.load(pk);
                if (pojo == null) {
                  value=id;
                  break;
                }
              }
              if (pojo == null) {
                value=id;
              }
            }
            if (EUUIDCustomType.UUID.getName().equalsIgnoreCase(type)) {
              value=String.valueOf(UUID.randomUUID().toString());
            }
            node.setTextContent(value);
          }
          break;
        }
      }
    }
  }
}