Program: 172103
Project: 172103
Buggy source:
/** 
 * {@inheritDoc}
 */
public void getNodesMetadata(NodeMetaDataParameters nodeMetaDataParameters,MetaDataResultsFilter resultFilter,NodeMetaDataQueryCallback callback){
  if (false == enabled) {
    return;
  }
  NodeMetaDataQueryRowHandler rowHandler=new NodeMetaDataQueryRowHandler(callback);
  boolean includeType=(resultFilter == null ? true : resultFilter.getIncludeType());
  boolean includeProperties=(resultFilter == null ? true : resultFilter.getIncludeProperties());
  boolean includeAspects=(resultFilter == null ? true : resultFilter.getIncludeAspects());
  boolean includePaths=(resultFilter == null ? true : resultFilter.getIncludePaths());
  boolean includeNodeRef=(resultFilter == null ? true : resultFilter.getIncludeNodeRef());
  boolean includeParentAssociations=(resultFilter == null ? true : resultFilter.getIncludeParentAssociations());
  boolean includeChildAssociations=(resultFilter == null ? true : resultFilter.getIncludeChildAssociations());
  boolean includeOwner=(resultFilter == null ? true : resultFilter.getIncludeOwner());
  boolean includeChildIds=(resultFilter == null ? true : resultFilter.getIncludeChildIds());
  boolean includeTxnId=(resultFilter == null ? true : resultFilter.getIncludeTxnId());
  List<Long> nodeIds=preCacheNodes(nodeMetaDataParameters);
  for (  Long nodeId : nodeIds) {
    Map<QName,Serializable> props=null;
    Set<QName> aspects=null;
    if (!nodeDAO.exists(nodeId)) {
      continue;
    }
    NodeMetaData nodeMetaData=new NodeMetaData();
    nodeMetaData.setNodeId(nodeId);
    Pair<Long,NodeRef> pair=nodeDAO.getNodePair(nodeId);
    nodeMetaData.setAclId(nodeDAO.getNodeAclId(nodeId));
    if (includeTxnId) {
      nodeMetaData.setTxnId(nodeDAO.getNodeRefStatus(pair.getSecond()).getDbTxnId());
    }
    if (includeType) {
      QName nodeType=nodeDAO.getNodeType(nodeId);
      nodeMetaData.setNodeType(nodeType);
    }
    if (includeProperties) {
      Map<QName,Serializable> sourceProps=nodeDAO.getNodeProperties(nodeId);
      props=new HashMap<QName,Serializable>((int)(sourceProps.size() * 1.3));
      for (      QName propertyQName : sourceProps.keySet()) {
        PropertyDefinition propDef=dictionaryService.getProperty(propertyQName);
        if (propDef != null) {
          props.put(propertyQName,sourceProps.get(propertyQName));
        }
      }
      nodeMetaData.setProperties(props);
    }
 else {
      nodeMetaData.setProperties(Collections.<QName,Serializable>emptyMap());
    }
    if (includeAspects) {
      aspects=nodeDAO.getNodeAspects(nodeId);
    }
    nodeMetaData.setAspects(aspects);
    if (includePaths) {
      Collection<Pair<Path,QName>> categoryPaths=getCategoryPaths(pair.getSecond(),aspects,props);
      List<Path> directPaths=nodeDAO.getPaths(pair,false);
      Collection<Pair<Path,QName>> paths=new ArrayList<Pair<Path,QName>>(directPaths.size() + categoryPaths.size());
      for (      Path path : directPaths) {
        paths.add(new Pair<Path,QName>(path,null));
      }
      paths.addAll(categoryPaths);
      nodeMetaData.setPaths(paths);
    }
    if (includeNodeRef) {
      nodeMetaData.setNodeRef(pair.getSecond());
    }
    if (includeChildAssociations) {
      final List<ChildAssociationRef> childAssocs=new ArrayList<ChildAssociationRef>(100);
      nodeDAO.getChildAssocs(nodeId,null,null,null,null,null,new ChildAssocRefQueryCallback(){
        @Override public boolean preLoadNodes(){
          return false;
        }
        @Override public boolean orderResults(){
          return false;
        }
        @Override public boolean handle(        Pair<Long,ChildAssociationRef> childAssocPair,        Pair<Long,NodeRef> parentNodePair,        Pair<Long,NodeRef> childNodePair){
          childAssocs.add(childAssocPair.getSecond());
          return true;
        }
        @Override public void done(){
        }
      }
);
      nodeMetaData.setChildAssocs(childAssocs);
    }
    if (includeChildIds) {
      final List<Long> childIds=new ArrayList<Long>(100);
      nodeDAO.getChildAssocs(nodeId,null,null,null,null,null,new ChildAssocRefQueryCallback(){
        @Override public boolean preLoadNodes(){
          return false;
        }
        @Override public boolean orderResults(){
          return false;
        }
        @Override public boolean handle(        Pair<Long,ChildAssociationRef> childAssocPair,        Pair<Long,NodeRef> parentNodePair,        Pair<Long,NodeRef> childNodePair){
          childIds.add(childNodePair.getFirst());
          return true;
        }
        @Override public void done(){
        }
      }
);
      nodeMetaData.setChildIds(childIds);
    }
    if (includeParentAssociations) {
      final List<ChildAssociationRef> parentAssocs=new ArrayList<ChildAssociationRef>(100);
      nodeDAO.getParentAssocs(nodeId,null,null,null,new ChildAssocRefQueryCallback(){
        @Override public boolean preLoadNodes(){
          return false;
        }
        @Override public boolean orderResults(){
          return false;
        }
        @Override public boolean handle(        Pair<Long,ChildAssociationRef> childAssocPair,        Pair<Long,NodeRef> parentNodePair,        Pair<Long,NodeRef> childNodePair){
          parentAssocs.add(childAssocPair.getSecond());
          return true;
        }
        @Override public void done(){
        }
      }
);
      CRC32 crc=new CRC32();
      for (      ChildAssociationRef car : parentAssocs) {
        try {
          crc.update(car.toString().getBytes("String_Node_Str"));
        }
 catch (        UnsupportedEncodingException e) {
          throw new RuntimeException("String_Node_Str");
        }
      }
      nodeMetaData.setParentAssocs(parentAssocs,crc.getValue());
    }
    if (includeOwner) {
      nodeMetaData.setOwner(ownableService.getOwner(pair.getSecond()));
    }
    rowHandler.processResult(nodeMetaData);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void getNodesMetadata(NodeMetaDataParameters nodeMetaDataParameters,MetaDataResultsFilter resultFilter,NodeMetaDataQueryCallback callback){
  if (false == enabled) {
    return;
  }
  NodeMetaDataQueryRowHandler rowHandler=new NodeMetaDataQueryRowHandler(callback);
  boolean includeType=(resultFilter == null ? true : resultFilter.getIncludeType());
  boolean includeProperties=(resultFilter == null ? true : resultFilter.getIncludeProperties());
  boolean includeAspects=(resultFilter == null ? true : resultFilter.getIncludeAspects());
  boolean includePaths=(resultFilter == null ? true : resultFilter.getIncludePaths());
  boolean includeNodeRef=(resultFilter == null ? true : resultFilter.getIncludeNodeRef());
  boolean includeParentAssociations=(resultFilter == null ? true : resultFilter.getIncludeParentAssociations());
  boolean includeChildAssociations=(resultFilter == null ? true : resultFilter.getIncludeChildAssociations());
  boolean includeOwner=(resultFilter == null ? true : resultFilter.getIncludeOwner());
  boolean includeChildIds=(resultFilter == null ? true : resultFilter.getIncludeChildIds());
  boolean includeTxnId=(resultFilter == null ? true : resultFilter.getIncludeTxnId());
  List<Long> nodeIds=preCacheNodes(nodeMetaDataParameters);
  for (  Long nodeId : nodeIds) {
    Map<QName,Serializable> props=null;
    Set<QName> aspects=null;
    if (!nodeDAO.exists(nodeId)) {
      continue;
    }
    NodeMetaData nodeMetaData=new NodeMetaData();
    nodeMetaData.setNodeId(nodeId);
    Pair<Long,NodeRef> pair=nodeDAO.getNodePair(nodeId);
    nodeMetaData.setAclId(nodeDAO.getNodeAclId(nodeId));
    if (includeTxnId) {
      nodeMetaData.setTxnId(nodeDAO.getNodeRefStatus(pair.getSecond()).getDbTxnId());
    }
    if (includeType) {
      QName nodeType=nodeDAO.getNodeType(nodeId);
      nodeMetaData.setNodeType(nodeType);
    }
    if (includeProperties) {
      props=getProperties(nodeId);
      nodeMetaData.setProperties(props);
    }
 else {
      nodeMetaData.setProperties(Collections.<QName,Serializable>emptyMap());
    }
    if (includeAspects) {
      aspects=nodeDAO.getNodeAspects(nodeId);
    }
    nodeMetaData.setAspects(aspects);
    if (includePaths) {
      if (props == null) {
        props=getProperties(nodeId);
      }
      Collection<Pair<Path,QName>> categoryPaths=getCategoryPaths(pair.getSecond(),aspects,props);
      List<Path> directPaths=nodeDAO.getPaths(pair,false);
      Collection<Pair<Path,QName>> paths=new ArrayList<Pair<Path,QName>>(directPaths.size() + categoryPaths.size());
      for (      Path path : directPaths) {
        paths.add(new Pair<Path,QName>(path,null));
      }
      paths.addAll(categoryPaths);
      nodeMetaData.setPaths(paths);
    }
    if (includeNodeRef) {
      nodeMetaData.setNodeRef(pair.getSecond());
    }
    if (includeChildAssociations) {
      final List<ChildAssociationRef> childAssocs=new ArrayList<ChildAssociationRef>(100);
      nodeDAO.getChildAssocs(nodeId,null,null,null,null,null,new ChildAssocRefQueryCallback(){
        @Override public boolean preLoadNodes(){
          return false;
        }
        @Override public boolean orderResults(){
          return false;
        }
        @Override public boolean handle(        Pair<Long,ChildAssociationRef> childAssocPair,        Pair<Long,NodeRef> parentNodePair,        Pair<Long,NodeRef> childNodePair){
          childAssocs.add(childAssocPair.getSecond());
          return true;
        }
        @Override public void done(){
        }
      }
);
      nodeMetaData.setChildAssocs(childAssocs);
    }
    if (includeChildIds) {
      final List<Long> childIds=new ArrayList<Long>(100);
      nodeDAO.getChildAssocs(nodeId,null,null,null,null,null,new ChildAssocRefQueryCallback(){
        @Override public boolean preLoadNodes(){
          return false;
        }
        @Override public boolean orderResults(){
          return false;
        }
        @Override public boolean handle(        Pair<Long,ChildAssociationRef> childAssocPair,        Pair<Long,NodeRef> parentNodePair,        Pair<Long,NodeRef> childNodePair){
          childIds.add(childNodePair.getFirst());
          return true;
        }
        @Override public void done(){
        }
      }
);
      nodeMetaData.setChildIds(childIds);
    }
    if (includeParentAssociations) {
      final List<ChildAssociationRef> parentAssocs=new ArrayList<ChildAssociationRef>(100);
      nodeDAO.getParentAssocs(nodeId,null,null,null,new ChildAssocRefQueryCallback(){
        @Override public boolean preLoadNodes(){
          return false;
        }
        @Override public boolean orderResults(){
          return false;
        }
        @Override public boolean handle(        Pair<Long,ChildAssociationRef> childAssocPair,        Pair<Long,NodeRef> parentNodePair,        Pair<Long,NodeRef> childNodePair){
          parentAssocs.add(childAssocPair.getSecond());
          return true;
        }
        @Override public void done(){
        }
      }
);
      CRC32 crc=new CRC32();
      for (      ChildAssociationRef car : parentAssocs) {
        try {
          crc.update(car.toString().getBytes("String_Node_Str"));
        }
 catch (        UnsupportedEncodingException e) {
          throw new RuntimeException("String_Node_Str");
        }
      }
      nodeMetaData.setParentAssocs(parentAssocs,crc.getValue());
    }
    if (includeOwner) {
      nodeMetaData.setOwner(ownableService.getOwner(pair.getSecond()));
    }
    rowHandler.processResult(nodeMetaData);
  }
}