Program: 149260
Project: 149260
Buggy source:
/** 
 * @param droppedItemPOJOPK
 * @return ItemPOJOPK
 * @throws XtentisException recover dropped item
 */
public static ItemPOJOPK recover(DroppedItemPOJOPK droppedItemPOJOPK) throws XtentisException {
  if (droppedItemPOJOPK == null)   return null;
  ItemPOJOPK refItemPOJOPK=droppedItemPOJOPK.getRefItemPOJOPK();
  String actionName="String_Node_Str";
  String userName=rolesFilter(refItemPOJOPK,actionName,"String_Node_Str");
  universeFilter(refItemPOJOPK);
  String sourceItemRevision=droppedItemPOJOPK.getRevisionId();
  XmlServerSLWrapperLocal server=obtainXmlServerSLWrapperLocal();
  try {
    String partPath=droppedItemPOJOPK.getPartPath();
    if (partPath == null || partPath.length() == 0)     return null;
    StringBuffer getXmlDocument=new StringBuffer();
    if (partPath.equals("String_Node_Str")) {
      String doc=server.getDocumentAsString(null,"String_Node_Str",droppedItemPOJOPK.getUniquePK(),null);
      getXmlDocument.append(doc);
    }
 else {
      String query="String_Node_Str" + droppedItemPOJOPK.getUniquePK() + "String_Node_Str";
      ArrayList<String> results=server.runQuery(null,"String_Node_Str",query,null);
      if (results == null || results.size() == 0)       return null;
      for (int i=0; i < results.size(); i++) {
        getXmlDocument.append(results.get(i));
      }
    }
    if (getXmlDocument.toString() == null || getXmlDocument.toString().length() == 0)     return null;
    String bakDoc="String_Node_Str";
    if (partPath.equals("String_Node_Str")) {
      bakDoc=getXmlDocument.toString();
    }
 else {
      bakDoc=server.getDocumentAsString(sourceItemRevision,refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),refItemPOJOPK.getUniqueID(),null);
    }
    if (partPath.equals("String_Node_Str")) {
      DroppedItemPOJO droppedItemPOJO=(DroppedItemPOJO)Unmarshaller.unmarshal(DroppedItemPOJO.class,new InputSource(new StringReader(getXmlDocument.toString())));
      server.putDocumentFromString(droppedItemPOJO.getProjection(),refItemPOJOPK.getUniqueID(),refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),sourceItemRevision);
    }
 else {
      Document partDom=Util.parse(getXmlDocument.toString());
      String insertText=partDom.getFirstChild().getTextContent();
      Node inserNode=Util.parse(insertText).getFirstChild();
      if (bakDoc == null)       throw new XtentisException("String_Node_Str");
      Document targetDom=Util.parse(bakDoc);
      String xPath="String_Node_Str" + parserParentPartPath(partPath);
      Node singleParentNode=null;
      NodeList parentNodeList=Util.getNodeList(targetDom,xPath);
      if (parentNodeList.getLength() > 0) {
        singleParentNode=parentNodeList.item(0);
      }
      if (singleParentNode != null) {
        Node importNode=targetDom.importNode(inserNode,true);
        singleParentNode.appendChild(importNode);
      }
      ItemPOJO itemPOJO=ItemPOJO.parse(bakDoc);
      if (itemPOJO.getDataModelName() != null) {
        DataModelPOJO dataModelPOJO=ObjectPOJO.load(itemPOJO.getDataModelRevision(),DataModelPOJO.class,new DataModelPOJOPK(itemPOJO.getDataModelName()));
        if (dataModelPOJO != null)         Util.validate(targetDom.getDocumentElement(),dataModelPOJO.getSchema());
      }
      server.putDocumentFromString(Util.nodeToString(targetDom),refItemPOJOPK.getUniqueID(),refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),sourceItemRevision);
    }
    long res=server.deleteDocument(null,"String_Node_Str",droppedItemPOJOPK.getUniquePK());
    if (res == -1) {
      if (partPath.equals("String_Node_Str")) {
        server.deleteDocument(sourceItemRevision,refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),refItemPOJOPK.getUniqueID());
      }
 else {
        server.putDocumentFromString(bakDoc,refItemPOJOPK.getUniqueID(),refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),sourceItemRevision);
      }
    }
    return refItemPOJOPK;
  }
 catch (  SAXException e) {
    String err="String_Node_Str" + e.getLocalizedMessage();
    throw new XtentisException(err);
  }
catch (  Exception e) {
    String err="String_Node_Str" + actionName + "String_Node_Str"+ droppedItemPOJOPK.getUniquePK()+ "String_Node_Str"+ e.getClass().getName()+ "String_Node_Str"+ e.getLocalizedMessage();
    org.apache.log4j.Logger.getLogger(DroppedItemPOJO.class).error(err,e);
    throw new XtentisException(err);
  }
}

Fixed version (ground truth):
/** 
 * @param droppedItemPOJOPK
 * @return ItemPOJOPK
 * @throws XtentisException recover dropped item
 */
public static ItemPOJOPK recover(DroppedItemPOJOPK droppedItemPOJOPK) throws XtentisException {
  if (droppedItemPOJOPK == null)   return null;
  ItemPOJOPK refItemPOJOPK=droppedItemPOJOPK.getRefItemPOJOPK();
  String actionName="String_Node_Str";
  String userName=rolesFilter(refItemPOJOPK,actionName,"String_Node_Str");
  universeFilter(refItemPOJOPK);
  String sourceItemRevision=droppedItemPOJOPK.getRevisionId();
  XmlServerSLWrapperLocal server=obtainXmlServerSLWrapperLocal();
  try {
    String partPath=droppedItemPOJOPK.getPartPath();
    if (partPath == null || partPath.length() == 0)     return null;
    StringBuffer getXmlDocument=new StringBuffer();
    if (partPath.equals("String_Node_Str")) {
      String doc=server.getDocumentAsString(null,"String_Node_Str",droppedItemPOJOPK.getUniquePK(),null);
      getXmlDocument.append(doc);
    }
 else {
      String query="String_Node_Str" + droppedItemPOJOPK.getUniquePK() + "String_Node_Str";
      ArrayList<String> results=server.runQuery(null,"String_Node_Str",query,null);
      if (results == null || results.size() == 0)       return null;
      for (int i=0; i < results.size(); i++) {
        getXmlDocument.append(results.get(i));
      }
    }
    if (getXmlDocument.toString() == null || getXmlDocument.toString().length() == 0)     return null;
    String bakDoc="String_Node_Str";
    if (partPath.equals("String_Node_Str")) {
      bakDoc=getXmlDocument.toString();
    }
 else {
      bakDoc=server.getDocumentAsString(sourceItemRevision,refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),refItemPOJOPK.getUniqueID(),null);
    }
    if (partPath.equals("String_Node_Str")) {
      DroppedItemPOJO droppedItemPOJO=(DroppedItemPOJO)Unmarshaller.unmarshal(DroppedItemPOJO.class,new InputSource(new StringReader(getXmlDocument.toString())));
      server.putDocumentFromString(droppedItemPOJO.getProjection(),refItemPOJOPK.getUniqueID(),refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),sourceItemRevision);
    }
 else {
      Document partDom=Util.parse(getXmlDocument.toString());
      String insertText=partDom.getFirstChild().getTextContent();
      Node inserNode=Util.parse(insertText).getFirstChild();
      if (bakDoc == null)       throw new XtentisException("String_Node_Str");
      Document targetDom=Util.parse(bakDoc);
      String xPath="String_Node_Str" + parserParentPartPath(partPath);
      Node singleParentNode=null;
      NodeList parentNodeList=Util.getNodeList(targetDom,xPath);
      if (parentNodeList.getLength() > 0) {
        singleParentNode=parentNodeList.item(0);
      }
      if (singleParentNode != null) {
        Node importNode=targetDom.importNode(inserNode,true);
        singleParentNode.appendChild(importNode);
      }
      String targetDomXml=Util.nodeToString(targetDom);
      ItemPOJO itemPOJO=ItemPOJO.parse(targetDomXml);
      if (itemPOJO.getDataModelName() != null) {
        DataModelPOJO dataModelPOJO=ObjectPOJO.load(itemPOJO.getDataModelRevision(),DataModelPOJO.class,new DataModelPOJOPK(itemPOJO.getDataModelName()));
        if (dataModelPOJO != null) {
          Element projection=null;
          try {
            projection=itemPOJO.getProjection();
          }
 catch (          Exception e) {
            throw new XtentisException("String_Node_Str");
          }
          Util.validate(projection,dataModelPOJO.getSchema());
        }
      }
      server.putDocumentFromString(targetDomXml,refItemPOJOPK.getUniqueID(),refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),sourceItemRevision);
    }
    long res=server.deleteDocument(null,"String_Node_Str",droppedItemPOJOPK.getUniquePK());
    if (res == -1) {
      if (partPath.equals("String_Node_Str")) {
        server.deleteDocument(sourceItemRevision,refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),refItemPOJOPK.getUniqueID());
      }
 else {
        server.putDocumentFromString(bakDoc,refItemPOJOPK.getUniqueID(),refItemPOJOPK.getDataClusterPOJOPK().getUniqueId(),sourceItemRevision);
      }
    }
    return refItemPOJOPK;
  }
 catch (  SAXException e) {
    String err="String_Node_Str" + e.getLocalizedMessage();
    throw new XtentisException(err);
  }
catch (  Exception e) {
    String err="String_Node_Str" + actionName + "String_Node_Str"+ droppedItemPOJOPK.getUniquePK()+ "String_Node_Str"+ e.getClass().getName()+ "String_Node_Str"+ e.getLocalizedMessage();
    org.apache.log4j.Logger.getLogger(DroppedItemPOJO.class).error(err,e);
    throw new XtentisException(err);
  }
}