nus-yam/ex-repair huggingface dataset:
Program: 172165
Project: 172165
Buggy source:
@Override public void onUpdateProperties(NodeRef commentsRollupNode,Map<QName,Serializable> before,Map<QName,Serializable> after){
  Serializable newCommentCount=after.get(ForumModel.PROP_COMMENT_COUNT);
  if (newCommentCount != null) {
    Integer newCommentCountInt=(Integer)newCommentCount;
    if (newCommentCountInt == COUNT_TRIGGER_VALUE) {
      if (log.isDebugEnabled()) {
        StringBuilder msg=new StringBuilder();
        msg.append(commentsRollupNode).append("String_Node_Str").append(ForumModel.PROP_COMMENT_COUNT.getLocalName()).append("String_Node_Str").append(newCommentCountInt);
        log.debug(msg.toString());
        log.debug("String_Node_Str");
      }
      final int realCommentTotal=calculateCommentTotalByNodeCounting(commentsRollupNode);
      if (realCommentTotal != -1) {
        nodeService.setProperty(commentsRollupNode,ForumModel.PROP_COMMENT_COUNT,realCommentTotal);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onUpdateProperties(NodeRef commentsRollupNode,Map<QName,Serializable> before,Map<QName,Serializable> after){
  Serializable newCommentCount=after.get(ForumModel.PROP_COMMENT_COUNT);
  if (newCommentCount != null) {
    Integer newCommentCountInt=(Integer)newCommentCount;
    if (newCommentCountInt == COUNT_TRIGGER_VALUE) {
      if (log.isDebugEnabled()) {
        StringBuilder msg=new StringBuilder();
        msg.append(commentsRollupNode).append("String_Node_Str").append(ForumModel.PROP_COMMENT_COUNT.getLocalName()).append("String_Node_Str").append(newCommentCountInt);
        log.debug(msg.toString());
        log.debug("String_Node_Str");
      }
      final Integer realCommentTotal=calculateCommentTotalByNodeCounting(commentsRollupNode);
      if (realCommentTotal != null && realCommentTotal != -1) {
        nodeService.setProperty(commentsRollupNode,ForumModel.PROP_COMMENT_COUNT,realCommentTotal);
      }
    }
  }
}
Program: 172166
Project: 172166
Buggy source:
private NodeRef publishNode(NodeRef source,StatusUpdate statusUpdate){
  MutablePublishingPackage pckg=queue.createPublishingPackage();
  pckg.addNodesToPublish(source);
  scheduleEvent(pckg,statusUpdate);
  assertNotNull(eventId);
  NodeRef eventNode=new NodeRef(eventId);
  assertTrue(nodeService.exists(eventNode));
  Serializable eventStatus=nodeService.getProperty(eventNode,PublishingModel.PROP_PUBLISHING_EVENT_STATUS);
  assertEquals(PublishingEvent.Status.SCHEDULED.name(),eventStatus);
  action.executeImpl(null,eventNode);
  eventStatus=nodeService.getProperty(eventNode,PublishingModel.PROP_PUBLISHING_EVENT_STATUS);
  assertEquals(PublishingEvent.Status.COMPLETE.name(),eventStatus);
  return eventNode;
}

Fixed version (ground truth):
private NodeRef publishNode(NodeRef source,StatusUpdate statusUpdate){
  MutablePublishingPackage pckg=queue.createPublishingPackage();
  pckg.addNodesToPublish(source);
  scheduleEvent(pckg,statusUpdate);
  assertNotNull(eventId);
  NodeRef eventNode=new NodeRef(eventId);
  assertTrue(nodeService.exists(eventNode));
  Serializable eventStatus=nodeService.getProperty(eventNode,PublishingModel.PROP_PUBLISHING_EVENT_STATUS);
  assertEquals(PublishingEvent.Status.SCHEDULED.name(),eventStatus);
  action.executeImpl(null,eventNode);
  eventStatus=nodeService.getProperty(eventNode,PublishingModel.PROP_PUBLISHING_EVENT_STATUS);
  assertEquals(PublishingEvent.Status.COMPLETED.name(),eventStatus);
  return eventNode;
}
Program: 172168
Project: 172168
Buggy source:
/** 
 * List the sites available in the repository.  The returned list can optionally be filtered by name and site preset. <p/> If no filters are specified then all the available sites are returned.
 * @param filter            inclusion filter for returned sites. Only sites whose cm:name OR cm:titleOR cm:description CONTAIN the filter string will be returned.
 * @param sitePresetFilter  site preset filter
 * @param size              max results size crop if >0
 * @return Site[]           a list of the site filtered as appropriate
 * @see SiteService#findSites(String,String,int) for a description of the limitations of this method.
 */
public Site[] listSites(String filter,String sitePresetFilter,int size){
  List<SiteInfo> siteInfos=this.siteService.findSites(filter,sitePresetFilter,size);
  List<Site> sites=new ArrayList<Site>(siteInfos.size());
  for (  SiteInfo siteInfo : siteInfos) {
    sites.add(new Site(siteInfo,this.serviceRegistry,this.siteService,getScope()));
  }
  return sites.toArray(new Site[sites.size()]);
}

Fixed version (ground truth):
/** 
 * List the sites available in the repository.  The returned list can optionally be filtered by name and site preset. <p/> If no filters are specified then all the available sites are returned.
 * @param filter            inclusion filter for returned sites. Only sites whose cm:name OR cm:titleOR cm:description start with the filter string will be returned.
 * @param sitePresetFilter  site preset filter
 * @param size              max results size crop if >0
 * @return Site[]           a list of the site filtered as appropriate
 * @see SiteService#listSites(String,String,int) for a description of the limitations of this method.
 */
public Site[] listSites(String filter,String sitePresetFilter,int size){
  List<SiteInfo> siteInfos=this.siteService.listSites(filter,sitePresetFilter,size);
  return makeSitesArray(siteInfos);
}
Program: 172170
Project: 172170
Buggy source:
/** 
 * Deletes the specified NodeRefs, if they exist.
 * @param nodesToDelete
 */
private static void performDeletionOfNodes(final List<NodeRef> nodesToDelete){
  TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>(){
    @Override public Void execute() throws Throwable {
      AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER);
      for (      NodeRef node : nodesToDelete) {
        if (NODE_SERVICE.exists(node))         NODE_SERVICE.deleteNode(node);
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Deletes the specified NodeRefs, if they exist.
 * @param nodesToDelete
 */
private static void performDeletionOfNodes(final List<NodeRef> nodesToDelete){
  TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>(){
    @Override public Void execute() throws Throwable {
      AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER);
      for (      NodeRef node : nodesToDelete) {
        if (NODE_SERVICE.exists(node)) {
          if (NODE_SERVICE.getType(node).equals(SiteModel.TYPE_SITE)) {
            SiteInfo siteInfo=SITE_SERVICE.getSite(node);
            SITE_SERVICE.deleteSite(siteInfo.getShortName());
          }
 else {
            NODE_SERVICE.deleteNode(node);
          }
        }
      }
      return null;
    }
  }
);
}
Program: 172175
Project: 172175
Buggy source:
public void testRemoveProperty() throws Exception {
  Map<QName,Serializable> properties=nodeService.getProperties(rootNodeRef);
  nodeService.addAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE,null);
  Serializable defaultValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNotNull("String_Node_Str",defaultValue);
  nodeService.setProperties(rootNodeRef,properties);
  Serializable nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
  nodeService.removeAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE);
  nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
  nodeService.addAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE,null);
  defaultValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNotNull("String_Node_Str",defaultValue);
  nodeService.setProperty(rootNodeRef,PROP_QNAME_PROP2,null);
  nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
  nodeService.removeAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE);
  nodeService.addAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE,null);
  defaultValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNotNull("String_Node_Str",defaultValue);
  nodeService.removeProperty(rootNodeRef,PROP_QNAME_PROP2);
  nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
}

Fixed version (ground truth):
public void testRemoveProperty() throws Exception {
  Map<QName,Serializable> properties=nodeService.getProperties(rootNodeRef);
  nodeService.addAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE,null);
  Serializable defaultValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNotNull("String_Node_Str",defaultValue);
  assertEquals("String_Node_Str",DEFAULT_VALUE,defaultValue);
  nodeService.setProperties(rootNodeRef,properties);
  Serializable nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
  nodeService.removeAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE);
  nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
  nodeService.addAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE,null);
  defaultValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNotNull("String_Node_Str",defaultValue);
  nodeService.setProperty(rootNodeRef,PROP_QNAME_PROP2,null);
  nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
  nodeService.removeAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE);
  nodeService.addAspect(rootNodeRef,ASPECT_QNAME_WITH_DEFAULT_VALUE,null);
  defaultValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNotNull("String_Node_Str",defaultValue);
  nodeService.removeProperty(rootNodeRef,PROP_QNAME_PROP2);
  nullValue=nodeService.getProperty(rootNodeRef,PROP_QNAME_PROP2);
  assertNull("String_Node_Str",nullValue);
}
Program: 172176
Project: 172176
Buggy source:
/** 
 * @param existingProperties    existing node properties
 * @param classQNames           the types or aspects to introspect
 * @return                      Returns any properties that should be added
 */
private Map<QName,Serializable> getMissingProperties(Map<QName,Serializable> existingProperties,Set<QName> classQNames){
  Map<QName,Serializable> allDefaultProperties=new HashMap<QName,Serializable>(17);
  for (  QName classQName : classQNames) {
    ClassDefinition classDefinition=dictionaryService.getClass(classQName);
    if (classDefinition == null) {
      continue;
    }
    Map<QName,Serializable> defaultProperties=getDefaultProperties(classQName);
    if (defaultProperties.size() > 0) {
      allDefaultProperties.putAll(defaultProperties);
    }
  }
  Map<QName,Serializable> missingProperties=new HashMap<QName,Serializable>(allDefaultProperties);
  missingProperties.entrySet().removeAll(existingProperties.entrySet());
  return missingProperties;
}

Fixed version (ground truth):
/** 
 * @param existingProperties    existing node properties
 * @param classQNames           the types or aspects to introspect
 * @return                      Returns any properties that should be added
 */
private Map<QName,Serializable> getMissingProperties(Map<QName,Serializable> existingProperties,Set<QName> classQNames){
  Map<QName,Serializable> allDefaultProperties=new HashMap<QName,Serializable>(17);
  for (  QName classQName : classQNames) {
    ClassDefinition classDefinition=dictionaryService.getClass(classQName);
    if (classDefinition == null) {
      continue;
    }
    Map<QName,Serializable> defaultProperties=getDefaultProperties(classQName);
    if (defaultProperties.size() > 0) {
      allDefaultProperties.putAll(defaultProperties);
    }
  }
  Map<QName,Serializable> missingProperties=new HashMap<QName,Serializable>(allDefaultProperties);
  missingProperties.keySet().removeAll(existingProperties.keySet());
  return missingProperties;
}
Program: 172178
Project: 172178
Buggy source:
/** 
 * Output a debug string, and a newline.
 * @param str String
 */
public void debugPrintln(String str,int level){
  if (level <= getLogLevel()) {
    if (m_printBuf.length() > 0) {
      m_printBuf.append(str);
      logOutput(m_printBuf.toString(),level);
      m_printBuf.setLength(0);
    }
 else     logOutput(str,level);
  }
}

Fixed version (ground truth):
/** 
 * Output an exception
 * @param ex Throwable
 * @param level int
 */
public void debugPrintln(Throwable ex,int level){
  if (level <= getLogLevel()) {
switch (level) {
case Debug.Debug:
      logger.debug(ex,ex);
    break;
case Debug.Info:
  logger.info(ex,ex);
break;
case Debug.Warn:
logger.warn(ex,ex);
break;
case Debug.Fatal:
logger.fatal(ex,ex);
break;
case Debug.Error:
logger.error(ex,ex);
break;
}
}
}
Program: 172185
Project: 172185
Buggy source:
@Override public WorkflowTask persist(){
  if (transitionId == null) {
    return updater.update();
  }
 else   if (transitionId.length() == 0) {
    return updater.transition();
  }
  return updater.transition(transitionId);
}

Fixed version (ground truth):
@Override public WorkflowTask persist(){
  if (transitionId == null) {
    return updater.update();
  }
 else {
    updater.update();
    if (transitionId.length() == 0) {
      return updater.transition();
    }
 else {
      return updater.transition(transitionId);
    }
  }
}
Program: 172186
Project: 172186
Buggy source:
/** 
 * The itemId may be in a URL/Webscript-friendly format. If so it must be converted back to the proper workflow definition name.
 * @param itemId
 */
private String decodeWorkflowDefinitionName(String itemId){
  String defName=itemId;
  if (itemId.contains("String_Node_Str") == false) {
    defName=itemId.replaceFirst("String_Node_Str","String_Node_Str");
  }
  if (itemId.contains("String_Node_Str") == false) {
    defName=defName.replaceFirst("String_Node_Str","String_Node_Str");
  }
  return defName;
}

Fixed version (ground truth):
/** 
 * The itemId may be in a URL/Webscript-friendly format. If so it must be converted back to the proper workflow definition name.
 * @param itemId
 */
private String decodeWorkflowDefinitionName(String itemId){
  String defName=itemId;
  if (itemId.contains("String_Node_Str") == false) {
    defName=itemId.replaceFirst("String_Node_Str",Matcher.quoteReplacement("String_Node_Str"));
  }
  if (itemId.contains("String_Node_Str") == false) {
    defName=defName.replaceFirst("String_Node_Str","String_Node_Str");
  }
  return defName;
}
Program: 172187
Project: 172187
Buggy source:
private Rating removeRating(NodeRef targetNode,String ratingSchemeName,String user){
  List<ChildAssociationRef> ratingChildren=getRatingNodeChildren(targetNode,user);
  if (ratingChildren.isEmpty()) {
    return null;
  }
  ChildAssociationRef lastChild=ratingChildren.get(ratingChildren.size() - 1);
  Map<QName,Serializable> properties=nodeService.getProperties(lastChild.getChildRef());
  RatingNodeProperties ratingProps=RatingNodeProperties.createFrom(properties);
  int index=ratingProps.getIndexOfRating(ratingSchemeName);
  if (index == -1) {
    return null;
  }
 else {
    RatingStruct removed=ratingProps.removeRatingAt(index);
    return new Rating(this.getRatingScheme(removed.getScheme()),removed.getScore(),user,removed.getDate());
  }
}

Fixed version (ground truth):
private Rating removeRating(NodeRef targetNode,String ratingSchemeName,String user){
  List<ChildAssociationRef> ratingChildren=getRatingNodeChildren(targetNode,user);
  if (ratingChildren.isEmpty()) {
    return null;
  }
  ChildAssociationRef lastChild=ratingChildren.get(ratingChildren.size() - 1);
  Map<QName,Serializable> properties=nodeService.getProperties(lastChild.getChildRef());
  RatingNodeProperties ratingProps=RatingNodeProperties.createFrom(properties);
  int index=ratingProps.getIndexOfRating(ratingSchemeName);
  if (index == -1) {
    return null;
  }
 else {
    RatingStruct removed=ratingProps.removeRatingAt(index);
    Map<QName,Serializable> props=ratingProps.toNodeProperties();
    nodeService.setProperties(lastChild.getChildRef(),props);
    return new Rating(this.getRatingScheme(removed.getScheme()),removed.getScore(),user,removed.getDate());
  }
}
Program: 172190
Project: 172190
Buggy source:
public boolean addNodeAspects(Long nodeId,Set<QName> aspectQNames){
  Set<QName> aspectQNamesToAdd=new HashSet<QName>(aspectQNames);
  Set<QName> existingAspectQNames=getNodeAspectsCached(nodeId);
  aspectQNamesToAdd.removeAll(existingAspectQNames);
  aspectQNamesToAdd.remove(ContentModel.ASPECT_REFERENCEABLE);
  if (aspectQNamesToAdd.isEmpty()) {
    return false;
  }
  Set<Long> aspectQNameIds=qnameDAO.convertQNamesToIds(aspectQNamesToAdd,true);
  startBatch();
  try {
    for (    Long aspectQNameId : aspectQNameIds) {
      insertNodeAspect(nodeId,aspectQNameId);
    }
  }
 catch (  RuntimeException e) {
    aspectsCache.deleteByKey(nodeId);
    throw e;
  }
 finally {
    executeBatch();
  }
  Set<QName> newAspectQNames=new HashSet<QName>(existingAspectQNames);
  newAspectQNames.addAll(aspectQNamesToAdd);
  setNodeAspectsCached(nodeId,newAspectQNames);
  if (newAspectQNames.contains(ContentModel.ASPECT_ROOT)) {
    invalidateCachesByNodeId(null,nodeId,parentAssocsCache);
  }
  touchNodeImpl(nodeId);
  return true;
}

Fixed version (ground truth):
public boolean addNodeAspects(Long nodeId,Set<QName> aspectQNames){
  if (aspectQNames.size() == 0) {
    return false;
  }
  Set<QName> aspectQNamesToAdd=new HashSet<QName>(aspectQNames);
  Set<QName> existingAspectQNames=getNodeAspectsCached(nodeId);
  aspectQNamesToAdd.removeAll(existingAspectQNames);
  aspectQNamesToAdd.remove(ContentModel.ASPECT_REFERENCEABLE);
  if (aspectQNamesToAdd.isEmpty()) {
    return false;
  }
  Set<Long> aspectQNameIds=qnameDAO.convertQNamesToIds(aspectQNamesToAdd,true);
  startBatch();
  try {
    for (    Long aspectQNameId : aspectQNameIds) {
      insertNodeAspect(nodeId,aspectQNameId);
    }
  }
 catch (  RuntimeException e) {
    aspectsCache.deleteByKey(nodeId);
    throw e;
  }
 finally {
    executeBatch();
  }
  Set<QName> newAspectQNames=new HashSet<QName>(existingAspectQNames);
  newAspectQNames.addAll(aspectQNamesToAdd);
  setNodeAspectsCached(nodeId,newAspectQNames);
  if (newAspectQNames.contains(ContentModel.ASPECT_ROOT)) {
    invalidateCachesByNodeId(null,nodeId,parentAssocsCache);
  }
  touchNodeImpl(nodeId);
  return true;
}
Program: 172192
Project: 172192
Buggy source:
private RenditionLocationImpl findOrCreateTemplatedPath(NodeRef sourceNode,String path,NodeRef companyHome){
  NodeService nodeService=serviceRegistry.getNodeService();
  List<String> pathElements=Arrays.asList(path.split("String_Node_Str"));
  LinkedList<String> folderElements=new LinkedList<String>(pathElements);
  if (folderElements.getFirst().length() == 0) {
    folderElements.removeFirst();
  }
  Serializable companyHomeName=nodeService.getProperty(companyHome,ContentModel.PROP_NAME);
  if (folderElements.getFirst().equals(companyHomeName)) {
    folderElements.removeFirst();
  }
  String fileName=folderElements.removeLast();
  if (fileName == null || fileName.length() == 0) {
    throw new RenditionServiceException("String_Node_Str" + path);
  }
  FileFolderService fileFolderService=serviceRegistry.getFileFolderService();
  FileInfo parentInfo=FileFolderServiceImpl.makeFolders(fileFolderService,companyHome,folderElements,ContentModel.TYPE_FOLDER);
  NodeRef parent=parentInfo.getNodeRef();
  NodeRef child=fileFolderService.searchSimple(parent,fileName);
  return new RenditionLocationImpl(parent,child,fileName);
}

Fixed version (ground truth):
private RenditionLocationImpl findOrCreateTemplatedPath(NodeRef sourceNode,String path,NodeRef companyHome){
  NodeService nodeService=serviceRegistry.getNodeService();
  List<String> pathElements=Arrays.asList(path.split("String_Node_Str"));
  LinkedList<String> folderElements=new LinkedList<String>(pathElements);
  if (folderElements.getFirst().length() == 0) {
    folderElements.removeFirst();
  }
  Serializable companyHomeName=nodeService.getProperty(companyHome,ContentModel.PROP_NAME);
  if (folderElements.getFirst().equals(companyHomeName)) {
    folderElements.removeFirst();
  }
  String fileName=folderElements.removeLast();
  if (fileName == null || fileName.length() == 0) {
    throw new RenditionServiceException("String_Node_Str" + path);
  }
  FileFolderService fileFolderService=serviceRegistry.getFileFolderService();
  NodeRef parent=companyHome;
  if (!folderElements.isEmpty()) {
    FileInfo parentInfo=FileFolderServiceImpl.makeFolders(fileFolderService,companyHome,folderElements,ContentModel.TYPE_FOLDER);
    parent=parentInfo.getNodeRef();
  }
  NodeRef child=fileFolderService.searchSimple(parent,fileName);
  return new RenditionLocationImpl(parent,child,fileName);
}
Program: 172194
Project: 172194
Buggy source:
public RenditionLocation getRenditionLocation(NodeRef sourceNode,RenditionDefinition definition,NodeRef tempRenditionLocation){
  NodeRef destination=AbstractRenderingEngine.getCheckedParam(RenditionService.PARAM_DESTINATION_NODE,NodeRef.class,definition);
  if (destination != null) {
    RenditionLocationImpl location=createNodeLocation(destination);
    return location;
  }
  String pathTemplate=(String)definition.getParameterValue(RenditionService.PARAM_DESTINATION_PATH_TEMPLATE);
  if (pathTemplate != null) {
    NodeRef companyHome=getCompanyHomeNode(sourceNode.getStoreRef());
    NodeService nodeService=serviceRegistry.getNodeService();
    Serializable companyHomeName=nodeService.getProperty(companyHome,ContentModel.PROP_NAME);
    String path=renderPathTemplate(pathTemplate,sourceNode,tempRenditionLocation,companyHomeName);
    if (path != null) {
      return findOrCreateTemplatedPath(sourceNode,path,companyHome);
    }
  }
  return new RenditionLocationImpl(sourceNode,null,null);
}

Fixed version (ground truth):
public RenditionLocation getRenditionLocation(NodeRef sourceNode,RenditionDefinition definition,NodeRef tempRenditionLocation){
  NodeRef destination=AbstractRenderingEngine.getCheckedParam(RenditionService.PARAM_DESTINATION_NODE,NodeRef.class,definition);
  if (destination != null) {
    RenditionLocationImpl location=createNodeLocation(destination);
    return location;
  }
  String pathTemplate=(String)definition.getParameterValue(RenditionService.PARAM_DESTINATION_PATH_TEMPLATE);
  if (pathTemplate != null) {
    NodeRef companyHome=getCompanyHomeNode(sourceNode.getStoreRef());
    String path=renderPathTemplate(pathTemplate,sourceNode,tempRenditionLocation,companyHome);
    if (path != null) {
      return findOrCreateTemplatedPath(sourceNode,path,companyHome);
    }
  }
  return new RenditionLocationImpl(sourceNode,null,null);
}
Program: 172196
Project: 172196
Buggy source:
private NodeRef makeNode(NodeRef parent,QName nodeType){
  String uuid=GUID.generate();
  Map<QName,Serializable> props=new HashMap<QName,Serializable>();
  props.put(ContentModel.PROP_NAME,uuid);
  ChildAssociationRef assoc=nodeService.createNode(parent,ContentModel.ASSOC_CONTAINS,QName.createQName(NamespaceService.APP_MODEL_1_0_URI,uuid),nodeType,props);
  return assoc.getChildRef();
}

Fixed version (ground truth):
private NodeRef makeNode(NodeRef parent,QName nodeType){
  String uuid=GUID.generate();
  Map<QName,Serializable> props=new HashMap<QName,Serializable>();
  props.put(ContentModel.PROP_NAME,uuid);
  ChildAssociationRef assoc=nodeService.createNode(parent,ContentModel.ASSOC_CONTAINS,QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,uuid),nodeType,props);
  return assoc.getChildRef();
}
Program: 172197
Project: 172197
Buggy source:
public void testCreatesFoldersForTemplatedLocation() throws Exception {
  QName fooName=QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,"String_Node_Str");
  QName barName=QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,"String_Node_Str");
  String fooPath="String_Node_Str";
  String barPath=fooPath + "String_Node_Str";
  List<ChildAssociationRef> childAssocs=nodeService.getChildAssocs(companyHome,ContentModel.ASSOC_CONTAINS,fooName);
  assertTrue("String_Node_Str" + fooPath + "String_Node_Str",childAssocs.isEmpty());
  QName renditionKind=QName.createQName(NamespaceService.APP_MODEL_1_0_URI,"String_Node_Str");
  NodeRef sourceNode=makeNode(companyHome,ContentModel.TYPE_CONTENT);
  NodeRef tempRenditionNode=makeNode(companyHome,ContentModel.TYPE_CONTENT);
  RenditionDefinition renditionDef=renditionService.createRenditionDefinition(renditionKind,"String_Node_Str");
  String pathTemplate=barPath + "String_Node_Str";
  renditionDef.setParameterValue(RenditionService.PARAM_DESTINATION_PATH_TEMPLATE,pathTemplate);
  RenditionLocation location=locationResolver.getRenditionLocation(sourceNode,renditionDef,tempRenditionNode);
  NodeRef fooNode=checkFolder(fooName,companyHome,"String_Node_Str");
  NodeRef barNode=checkFolder(barName,fooNode,"String_Node_Str");
  assertEquals("String_Node_Str",barNode,location.getParentRef());
  assertEquals("String_Node_Str",location.getChildName());
}

Fixed version (ground truth):
public void testCreatesFoldersForTemplatedLocation() throws Exception {
  QName fooName=QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,"String_Node_Str");
  QName barName=QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,"String_Node_Str");
  String fooPath="String_Node_Str";
  String barPath=fooPath + "String_Node_Str";
  List<ChildAssociationRef> childAssocs=nodeService.getChildAssocs(companyHome,ContentModel.ASSOC_CONTAINS,fooName);
  assertTrue("String_Node_Str" + fooPath + "String_Node_Str",childAssocs.isEmpty());
  QName renditionKind=QName.createQName(NamespaceService.APP_MODEL_1_0_URI,"String_Node_Str");
  NodeRef sourceFolder=makeNode(companyHome,ContentModel.TYPE_FOLDER);
  NodeRef sourceNode=makeNode(sourceFolder,ContentModel.TYPE_CONTENT);
  NodeRef tempRenditionNode=makeNode(companyHome,ContentModel.TYPE_CONTENT);
  RenditionDefinition renditionDef=renditionService.createRenditionDefinition(renditionKind,"String_Node_Str");
  String pathTemplate=barPath + "String_Node_Str";
  renditionDef.setParameterValue(RenditionService.PARAM_DESTINATION_PATH_TEMPLATE,pathTemplate);
  RenditionLocation location=locationResolver.getRenditionLocation(sourceNode,renditionDef,tempRenditionNode);
  NodeRef fooNode=checkFolder(fooName,companyHome,"String_Node_Str");
  NodeRef barNode=checkFolder(barName,fooNode,"String_Node_Str");
  NodeRef finalFolderNode=checkFolder(nodeService.getPrimaryParent(sourceFolder).getQName(),barNode,"String_Node_Str");
  assertEquals("String_Node_Str",finalFolderNode,location.getParentRef());
  assertEquals("String_Node_Str",location.getChildName());
}
Program: 172198
Project: 172198
Buggy source:
/** 
 * @param action
 */
protected void checkActionIsRenditionDefinition(Action action){
  if (action instanceof RenditionDefinition == false) {
    String msg="String_Node_Str" + action;
    logger.warn(msg);
    throw new RenditionServiceException(msg);
  }
}

Fixed version (ground truth):
/** 
 * @param action
 */
protected RenditionDefinition checkActionIsRenditionDefinition(Action action){
  if (action instanceof RenditionDefinition) {
    return (RenditionDefinition)action;
  }
 else {
    return new RenditionDefinitionImpl(action);
  }
}
Program: 172199
Project: 172199
Buggy source:
@Override protected void executeImpl(Action action,NodeRef sourceNode){
  checkParameterValues(action);
  checkActionIsRenditionDefinition(action);
  checkSourceNodeExists(sourceNode);
  RenditionDefinition renditionDefinition=(RenditionDefinition)action;
  ChildAssociationRef renditionAssoc=createRenditionNodeAssoc(sourceNode,renditionDefinition);
  QName targetContentProp=getRenditionContentProperty(renditionDefinition);
  NodeRef destinationNode=renditionAssoc.getChildRef();
  RenderingContext context=new RenderingContext(sourceNode,destinationNode,renditionDefinition,targetContentProp);
  render(context);
  action.getParameterValues().put(PARAM_RESULT,renditionAssoc);
}

Fixed version (ground truth):
@Override protected void executeImpl(Action action,NodeRef sourceNode){
  checkParameterValues(action);
  RenditionDefinition renditionDefinition=checkActionIsRenditionDefinition(action);
  checkSourceNodeExists(sourceNode);
  ChildAssociationRef renditionAssoc=createRenditionNodeAssoc(sourceNode,renditionDefinition);
  QName targetContentProp=getRenditionContentProperty(renditionDefinition);
  NodeRef destinationNode=renditionAssoc.getChildRef();
  RenderingContext context=new RenderingContext(sourceNode,destinationNode,renditionDefinition,targetContentProp);
  render(context);
  action.getParameterValues().put(PARAM_RESULT,renditionAssoc);
}
Program: 172200
Project: 172200
Buggy source:
public void testCheckSourceNodeExists(){
  when(nodeService.exists(any(NodeRef.class))).thenReturn(false);
  RenditionDefinitionImpl definition=new RenditionDefinitionImpl("String_Node_Str",null,TestRenderingEngine.NAME);
  try {
    engine.executeImpl(definition,source);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    String expMsg="String_Node_Str";
    assertEquals(expMsg,e.getMessage());
  }
}

Fixed version (ground truth):
public void testCheckSourceNodeExists(){
  when(nodeService.exists(any(NodeRef.class))).thenReturn(false);
  RenditionDefinitionImpl definition=new RenditionDefinitionImpl("String_Node_Str",null,TestRenderingEngine.NAME);
  try {
    engine.executeImpl(definition,source);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    assertTrue(e.getMessage().endsWith("String_Node_Str"));
  }
}
Program: 172201
Project: 172201
Buggy source:
@SuppressWarnings("String_Node_Str") public void testGetCheckedParameter(){
  when(nodeService.exists(source)).thenReturn(true);
  ChildAssociationRef renditionAssoc=makeRenditionAssoc();
  RenditionDefinition definition=makeRenditionDefinition(renditionAssoc);
  when(nodeService.createNode(eq(source),eq(renditionAssoc.getTypeQName()),any(QName.class),any(QName.class),anyMap())).thenReturn(renditionAssoc);
  engine.executeImpl(definition,source);
  RenderingContext context=engine.getContext();
  String paramName="String_Node_Str";
  String result=context.getCheckedParam(paramName,String.class);
  assertNull(result);
  String value="String_Node_Str";
  definition.setParameterValue(paramName,value);
  engine.executeImpl(definition,source);
  context=engine.getContext();
  result=context.getCheckedParam(paramName,String.class);
  assertEquals(value,result);
  try {
    context.getCheckedParam(paramName,Boolean.class);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    String msg="String_Node_Str";
    assertEquals(msg,e.getMessage());
  }
  try {
    context.getCheckedParam(paramName,null);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    String msg="String_Node_Str";
    assertEquals(msg,e.getMessage());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testGetCheckedParameter(){
  when(nodeService.exists(source)).thenReturn(true);
  ChildAssociationRef renditionAssoc=makeRenditionAssoc();
  RenditionDefinition definition=makeRenditionDefinition(renditionAssoc);
  when(nodeService.createNode(eq(source),eq(renditionAssoc.getTypeQName()),any(QName.class),any(QName.class),anyMap())).thenReturn(renditionAssoc);
  engine.executeImpl(definition,source);
  RenderingContext context=engine.getContext();
  String paramName="String_Node_Str";
  String result=context.getCheckedParam(paramName,String.class);
  assertNull(result);
  String value="String_Node_Str";
  definition.setParameterValue(paramName,value);
  engine.executeImpl(definition,source);
  context=engine.getContext();
  result=context.getCheckedParam(paramName,String.class);
  assertEquals(value,result);
  try {
    context.getCheckedParam(paramName,Boolean.class);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    assertTrue(e.getMessage().endsWith("String_Node_Str"));
  }
  try {
    context.getCheckedParam(paramName,null);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    assertTrue(e.getMessage().endsWith("String_Node_Str"));
  }
}
Program: 172202
Project: 172202
Buggy source:
@SuppressWarnings("String_Node_Str") public void testGetParameterWithDefault(){
  when(nodeService.exists(source)).thenReturn(true);
  ChildAssociationRef renditionAssoc=makeRenditionAssoc();
  RenditionDefinition definition=makeRenditionDefinition(renditionAssoc);
  when(nodeService.createNode(eq(source),eq(renditionAssoc.getTypeQName()),any(QName.class),any(QName.class),anyMap())).thenReturn(renditionAssoc);
  engine.executeImpl(definition,source);
  RenderingContext context=engine.getContext();
  String paramName="String_Node_Str";
  String defaultValue="String_Node_Str";
  Object result=context.getParamWithDefault(paramName,defaultValue);
  assertEquals(defaultValue,result);
  String value="String_Node_Str";
  definition.setParameterValue(paramName,value);
  engine.executeImpl(definition,source);
  context=engine.getContext();
  result=context.getParamWithDefault(paramName,defaultValue);
  assertEquals(value,result);
  try {
    result=context.getParamWithDefault(paramName,null);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    String msg="String_Node_Str";
    assertEquals(msg,e.getMessage());
  }
  try {
    result=context.getParamWithDefault(paramName,Boolean.TRUE);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    String msg="String_Node_Str";
    assertEquals(msg,e.getMessage());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void testGetParameterWithDefault(){
  when(nodeService.exists(source)).thenReturn(true);
  ChildAssociationRef renditionAssoc=makeRenditionAssoc();
  RenditionDefinition definition=makeRenditionDefinition(renditionAssoc);
  when(nodeService.createNode(eq(source),eq(renditionAssoc.getTypeQName()),any(QName.class),any(QName.class),anyMap())).thenReturn(renditionAssoc);
  engine.executeImpl(definition,source);
  RenderingContext context=engine.getContext();
  String paramName="String_Node_Str";
  String defaultValue="String_Node_Str";
  Object result=context.getParamWithDefault(paramName,defaultValue);
  assertEquals(defaultValue,result);
  String value="String_Node_Str";
  definition.setParameterValue(paramName,value);
  engine.executeImpl(definition,source);
  context=engine.getContext();
  result=context.getParamWithDefault(paramName,defaultValue);
  assertEquals(value,result);
  try {
    result=context.getParamWithDefault(paramName,null);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    assertTrue(e.getMessage().endsWith("String_Node_Str"));
  }
  try {
    result=context.getParamWithDefault(paramName,Boolean.TRUE);
    fail("String_Node_Str");
  }
 catch (  RenditionServiceException e) {
    assertTrue(e.getMessage().endsWith("String_Node_Str"));
  }
}
Program: 172204
Project: 172204
Buggy source:
public Object invoke(MethodInvocation invocation) throws Throwable {
  ACLEntryVoter voter=new ACLEntryVoter();
  voter.setNamespacePrefixResolver(namespacePrefixResolver);
  voter.setPermissionService(permissionService);
  voter.setNodeService(nodeService);
  voter.setAuthenticationService(authenticationService);
  voter.setAuthorityService(authorityService);
  if (!(voter.vote(null,invocation,cad) == AccessDecisionVoter.ACCESS_DENIED)) {
    return invocation.proceed();
  }
 else {
    throw new ACLEntryVoterException("String_Node_Str");
  }
}

Fixed version (ground truth):
public Object invoke(MethodInvocation invocation) throws Throwable {
  ACLEntryVoter voter=new ACLEntryVoter();
  voter.setNamespacePrefixResolver(namespacePrefixResolver);
  voter.setPermissionService(permissionService);
  voter.setNodeService(nodeService);
  voter.setAuthenticationService(authenticationService);
  voter.setAuthorityService(authorityService);
  Set<String> abstainFor=new HashSet<String>(1);
  abstainFor.add("String_Node_Str");
  voter.setAbstainFor(abstainFor);
  voter.afterPropertiesSet();
  if (!(voter.vote(null,invocation,cad) == AccessDecisionVoter.ACCESS_DENIED)) {
    return invocation.proceed();
  }
 else {
    throw new ACLEntryVoterException("String_Node_Str");
  }
}
Program: 172205
Project: 172205
Buggy source:
public AVMStoreDescriptor(long id,String name,String creator,long createDate){
  fName=name;
  fCreator=creator;
  fCreateDate=createDate;
}

Fixed version (ground truth):
public AVMStoreDescriptor(long id,String name,String creator,long createDate){
  fID=id;
  fName=name;
  fCreator=creator;
  fCreateDate=createDate;
}
Program: 172207
Project: 172207
Buggy source:
public void copy(NodeRef sourceNodeRef,NodeRef targetNodeRef){
  QName sourceNodeTypeQName=nodeService.getType(sourceNodeRef);
  QName targetNodeTypeQName=nodeService.getType(targetNodeRef);
  if (!sourceNodeTypeQName.equals(targetNodeTypeQName)) {
    throw new CopyServiceException("String_Node_Str");
  }
  Map<QName,Serializable> sourceNodeProperties=nodeService.getProperties(sourceNodeRef);
  ChildAssociationRef destinationPrimaryAssocRef=nodeService.getPrimaryParent(targetNodeRef);
  NodeRef destinationParentNodeRef=destinationPrimaryAssocRef.getParentRef();
  QName assocTypeQName=destinationPrimaryAssocRef.getTypeQName();
  QName assocQName=destinationPrimaryAssocRef.getQName();
  CopyDetails copyDetails=getCopyDetails(sourceNodeRef,destinationParentNodeRef,targetNodeRef,assocTypeQName,assocQName);
  Map<QName,CopyBehaviourCallback> callbacks=getCallbacks(copyDetails);
  sourceNodeProperties.remove(ContentModel.PROP_NAME);
  copyProperties(copyDetails,targetNodeRef,sourceNodeTypeQName,callbacks);
  copyAspects(copyDetails,targetNodeRef,Collections.<QName>emptySet(),callbacks);
  copyResidualProperties(copyDetails,targetNodeRef);
  Map<NodeRef,NodeRef> copiedNodeRefs=new HashMap<NodeRef,NodeRef>(1);
  copiedNodeRefs.put(sourceNodeRef,targetNodeRef);
  invokeCopyComplete(sourceNodeRef,targetNodeRef,false,copiedNodeRefs);
}

Fixed version (ground truth):
public void copy(NodeRef sourceNodeRef,NodeRef targetNodeRef){
  QName sourceNodeTypeQName=nodeService.getType(sourceNodeRef);
  QName targetNodeTypeQName=nodeService.getType(targetNodeRef);
  if (!sourceNodeTypeQName.equals(targetNodeTypeQName)) {
    throw new CopyServiceException("String_Node_Str");
  }
  Map<QName,Serializable> sourceNodeProperties=nodeService.getProperties(sourceNodeRef);
  ChildAssociationRef destinationPrimaryAssocRef=nodeService.getPrimaryParent(targetNodeRef);
  NodeRef destinationParentNodeRef=destinationPrimaryAssocRef.getParentRef();
  QName assocTypeQName=destinationPrimaryAssocRef.getTypeQName();
  QName assocQName=destinationPrimaryAssocRef.getQName();
  CopyDetails copyDetails=getCopyDetails(sourceNodeRef,destinationParentNodeRef,targetNodeRef,assocTypeQName,assocQName);
  Map<QName,CopyBehaviourCallback> callbacks=getCallbacks(copyDetails);
  sourceNodeProperties.remove(ContentModel.PROP_NAME);
  invokeBeforeCopy(sourceNodeRef,targetNodeRef);
  copyProperties(copyDetails,targetNodeRef,sourceNodeTypeQName,callbacks);
  copyAspects(copyDetails,targetNodeRef,Collections.<QName>emptySet(),callbacks);
  copyResidualProperties(copyDetails,targetNodeRef);
  Map<NodeRef,NodeRef> copiedNodeRefs=new HashMap<NodeRef,NodeRef>(1);
  copiedNodeRefs.put(sourceNodeRef,targetNodeRef);
  invokeCopyComplete(sourceNodeRef,targetNodeRef,false,copiedNodeRefs);
}
Program: 172208
Project: 172208
Buggy source:
/** 
 * Initialise method
 */
public void init(){
  onCopyNodeDelegate=policyComponent.registerClassPolicy(CopyServicePolicies.OnCopyNodePolicy.class);
  onCopyCompleteDelegate=policyComponent.registerClassPolicy(CopyServicePolicies.OnCopyCompletePolicy.class);
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.ASPECT_COPIEDFROM,new JavaBehaviour(this,"String_Node_Str"));
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.TYPE_FOLDER,new JavaBehaviour(this,"String_Node_Str"));
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.ASPECT_OWNABLE,new JavaBehaviour(this,"String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Initialise method
 */
public void init(){
  onCopyNodeDelegate=policyComponent.registerClassPolicy(CopyServicePolicies.OnCopyNodePolicy.class);
  onCopyCompleteDelegate=policyComponent.registerClassPolicy(CopyServicePolicies.OnCopyCompletePolicy.class);
  beforeCopyDelegate=policyComponent.registerClassPolicy(CopyServicePolicies.BeforeCopyPolicy.class);
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.ASPECT_COPIEDFROM,new JavaBehaviour(this,"String_Node_Str"));
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.TYPE_FOLDER,new JavaBehaviour(this,"String_Node_Str"));
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.ASPECT_OWNABLE,new JavaBehaviour(this,"String_Node_Str"));
}
Program: 172209
Project: 172209
Buggy source:
/** 
 * @param classRef          the type of the node that was copied
 * @param sourceNodeRef     the origional node
 * @param targetNodeRef     the destination node
 * @param copyMap           a map containing all the nodes that have been created during the copy
 */
public void onCopyComplete(QName classRef,NodeRef sourceNodeRef,NodeRef targetNodeRef,boolean copyToNewNode,Map<NodeRef,NodeRef> copyMap);

Fixed version (ground truth):
/** 
 * @param classRef          the type of the node that was copied
 * @param sourceNodeRef     the original node
 * @param targetNodeRef     the destination node
 * @param copyMap           a map containing all the nodes that have been created during the copy
 */
public void onCopyComplete(QName classRef,NodeRef sourceNodeRef,NodeRef targetNodeRef,boolean copyToNewNode,Map<NodeRef,NodeRef> copyMap);
Program: 172210
Project: 172210
Buggy source:
/** 
 * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
 */
public void beforeDeleteNode(NodeRef nodeRef){
  if (this.nodeService.exists(nodeRef) == true && this.nodeService.hasAspect(nodeRef,ContentModel.ASPECT_TAGGABLE) == true && this.nodeService.hasAspect(nodeRef,ContentModel.ASPECT_WORKING_COPY) == false) {
    updateAllScopeTags(nodeRef,Boolean.FALSE);
  }
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
 */
public void beforeDeleteNode(NodeRef nodeRef){
  if (this.nodeService.exists(nodeRef) == true && this.nodeService.hasAspect(nodeRef,ContentModel.ASPECT_TAGGABLE) == true) {
    updateAllScopeTags(nodeRef,Boolean.FALSE);
  }
}
Program: 172211
Project: 172211
Buggy source:
/** 
 * Init method
 */
public void init(){
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
  createTagBehaviour=new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.FIRST_EVENT);
  this.policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME,ContentModel.ASPECT_TAGGABLE,createTagBehaviour);
  updateTagBehaviour=new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT);
  this.policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME,ContentModel.TYPE_CONTENT,updateTagBehaviour);
  this.policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME,ContentModel.TYPE_FOLDER,updateTagBehaviour);
  this.policyComponent.bindClassBehaviour(OnCopyCompletePolicy.QNAME,ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
  this.policyComponent.bindClassBehaviour(OnMoveNodePolicy.QNAME,ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
}

Fixed version (ground truth):
/** 
 * Init method
 */
public void init(){
  this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"String_Node_Str"),ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
  createTagBehaviour=new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.FIRST_EVENT);
  this.policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME,ContentModel.ASPECT_TAGGABLE,createTagBehaviour);
  updateTagBehaviour=new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT);
  this.policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME,ContentModel.TYPE_CONTENT,updateTagBehaviour);
  this.policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME,ContentModel.TYPE_FOLDER,updateTagBehaviour);
  this.policyComponent.bindClassBehaviour(OnMoveNodePolicy.QNAME,ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
  this.policyComponent.bindClassBehaviour(BeforeCopyPolicy.QNAME,ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
  this.policyComponent.bindClassBehaviour(OnCopyCompletePolicy.QNAME,ContentModel.ASPECT_TAGGABLE,new JavaBehaviour(this,"String_Node_Str",NotificationFrequency.EVERY_EVENT));
}
Program: 172212
Project: 172212
Buggy source:
public void onCopyComplete(QName classRef,NodeRef sourceNodeRef,NodeRef targetNodeRef,boolean copyToNewNode,Map<NodeRef,NodeRef> copyMap){
  if (this.nodeService.hasAspect(targetNodeRef,ContentModel.ASPECT_TAGGABLE)) {
    updateAllScopeTags(targetNodeRef,Boolean.TRUE);
  }
}

Fixed version (ground truth):
/** 
 * Fired once per node that was copied, after the copy has completed.  We need to add in all the tags to the scope.
 */
public void onCopyComplete(QName classRef,NodeRef sourceNodeRef,NodeRef targetNodeRef,boolean copyToNewNode,Map<NodeRef,NodeRef> copyMap){
  if (this.nodeService.hasAspect(targetNodeRef,ContentModel.ASPECT_TAGGABLE)) {
    updateAllScopeTags(targetNodeRef,Boolean.TRUE);
  }
}