nus-yam/ex-repair huggingface dataset:
Program: 172101
Project: 172101
Buggy source:
/** 
 * Gets the version type
 * @return  "MAJOR", "MINOR"
 */
public String getType(){
  return version.getVersionType().name();
}

Fixed version (ground truth):
/** 
 * Gets the version type
 * @return  "MAJOR", "MINOR"
 */
public String getType(){
  if (version.getVersionType() != null) {
    return version.getVersionType().name();
  }
 else {
    return "String_Node_Str";
  }
}
Program: 172102
Project: 172102
Buggy source:
/** 
 * Gets the date the version was created
 * @return  the date the version was created
 */
public Object getCreatedDate(){
  return converter.convertValueForScript(services,scope,null,version.getCreatedDate());
}

Fixed version (ground truth):
/** 
 * Gets the date the version was created
 * @return  the date the version was created
 */
public Date getCreatedDate(){
  return version.getCreatedDate();
}
Program: 172104
Project: 172104
Buggy source:
/** 
 * Makes use of the encoding, if available, to convert the string to bytes.
 * @see ContentAccessor#getEncoding()
 */
public final void putContent(String content) throws ContentIOException {
  try {
    String encoding=getEncoding();
    byte[] bytes;
    if (encoding == null) {
      bytes=content.getBytes();
      setEncoding(System.getProperty("String_Node_Str"));
    }
 else {
      bytes=content.getBytes(encoding);
    }
    OutputStream os=getContentOutputStream();
    ByteArrayInputStream is=new ByteArrayInputStream(bytes);
    FileCopyUtils.copy(is,os);
  }
 catch (  IOException e) {
    throw new ContentIOException("String_Node_Str" + "String_Node_Str" + this + "String_Node_Str"+ content.length(),e);
  }
}

Fixed version (ground truth):
/** 
 * Makes use of the encoding, if available, to convert the string to bytes.
 * @see ContentAccessor#getEncoding()
 */
public final void putContent(String content) throws ContentIOException {
  try {
    String encoding=getEncoding();
    byte[] bytes;
    if (encoding == null) {
      bytes=content.getBytes();
      setEncoding(System.getProperty("String_Node_Str"));
    }
 else {
      bytes=content.getBytes(encoding);
    }
    OutputStream os=getContentOutputStream();
    ByteArrayInputStream is=new ByteArrayInputStream(bytes);
    copyStreams(is,os);
  }
 catch (  IOException e) {
    throw new ContentIOException("String_Node_Str" + "String_Node_Str" + this + "String_Node_Str"+ content.length(),e);
  }
}
Program: 172107
Project: 172107
Buggy source:
protected void logCreated(NodeRef sourceNode,NodeRef destNode,NodeRef newParentNode,Path parentPath,boolean orphan){
  receiver.getProgressMonitor().logCreated(transferId,sourceNode,destNode,newParentNode,parentPath,orphan);
}

Fixed version (ground truth):
protected void logCreated(NodeRef sourceNode,NodeRef destNode,NodeRef newParentNode,String parentPath,boolean orphan){
  receiver.getProgressMonitor().logCreated(transferId,sourceNode,destNode,newParentNode,parentPath,orphan);
}
Program: 172108
Project: 172108
Buggy source:
protected void logMoved(NodeRef sourceNode,NodeRef destNode,Path oldPath,NodeRef newParent,Path newPath){
  receiver.getProgressMonitor().logMoved(transferId,sourceNode,destNode,oldPath,newParent,newPath);
}

Fixed version (ground truth):
protected void logMoved(NodeRef sourceNode,NodeRef destNode,String oldPath,NodeRef newParent,String newPath){
  receiver.getProgressMonitor().logMoved(transferId,sourceNode,destNode,oldPath,newParent,newPath);
}
Program: 172109
Project: 172109
Buggy source:
protected void logDeleted(NodeRef sourceNode,NodeRef destNode,Path parentPath){
  receiver.getProgressMonitor().logDeleted(transferId,sourceNode,destNode,parentPath);
}

Fixed version (ground truth):
protected void logDeleted(NodeRef sourceNode,NodeRef destNode,String parentPath){
  receiver.getProgressMonitor().logDeleted(transferId,sourceNode,destNode,parentPath);
}
Program: 172110
Project: 172110
Buggy source:
protected void logUpdated(NodeRef sourceNode,NodeRef destNode,Path newPath){
  receiver.getProgressMonitor().logUpdated(transferId,sourceNode,destNode,newPath);
}

Fixed version (ground truth):
protected void logUpdated(NodeRef sourceNode,NodeRef destNode,String newPath){
  receiver.getProgressMonitor().logUpdated(transferId,sourceNode,destNode,newPath);
}
Program: 172111
Project: 172111
Buggy source:
@Override public void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef parentNodeRef,Path parentPath,boolean orphan){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeCreated(sourceNode,destNode,parentNodeRef,parentPath);
}

Fixed version (ground truth):
@Override public void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef parentNodeRef,String parentPath,boolean orphan){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeCreated(sourceNode,destNode,parentNodeRef,parentPath);
}
Program: 172112
Project: 172112
Buggy source:
@Override public void logMoved(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,Path oldPath,NodeRef newParentNodeRef,Path newPath){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeMoved(sourceNodeRef,destNodeRef,oldPath,newParentNodeRef,newPath);
}

Fixed version (ground truth):
@Override public void logMoved(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,String oldPath,NodeRef newParentNodeRef,String newPath){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeMoved(sourceNodeRef,destNodeRef,oldPath,newParentNodeRef,newPath);
}
Program: 172113
Project: 172113
Buggy source:
@Override public void logDeleted(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,Path oldPath){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeDeleted(sourceNodeRef,destNodeRef,oldPath);
}

Fixed version (ground truth):
@Override public void logDeleted(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,String oldPath){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeDeleted(sourceNodeRef,destNodeRef,oldPath);
}
Program: 172114
Project: 172114
Buggy source:
@Override public void logUpdated(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,Path path){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeUpdated(sourceNodeRef,destNodeRef,path);
}

Fixed version (ground truth):
@Override public void logUpdated(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,String path){
  TransferDestinationReportWriter writer=getLogWriter(transferId);
  writer.writeUpdated(sourceNodeRef,destNodeRef,path);
}
Program: 172115
Project: 172115
Buggy source:
public void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef newParent,Path newPath,boolean orphan){
  delegate.logCreated(transferId,sourceNode,destNode,newParent,newPath,orphan);
  getChangesRecord(transferId).addCreatedNode(destNode);
}

Fixed version (ground truth):
public void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef newParent,String newPath,boolean orphan){
  delegate.logCreated(transferId,sourceNode,destNode,newParent,newPath,orphan);
  getChangesRecord(transferId).addCreatedNode(destNode);
}
Program: 172116
Project: 172116
Buggy source:
public void logMoved(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,Path oldPath,NodeRef newParent,Path newPath){
  delegate.logMoved(transferId,sourceNodeRef,destNodeRef,oldPath,newParent,newPath);
}

Fixed version (ground truth):
public void logMoved(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,String oldPath,NodeRef newParent,String newPath){
  delegate.logMoved(transferId,sourceNodeRef,destNodeRef,oldPath,newParent,newPath);
}
Program: 172117
Project: 172117
Buggy source:
public void logDeleted(String transferId,NodeRef sourceNode,NodeRef destNode,Path parentPath){
  delegate.logDeleted(transferId,sourceNode,destNode,parentPath);
  getChangesRecord(transferId).addDeletedNode(destNode);
}

Fixed version (ground truth):
public void logDeleted(String transferId,NodeRef sourceNode,NodeRef destNode,String parentPath){
  delegate.logDeleted(transferId,sourceNode,destNode,parentPath);
  getChangesRecord(transferId).addDeletedNode(destNode);
}
Program: 172118
Project: 172118
Buggy source:
public void logUpdated(String transferId,NodeRef sourceNode,NodeRef destNode,Path parentPath){
  delegate.logUpdated(transferId,sourceNode,destNode,parentPath);
  getChangesRecord(transferId).addUpdatedNode(destNode);
}

Fixed version (ground truth):
public void logUpdated(String transferId,NodeRef sourceNode,NodeRef destNode,String parentPath){
  delegate.logUpdated(transferId,sourceNode,destNode,parentPath);
  getChangesRecord(transferId).addUpdatedNode(destNode);
}
Program: 172119
Project: 172119
Buggy source:
@Override public void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef parentNode,Path parentPath,boolean orphan){
  delegate.logCreated(transferId,sourceNode,destNode,parentNode,parentPath,orphan);
}

Fixed version (ground truth):
@Override public void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef parentNode,String parentPath,boolean orphan){
  delegate.logCreated(transferId,sourceNode,destNode,parentNode,parentPath,orphan);
}
Program: 172120
Project: 172120
Buggy source:
@Override public void logMoved(String transferId,NodeRef sourceNode,NodeRef destNode,Path oldPath,NodeRef parentNodeRef,Path parentPath){
  delegate.logMoved(transferId,sourceNode,destNode,oldPath,parentNodeRef,parentPath);
}

Fixed version (ground truth):
@Override public void logMoved(String transferId,NodeRef sourceNode,NodeRef destNode,String oldPath,NodeRef parentNodeRef,String parentPath){
  delegate.logMoved(transferId,sourceNode,destNode,oldPath,parentNodeRef,parentPath);
}
Program: 172121
Project: 172121
Buggy source:
@Override public void logDeleted(String transferId,NodeRef sourceNode,NodeRef destNode,Path parentPath){
  delegate.logDeleted(transferId,sourceNode,destNode,parentPath);
}

Fixed version (ground truth):
@Override public void logDeleted(String transferId,NodeRef sourceNode,NodeRef destNode,String parentPath){
  delegate.logDeleted(transferId,sourceNode,destNode,parentPath);
}
Program: 172122
Project: 172122
Buggy source:
@Override public void logUpdated(String transferId,NodeRef sourceNode,NodeRef destNode,Path parentPath){
  delegate.logUpdated(transferId,sourceNode,destNode,parentPath);
}

Fixed version (ground truth):
@Override public void logUpdated(String transferId,NodeRef sourceNode,NodeRef destNode,String parentPath){
  delegate.logUpdated(transferId,sourceNode,destNode,parentPath);
}
Program: 172124
Project: 172124
Buggy source:
/** 
 * Delete this node
 * @param exNode
 */
protected void delete(TransferManifestDeletedNode node,NodeRef nodeToDelete){
  if (alienProcessor.isAlien(nodeToDelete)) {
    logComment("String_Node_Str" + nodeToDelete);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + nodeToDelete);
    }
    alienProcessor.pruneNode(nodeToDelete,header.getRepositoryId());
  }
 else {
    if (nodeService.hasAspect(nodeToDelete,TransferModel.ASPECT_TRANSFERRED)) {
      String fromRepository=(String)nodeService.getProperty(nodeToDelete,TransferModel.PROP_FROM_REPOSITORY_ID);
      String transferringRepo=header.getRepositoryId();
      if (fromRepository != null && transferringRepo != null) {
        if (!fromRepository.equalsIgnoreCase(transferringRepo)) {
          logComment("String_Node_Str" + nodeToDelete);
          return;
        }
      }
    }
    logDeleted(node.getNodeRef(),nodeToDelete,nodeService.getPath(nodeToDelete));
    nodeService.deleteNode(nodeToDelete);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + nodeToDelete);
    }
  }
}

Fixed version (ground truth):
/** 
 * Delete this node
 * @param exNode
 */
protected void delete(TransferManifestDeletedNode node,NodeRef nodeToDelete){
  if (alienProcessor.isAlien(nodeToDelete)) {
    logComment("String_Node_Str" + nodeToDelete);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + nodeToDelete);
    }
    alienProcessor.pruneNode(nodeToDelete,header.getRepositoryId());
  }
 else {
    if (nodeService.hasAspect(nodeToDelete,TransferModel.ASPECT_TRANSFERRED)) {
      String fromRepository=(String)nodeService.getProperty(nodeToDelete,TransferModel.PROP_FROM_REPOSITORY_ID);
      String transferringRepo=header.getRepositoryId();
      if (fromRepository != null && transferringRepo != null) {
        if (!fromRepository.equalsIgnoreCase(transferringRepo)) {
          logComment("String_Node_Str" + nodeToDelete);
          return;
        }
      }
    }
    logDeleted(node.getNodeRef(),nodeToDelete,nodeService.getPath(nodeToDelete).toString());
    nodeService.deleteNode(nodeToDelete);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + nodeToDelete);
    }
  }
}
Program: 172126
Project: 172126
Buggy source:
/** 
 * inject transferred
 */
private void injectTransferred(Map<QName,Serializable> props){
  if (!props.containsKey(TransferModel.PROP_REPOSITORY_ID)) {
    log.debug("String_Node_Str");
    props.put(TransferModel.PROP_REPOSITORY_ID,header.getRepositoryId());
  }
  props.put(TransferModel.PROP_FROM_REPOSITORY_ID,header.getRepositoryId());
  List<String> contentProps=new ArrayList();
  for (  Serializable value : props.values()) {
    if ((value != null) && ContentData.class.isAssignableFrom(value.getClass())) {
      ContentData srcContent=(ContentData)value;
      if (srcContent.getContentUrl() != null && !srcContent.getContentUrl().isEmpty()) {
        log.debug("String_Node_Str");
        contentProps.add(TransferCommons.URLToPartName(srcContent.getContentUrl()));
      }
    }
  }
  props.put(TransferModel.PROP_FROM_CONTENT,(Serializable)contentProps);
}

Fixed version (ground truth):
/** 
 * inject transferred
 */
private void injectTransferred(Map<QName,Serializable> props){
  if (!props.containsKey(TransferModel.PROP_REPOSITORY_ID)) {
    log.debug("String_Node_Str");
    props.put(TransferModel.PROP_REPOSITORY_ID,header.getRepositoryId());
  }
  props.put(TransferModel.PROP_FROM_REPOSITORY_ID,header.getRepositoryId());
  List<String> contentProps=new ArrayList<String>();
  for (  Serializable value : props.values()) {
    if ((value != null) && ContentData.class.isAssignableFrom(value.getClass())) {
      ContentData srcContent=(ContentData)value;
      if (srcContent.getContentUrl() != null && !srcContent.getContentUrl().isEmpty()) {
        log.debug("String_Node_Str");
        contentProps.add(TransferCommons.URLToPartName(srcContent.getContentUrl()));
      }
    }
  }
  props.put(TransferModel.PROP_FROM_CONTENT,(Serializable)contentProps);
}
Program: 172128
Project: 172128
Buggy source:
/** 
 * Reporting a node moved
 */
public void writeMoved(NodeRef sourceNodeRef,NodeRef movedNodeRef,Path oldPath,NodeRef newParentNodeRef,Path newPath);

Fixed version (ground truth):
/** 
 * Reporting a node moved
 */
public void writeMoved(NodeRef sourceNodeRef,NodeRef movedNodeRef,String oldPath,NodeRef newParentNodeRef,String newPath);
Program: 172129
Project: 172129
Buggy source:
/** 
 * Reporting creation of a new node
 */
public void writeCreated(NodeRef sourceNodeRef,NodeRef newNodeRef,NodeRef newParentNodeRef,Path newPath);

Fixed version (ground truth):
/** 
 * Reporting creation of a new node
 */
public void writeCreated(NodeRef sourceNodeRef,NodeRef newNodeRef,NodeRef newParentNodeRef,String newPath);
Program: 172130
Project: 172130
Buggy source:
/** 
 * Reporting a node deleted
 */
public void writeDeleted(NodeRef sourceNodeRef,NodeRef deletedNode,Path oldPath);

Fixed version (ground truth):
/** 
 * Reporting a node deleted
 */
public void writeDeleted(NodeRef sourceNodeRef,NodeRef deletedNode,String oldPath);
Program: 172131
Project: 172131
Buggy source:
/** 
 * Reporting update of an existing node
 */
public void writeUpdated(NodeRef sourceNodeRef,NodeRef updatedNode,Path updatedPath);

Fixed version (ground truth):
/** 
 * Reporting update of an existing node
 */
public void writeUpdated(NodeRef sourceNodeRef,NodeRef updatedNode,String updatedPath);
Program: 172132
Project: 172132
Buggy source:
/** 
 * Log the creation of a new node
 * @param transferId
 * @param sourceNode
 * @param destNode
 * @param newPath
 * @param orphan
 */
void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef newParent,Path newPath,boolean orphan);

Fixed version (ground truth):
/** 
 * Log the creation of a new node
 * @param transferId
 * @param sourceNode
 * @param destNode
 * @param newPath
 * @param orphan
 */
void logCreated(String transferId,NodeRef sourceNode,NodeRef destNode,NodeRef newParent,String newPath,boolean orphan);
Program: 172133
Project: 172133
Buggy source:
/** 
 * Log the deletion of a node
 * @param transferId
 * @param sourceNode
 * @param destNode
 * @param parentPath
 * @param orphan
 */
void logDeleted(String transferId,NodeRef sourceNode,NodeRef destNode,Path parentPath);

Fixed version (ground truth):
/** 
 * Log the deletion of a node
 * @param transferId
 * @param sourceNode
 * @param destNode
 * @param path The path of the deleted node
 * @param orphan
 */
void logDeleted(String transferId,NodeRef sourceNode,NodeRef destNode,String path);
Program: 172134
Project: 172134
Buggy source:
/** 
 * Log the creation of a new node
 * @param transferId
 * @param sourceNode
 * @param destNode
 * @param parentPath
 * @param orphan
 */
void logUpdated(String transferId,NodeRef sourceNode,NodeRef destNode,Path parentPath);

Fixed version (ground truth):
/** 
 * Log the creation of a new node
 * @param transferId
 * @param sourceNode
 * @param destNode
 * @param path The path of the updated node
 * @param orphan
 */
void logUpdated(String transferId,NodeRef sourceNode,NodeRef destNode,String path);
Program: 172135
Project: 172135
Buggy source:
/** 
 * After the transfer has completed this method reads the log.
 * @param transferId
 * @return the log
 */
void logMoved(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,Path oldPath,NodeRef newParent,Path newPath);

Fixed version (ground truth):
/** 
 * After the transfer has completed this method reads the log.
 * @param transferId
 * @return the log
 */
void logMoved(String transferId,NodeRef sourceNodeRef,NodeRef destNodeRef,String oldPath,NodeRef newParent,String newPath);
Program: 172136
Project: 172136
Buggy source:
@Override public Object answer(InvocationOnMock invocation) throws Throwable {
  OutputStream os=(OutputStream)invocation.getArguments()[1];
  Writer writer=new OutputStreamWriter(os);
  XMLTransferDestinationReportWriter reportWriter=new XMLTransferDestinationReportWriter();
  reportWriter.startTransferReport("String_Node_Str",writer);
  reportWriter.writeComment("String_Node_Str");
  reportWriter.writeChangeState("String_Node_Str");
  reportWriter.writeCreated(file1,file1,folder1,new Path());
  reportWriter.writeDeleted(file3,file3,new Path());
  reportWriter.writeMoved(file2,file2,new Path(),folder1,new Path());
  reportWriter.endTransferReport();
  return null;
}

Fixed version (ground truth):
@Override public Object answer(InvocationOnMock invocation) throws Throwable {
  OutputStream os=(OutputStream)invocation.getArguments()[1];
  Writer writer=new OutputStreamWriter(os);
  XMLTransferDestinationReportWriter reportWriter=new XMLTransferDestinationReportWriter();
  reportWriter.startTransferReport("String_Node_Str",writer);
  reportWriter.writeComment("String_Node_Str");
  reportWriter.writeChangeState("String_Node_Str");
  reportWriter.writeCreated(file1,file1,folder1,"String_Node_Str");
  reportWriter.writeDeleted(file3,file3,"String_Node_Str");
  reportWriter.writeMoved(file2,file2,"String_Node_Str",folder1,"String_Node_Str");
  reportWriter.endTransferReport();
  return null;
}
Program: 172138
Project: 172138
Buggy source:
private String guessEncoding(InputStream in){
  String encoding="String_Node_Str";
  try {
    if (in != null) {
      Charset charset=services.getMimetypeService().getContentCharsetFinder().getCharset(in,getMimetype());
      encoding=charset.name();
    }
  }
  finally {
    try {
      if (in != null) {
        in.close();
      }
    }
 catch (    IOException ioErr) {
    }
  }
  return encoding;
}

Fixed version (ground truth):
private String guessEncoding(InputStream in,boolean close){
  String encoding="String_Node_Str";
  try {
    if (in != null) {
      Charset charset=services.getMimetypeService().getContentCharsetFinder().getCharset(in,getMimetype());
      encoding=charset.name();
    }
  }
  finally {
    try {
      if (close && in != null) {
        in.close();
      }
    }
 catch (    IOException ioErr) {
    }
  }
  return encoding;
}
Program: 172139
Project: 172139
Buggy source:
private List<SiteInfo> listSitesImpl(final String userName,int size){
  final int maxResults=size > 0 ? size : 1000;
  final Set<String> siteNames=new TreeSet<String>();
  authorityService.getContainingAuthoritiesInZone(AuthorityType.GROUP,userName,AuthorityService.ZONE_APP_SHARE,new AuthorityFilter(){
    @Override public boolean includeAuthority(    String authority){
      String siteName=resolveSite(authority);
      if (siteName == null) {
        return false;
      }
      return siteNames.add(siteName);
    }
  }
,maxResults);
  if (siteNames.isEmpty()) {
    return Collections.emptyList();
  }
  List<ChildAssociationRef> assocs=this.nodeService.getChildrenByName(getSiteRoot(),ContentModel.ASSOC_CONTAINS,siteNames);
  List<SiteInfo> result=new ArrayList<SiteInfo>(assocs.size());
  for (  ChildAssociationRef assoc : assocs) {
    NodeRef site=assoc.getChildRef();
    QName siteClassName=this.directNodeService.getType(site);
    if (this.dictionaryService.isSubClass(siteClassName,SiteModel.TYPE_SITE)) {
      result.add(createSiteInfo(site));
    }
  }
  return result;
}

Fixed version (ground truth):
private List<SiteInfo> listSitesImpl(final String userName,int size){
  final int maxResults=size > 0 ? size : 1000;
  final Set<String> siteNames=new TreeSet<String>();
  authorityService.getContainingAuthoritiesInZone(AuthorityType.GROUP,userName,AuthorityService.ZONE_APP_SHARE,new AuthorityFilter(){
    @Override public boolean includeAuthority(    String authority){
      if (siteNames.size() < maxResults) {
        String siteName=resolveSite(authority);
        if (siteName == null) {
          return false;
        }
        return siteNames.add(siteName);
      }
      return false;
    }
  }
,maxResults);
  if (siteNames.isEmpty()) {
    return Collections.emptyList();
  }
  List<ChildAssociationRef> assocs=this.nodeService.getChildrenByName(getSiteRoot(),ContentModel.ASSOC_CONTAINS,siteNames);
  List<SiteInfo> result=new ArrayList<SiteInfo>(assocs.size());
  for (  ChildAssociationRef assoc : assocs) {
    NodeRef site=assoc.getChildRef();
    QName siteClassName=this.directNodeService.getType(site);
    if (this.dictionaryService.isSubClass(siteClassName,SiteModel.TYPE_SITE)) {
      result.add(createSiteInfo(site));
    }
  }
  return result;
}
Program: 172140
Project: 172140
Buggy source:
@Override public boolean includeAuthority(String authority){
  String siteName=resolveSite(authority);
  if (siteName == null) {
    return false;
  }
  return siteNames.add(siteName);
}

Fixed version (ground truth):
@Override public boolean includeAuthority(String authority){
  if (siteNames.size() < maxResults) {
    String siteName=resolveSite(authority);
    if (siteName == null) {
      return false;
    }
    return siteNames.add(siteName);
  }
  return false;
}
Program: 172141
Project: 172141
Buggy source:
protected void checkProcessNameQuery(List<String> expectedTaskIds,WorkflowTaskState state){
  WorkflowTaskQuery taskQuery=createWorkflowTaskQuery(state);
  taskQuery.setProcessName(getAdhocProcessName());
  checkTasksFoundUsingQuery(expectedTaskIds,taskQuery);
  taskQuery=createWorkflowTaskQuery(state);
  taskQuery.setProcessName(QName.createQName("String_Node_Str"));
  checkNoTasksFoundUsingQuery(taskQuery);
  taskQuery.setWorkflowDefinitionName(getAdhocProcessName().toPrefixString());
  checkTasksFoundUsingQuery(expectedTaskIds,taskQuery);
  taskQuery=createWorkflowTaskQuery(state);
  taskQuery.setWorkflowDefinitionName("String_Node_Str");
  checkNoTasksFoundUsingQuery(taskQuery);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void checkProcessNameQuery(List<String> expectedTaskIds,WorkflowTaskState state){
  WorkflowTaskQuery taskQuery=createWorkflowTaskQuery(state);
  taskQuery.setProcessName(getAdhocProcessName());
  checkTasksFoundUsingQuery(expectedTaskIds,taskQuery);
  taskQuery=createWorkflowTaskQuery(state);
  taskQuery.setProcessName(QName.createQName("String_Node_Str"));
  checkNoTasksFoundUsingQuery(taskQuery);
  taskQuery.setWorkflowDefinitionName(getAdhocProcessName().toPrefixString());
  checkTasksFoundUsingQuery(expectedTaskIds,taskQuery);
  taskQuery=createWorkflowTaskQuery(state);
  taskQuery.setWorkflowDefinitionName("String_Node_Str");
  checkNoTasksFoundUsingQuery(taskQuery);
}
Program: 172143
Project: 172143
Buggy source:
/** 
 * Gets all "in-flight" active workflow instances of the specified Workflow Definition
 * @param workflowDefinitionId  the workflow definition id
 * @return  the list of "in-flight" workflow instances
 */
public List<WorkflowInstance> getActiveWorkflows(String workflowDefinitionId);

Fixed version (ground truth):
/** 
 * Gets all "in-flight" active workflow instances.
 * @return  the list of "in-flight" workflow instances
 * @since 4.0
 */
public List<WorkflowInstance> getActiveWorkflows();
Program: 172144
Project: 172144
Buggy source:
/** 
 * Gets all "in-flight" workflow instances (both active and completed) of the specified Workflow Definition
 * @param workflowDefinitionId  the workflow definition id     
 * @return  the list of "in-flight" workflow instances
 */
public List<WorkflowInstance> getWorkflows(String workflowDefinitionId);

Fixed version (ground truth):
/** 
 * Gets all workflow instances (both active and completed).
 * @return  the list of "in-flight" workflow instances
 * @since 4.0
 */
public List<WorkflowInstance> getWorkflows();
Program: 172145
Project: 172145
Buggy source:
/** 
 * Gets all "in-flight" completed workflow instances of the specified Workflow Definition
 * @param workflowDefinitionId  the workflow definition id
 * @return  the list of "in-flight" workflow instances
 */
public List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId);

Fixed version (ground truth):
/** 
 * Gets all completed workflow instances.
 * @return  the list of "in-flight" workflow instances
 * @since 4.0
 */
public List<WorkflowInstance> getCompletedWorkflows();
Program: 172146
Project: 172146
Buggy source:
public List<WorkflowInstance> getWorkflows(String workflowDefinitionId){
  String engineId=BPMEngineRegistry.getEngineId(workflowDefinitionId);
  WorkflowComponent component=getWorkflowComponent(engineId);
  return component.getWorkflows(workflowDefinitionId);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public List<WorkflowInstance> getWorkflows(){
  List<String> ids=Arrays.asList(registry.getWorkflowComponents());
  return CollectionUtils.transformFlat(ids,new Function<String,Collection<WorkflowInstance>>(){
    public List<WorkflowInstance> apply(    String id){
      WorkflowComponent component=registry.getWorkflowComponent(id);
      return component.getWorkflows();
    }
  }
);
}
Program: 172147
Project: 172147
Buggy source:
public List<WorkflowInstance> getActiveWorkflows(String workflowDefinitionId){
  String engineId=BPMEngineRegistry.getEngineId(workflowDefinitionId);
  WorkflowComponent component=getWorkflowComponent(engineId);
  return component.getActiveWorkflows(workflowDefinitionId);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public List<WorkflowInstance> getActiveWorkflows(){
  List<String> ids=Arrays.asList(registry.getWorkflowComponents());
  return CollectionUtils.transformFlat(ids,new Function<String,Collection<WorkflowInstance>>(){
    public List<WorkflowInstance> apply(    String id){
      WorkflowComponent component=registry.getWorkflowComponent(id);
      return component.getActiveWorkflows();
    }
  }
);
}
Program: 172148
Project: 172148
Buggy source:
public WorkflowInstance getWorkflowById(String workflowId){
  String engineId=BPMEngineRegistry.getEngineId(workflowId);
  WorkflowComponent component=getWorkflowComponent(engineId);
  return component.getWorkflowById(workflowId);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public WorkflowInstance getWorkflowById(String workflowId){
  String engineId=BPMEngineRegistry.getEngineId(workflowId);
  WorkflowComponent component=getWorkflowComponent(engineId);
  return component.getWorkflowById(workflowId);
}
Program: 172149
Project: 172149
Buggy source:
public List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId){
  String engineId=BPMEngineRegistry.getEngineId(workflowDefinitionId);
  WorkflowComponent component=getWorkflowComponent(engineId);
  return component.getCompletedWorkflows(workflowDefinitionId);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public List<WorkflowInstance> getCompletedWorkflows(){
  List<String> ids=Arrays.asList(registry.getWorkflowComponents());
  return CollectionUtils.transformFlat(ids,new Function<String,Collection<WorkflowInstance>>(){
    public List<WorkflowInstance> apply(    String id){
      WorkflowComponent component=registry.getWorkflowComponent(id);
      return component.getCompletedWorkflows();
    }
  }
);
}
Program: 172150
Project: 172150
Buggy source:
public void sendNominatedInvitation(Map<String,Object> executionVariables){
  if (invitationService.isSendEmails()) {
    Map<String,String> properties=makePropertiesFromContextVariables(executionVariables,sendInvitePropertyNames);
    String packageName=WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService).replace("String_Node_Str","String_Node_Str");
    ScriptNode packageNode=(ScriptNode)executionVariables.get(packageName);
    String packageRef=packageNode.getNodeRef().toString();
    properties.put(InviteSender.WF_PACKAGE,packageRef);
    String instanceName=WorkflowModel.PROP_WORKFLOW_INSTANCE_ID.toPrefixString(namespaceService).replace("String_Node_Str","String_Node_Str");
    String instanceId=(String)executionVariables.get(instanceName);
    properties.put(InviteSender.WF_INSTANCE_ID,instanceId);
    inviteSender.sendMail(properties);
  }
}

Fixed version (ground truth):
public void sendNominatedInvitation(String inviteId,Map<String,Object> executionVariables){
  if (invitationService.isSendEmails()) {
    Map<String,String> properties=makePropertiesFromContextVariables(executionVariables,sendInvitePropertyNames);
    String packageName=WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService).replace("String_Node_Str","String_Node_Str");
    ScriptNode packageNode=(ScriptNode)executionVariables.get(packageName);
    String packageRef=packageNode.getNodeRef().toString();
    properties.put(InviteSender.WF_PACKAGE,packageRef);
    properties.put(InviteSender.WF_INSTANCE_ID,inviteId);
    inviteSender.sendMail(properties);
  }
}
Program: 172151
Project: 172151
Buggy source:
@Override public void execute(DelegateExecution execution) throws Exception {
  Map<String,Object> variables=execution.getVariables();
  inviteHelper.sendNominatedInvitation(variables);
}

Fixed version (ground truth):
@Override public void execute(DelegateExecution execution) throws Exception {
  String invitationId=ActivitiConstants.ENGINE_ID + "String_Node_Str" + execution.getProcessInstanceId();
  Map<String,Object> variables=execution.getVariables();
  inviteHelper.sendNominatedInvitation(invitationId,variables);
}
Program: 172152
Project: 172152
Buggy source:
@SuppressWarnings("String_Node_Str") public void execute(final ExecutionContext context) throws Exception {
  Map<String,Object> executionVariables=context.getContextInstance().getVariables();
  inviteHelper.sendNominatedInvitation(executionVariables);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void execute(final ExecutionContext context) throws Exception {
  ContextInstance contextInstance=context.getContextInstance();
  long processId=contextInstance.getProcessInstance().getId();
  String inviteId=JBPMEngine.ENGINE_ID + "String_Node_Str" + processId;
  Map<String,Object> executionVariables=contextInstance.getVariables();
  inviteHelper.sendNominatedInvitation(inviteId,executionVariables);
}
Program: 172153
Project: 172153
Buggy source:
@Override protected void onSetUpInTransaction() throws Exception {
  nodeService=(NodeService)applicationContext.getBean(ServiceRegistry.NODE_SERVICE.getLocalName());
  systemBootstrap=(ImporterBootstrap)applicationContext.getBean("String_Node_Str");
  storeRef=new StoreRef("String_Node_Str","String_Node_Str" + System.currentTimeMillis());
  systemBootstrap.setStoreUrl(storeRef.toString());
  systemBootstrap.bootstrap();
  this.authenticationComponent=(AuthenticationComponent)this.applicationContext.getBean("String_Node_Str");
  this.authenticationComponent.setSystemUserAsCurrentUser();
  System.out.println(NodeStoreInspector.dumpNodeStore(nodeService,storeRef));
}

Fixed version (ground truth):
@Override protected void onSetUpInTransaction() throws Exception {
  nodeService=(NodeService)applicationContext.getBean(ServiceRegistry.NODE_SERVICE.getLocalName());
  systemBootstrap=(ImporterBootstrap)applicationContext.getBean("String_Node_Str");
  storeRef=new StoreRef("String_Node_Str","String_Node_Str" + System.currentTimeMillis());
  systemBootstrap.setStoreUrl(storeRef.toString());
  systemBootstrap.bootstrap();
  this.authenticationComponent=(AuthenticationComponent)this.applicationContext.getBean("String_Node_Str");
  this.authenticationComponent.setSystemUserAsCurrentUser();
}
Program: 172154
Project: 172154
Buggy source:
/** 
 * Attempts to load the license.
 * @return
 */
public String loadLicense();

Fixed version (ground truth):
/** 
 * Attempts to load the license.
 * @return          Returns a message telling the user what happened
 */
public String loadLicense();
Program: 172155
Project: 172155
Buggy source:
private void processBatch(final Long parentNodeId,final String modified){
  RetryingTransactionHelper txnHelper=transactionService.getRetryingTransactionHelper();
  txnHelper.setMaxRetries(1);
  RetryingTransactionCallback<Void> callback=new RetryingTransactionCallback<Void>(){
    @Override public Void execute() throws Throwable {
      policyBehaviourFilter.disableBehaviour();
      AlfrescoTransactionSupport.bindResource(KEY_AUDITABLE_PROPAGATION_DISABLE,Boolean.TRUE);
      Pair<Long,NodeRef> parentNodePair=getNodePair(parentNodeId);
      if (parentNodePair == null) {
        return null;
      }
      addNodeProperty(parentNodeId,ContentModel.PROP_MODIFIED,modified);
      return null;
    }
  }
;
  try {
    txnHelper.doInTransaction(callback,false,true);
    if (isDebugEnabled) {
      logger.debug("String_Node_Str" + parentNodeId);
    }
  }
 catch (  Throwable e) {
    logger.info("String_Node_Str" + parentNodeId);
  }
}

Fixed version (ground truth):
private void processBatch(final Long parentNodeId,final String modified){
  RetryingTransactionHelper txnHelper=transactionService.getRetryingTransactionHelper();
  txnHelper.setMaxRetries(1);
  RetryingTransactionCallback<Void> callback=new RetryingTransactionCallback<Void>(){
    @Override public Void execute() throws Throwable {
      policyBehaviourFilter.disableAllBehaviours();
      AlfrescoTransactionSupport.bindResource(KEY_AUDITABLE_PROPAGATION_DISABLE,Boolean.TRUE);
      Pair<Long,NodeRef> parentNodePair=getNodePair(parentNodeId);
      if (parentNodePair == null) {
        return null;
      }
      addNodeProperty(parentNodeId,ContentModel.PROP_MODIFIED,modified);
      return null;
    }
  }
;
  try {
    txnHelper.doInTransaction(callback,false,true);
    if (isDebugEnabled) {
      logger.debug("String_Node_Str" + parentNodeId);
    }
  }
 catch (  Throwable e) {
    logger.info("String_Node_Str" + parentNodeId);
  }
}
Program: 172156
Project: 172156
Buggy source:
@Override public void cancelCheckOut(String repositoryId,String objectId,ExtensionsData extension){
  checkRepositoryId(repositoryId);
  CMISNodeInfo info=getOrCreateNodeInfo(objectId,"String_Node_Str");
  if (info.isVariant(CMISObjectVariant.PWC)) {
    throw new CmisVersioningException("String_Node_Str");
  }
  final NodeRef nodeRef=info.getNodeRef();
  endReadOnlyTransaction();
  connector.getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>(){
    public Object execute() throws Exception {
      try {
        connector.getCheckOutCheckInService().cancelCheckout(nodeRef);
        return null;
      }
 catch (      CheckOutCheckInServiceException e) {
        throw new CmisVersioningException("String_Node_Str" + e.getMessage(),e);
      }
catch (      AccessDeniedException ade) {
        throw new CmisPermissionDeniedException("String_Node_Str",ade);
      }
    }
  }
,false,true);
  beginReadOnlyTransaction();
}

Fixed version (ground truth):
@Override public void cancelCheckOut(String repositoryId,String objectId,ExtensionsData extension){
  checkRepositoryId(repositoryId);
  CMISNodeInfo info=getOrCreateNodeInfo(objectId,"String_Node_Str");
  if (!info.isVariant(CMISObjectVariant.PWC)) {
    throw new CmisVersioningException("String_Node_Str");
  }
  final NodeRef nodeRef=info.getNodeRef();
  endReadOnlyTransaction();
  connector.getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>(){
    public Object execute() throws Exception {
      try {
        connector.getCheckOutCheckInService().cancelCheckout(nodeRef);
        return null;
      }
 catch (      CheckOutCheckInServiceException e) {
        throw new CmisVersioningException("String_Node_Str" + e.getMessage(),e);
      }
catch (      AccessDeniedException ade) {
        throw new CmisPermissionDeniedException("String_Node_Str",ade);
      }
    }
  }
,false,true);
  beginReadOnlyTransaction();
}
Program: 172159
Project: 172159
Buggy source:
@Override public void checkOut(String repositoryId,final Holder<String> objectId,ExtensionsData extension,final Holder<Boolean> contentCopied){
  checkRepositoryId(repositoryId);
  CMISNodeInfo info=getOrCreateNodeInfo(objectId.getValue(),"String_Node_Str");
  if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION)) {
    throw new CmisInvalidArgumentException("String_Node_Str");
  }
  final NodeRef nodeRef=info.getNodeRef();
  if (!((DocumentTypeDefinition)info.getType().getTypeDefinition(false)).isVersionable()) {
    throw new CmisConstraintException("String_Node_Str");
  }
  endReadOnlyTransaction();
  connector.getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>(){
    public Object execute() throws Exception {
      try {
        NodeRef pwcNodeRef=connector.getCheckOutCheckInService().checkout(nodeRef);
        objectId.setValue(pwcNodeRef.toString());
        if (contentCopied != null) {
          contentCopied.setValue(connector.getFileFolderService().getReader(pwcNodeRef) != null);
        }
        return null;
      }
 catch (      CheckOutCheckInServiceException e) {
        throw new CmisVersioningException("String_Node_Str" + e.getMessage(),e);
      }
catch (      AccessDeniedException ade) {
        throw new CmisPermissionDeniedException("String_Node_Str",ade);
      }
    }
  }
,false,true);
  beginReadOnlyTransaction();
}

Fixed version (ground truth):
@Override public void checkOut(String repositoryId,final Holder<String> objectId,ExtensionsData extension,final Holder<Boolean> contentCopied){
  checkRepositoryId(repositoryId);
  CMISNodeInfo info=getOrCreateNodeInfo(objectId.getValue(),"String_Node_Str");
  if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION)) {
    throw new CmisInvalidArgumentException("String_Node_Str");
  }
  final NodeRef nodeRef=info.getNodeRef();
  if (!((DocumentTypeDefinition)info.getType().getTypeDefinition(false)).isVersionable()) {
    throw new CmisConstraintException("String_Node_Str");
  }
  endReadOnlyTransaction();
  connector.getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>(){
    public Object execute() throws Exception {
      try {
        NodeRef pwcNodeRef=connector.getCheckOutCheckInService().checkout(nodeRef);
        CMISNodeInfo pwcNodeInfo=createNodeInfo(pwcNodeRef);
        objectId.setValue(pwcNodeInfo.getObjectId());
        if (contentCopied != null) {
          contentCopied.setValue(connector.getFileFolderService().getReader(pwcNodeRef) != null);
        }
        return null;
      }
 catch (      CheckOutCheckInServiceException e) {
        throw new CmisVersioningException("String_Node_Str" + e.getMessage(),e);
      }
catch (      AccessDeniedException ade) {
        throw new CmisPermissionDeniedException("String_Node_Str",ade);
      }
    }
  }
,false,true);
  beginReadOnlyTransaction();
}
Program: 172161
Project: 172161
Buggy source:
public String getNameProperty(Properties properties){
  String name=getStringProperty(properties,PropertyIds.NAME);
  if ((name == null) || (name.trim().length() == 0)) {
    throw new CmisInvalidArgumentException("String_Node_Str" + PropertyIds.NAME + "String_Node_Str");
  }
  return name;
}

Fixed version (ground truth):
public String getNameProperty(Properties properties,String fallback){
  String name=getStringProperty(properties,PropertyIds.NAME);
  if ((name == null) || (name.trim().length() == 0)) {
    if (fallback == null) {
      throw new CmisInvalidArgumentException("String_Node_Str" + PropertyIds.NAME + "String_Node_Str");
    }
 else {
      name=fallback;
    }
  }
  return name;
}
Program: 172162
Project: 172162
Buggy source:
public void init(){
  PropertyCheck.mandatory(this,"String_Node_Str",getNodeService());
  PropertyCheck.mandatory(this,"String_Node_Str",context);
  DesktopActionTable actions=context.getDesktopActions();
  Enumeration<String> actionNames=actions.enumerateActionNames();
  while (actionNames.hasMoreElements()) {
    String name=actionNames.nextElement();
    DesktopAction action=actions.getAction(name);
    if (action.hasPseudoFile()) {
      PseudoFile file=action.getPseudoFile();
      pl.addFile(file);
    }
  }
}

Fixed version (ground truth):
public void init(){
  PropertyCheck.mandatory(this,"String_Node_Str",getNodeService());
  PropertyCheck.mandatory(this,"String_Node_Str",context);
  DesktopActionTable actions=context.getDesktopActions();
  if (actions != null) {
    Enumeration<String> actionNames=actions.enumerateActionNames();
    while (actionNames.hasMoreElements()) {
      String name=actionNames.nextElement();
      DesktopAction action=actions.getAction(name);
      if (action.hasPseudoFile()) {
        PseudoFile file=action.getPseudoFile();
        pl.addFile(file);
      }
    }
  }
}
Program: 172163
Project: 172163
Buggy source:
/** 
 * @param discussableNode discussable node.
 * @return
 */
private int calculateCommentTotalByNodeCounting(NodeRef discussableNode){
  if (!nodeService.hasAspect(discussableNode,ForumModel.ASPECT_DISCUSSABLE)) {
    throw new IllegalArgumentException("String_Node_Str" + ForumModel.ASPECT_DISCUSSABLE + "String_Node_Str");
  }
  NodeRef topicNode=commentService.getShareCommentsTopic(discussableNode);
  if (log.isDebugEnabled()) {
    StringBuilder msg=new StringBuilder();
    msg.append("String_Node_Str").append(discussableNode);
    log.debug(msg.toString());
    msg=new StringBuilder();
    msg.append("String_Node_Str").append(topicNode);
    log.debug(msg.toString());
  }
  if (topicNode == null) {
    throw new NullPointerException("String_Node_Str");
  }
  Set<QName> childNodeTypeQNames=new HashSet<QName>(1);
  childNodeTypeQNames.add(ForumModel.TYPE_POST);
  List<ChildAssociationRef> fmPostChildren=rawNodeService.getChildAssocs(topicNode,childNodeTypeQNames);
  final int commentTotal=fmPostChildren.size();
  return commentTotal;
}

Fixed version (ground truth):
/** 
 * Calculate the comment total for the specified node.
 * @param discussableNode discussable node.
 * @return the recount value or <tt>null</tt> if it is not possible to calculate the total.
 */
private Integer calculateCommentTotalByNodeCounting(NodeRef discussableNode){
  Integer result=null;
  if (nodeService.hasAspect(discussableNode,ForumModel.ASPECT_DISCUSSABLE)) {
    NodeRef topicNode=commentService.getShareCommentsTopic(discussableNode);
    if (log.isDebugEnabled()) {
      StringBuilder msg=new StringBuilder();
      msg.append("String_Node_Str").append(discussableNode);
      log.debug(msg.toString());
      msg=new StringBuilder();
      msg.append("String_Node_Str").append(topicNode);
      log.debug(msg.toString());
    }
    if (topicNode != null) {
      Set<QName> childNodeTypeQNames=new HashSet<QName>();
      childNodeTypeQNames.add(ForumModel.TYPE_POST);
      List<ChildAssociationRef> fmPostChildren=rawNodeService.getChildAssocs(topicNode,childNodeTypeQNames);
      result=new Integer(fmPostChildren.size());
    }
  }
  return result;
}
Program: 172164
Project: 172164
Buggy source:
/** 
 * This method adjusts the   {@link ForumModel#PROP_COMMENT_COUNT} based on the supplied increment/decrement flag.
 * @param fmPostNode the fm:post node (the comment node)
 * @param incrementing <tt>true</tt> if we're incrementing the count, else <tt>false</tt>.
 */
private void adjustCommentCount(NodeRef fmPostNode,boolean incrementing){
  NodeRef discussableAncestor=commentService.getDiscussableAncestor(fmPostNode);
  if (discussableAncestor != null) {
    if (discussableNodeRequiresFullRecount(discussableAncestor)) {
      int recount=calculateCommentTotalByNodeCounting(discussableAncestor);
      nodeService.addAspect(discussableAncestor,ForumModel.ASPECT_COMMENTS_ROLLUP,null);
      int newCountValue=recount;
      if (!incrementing) {
        newCountValue--;
      }
      if (log.isDebugEnabled()) {
        log.debug(discussableAncestor + "String_Node_Str" + newCountValue);
      }
      nodeService.setProperty(discussableAncestor,ForumModel.PROP_COMMENT_COUNT,newCountValue);
    }
 else {
      Integer existingCommentCount=(Integer)nodeService.getProperty(discussableAncestor,ForumModel.PROP_COMMENT_COUNT);
      int existingCommentCountInt=existingCommentCount == null ? 0 : existingCommentCount.intValue();
      int delta=incrementing ? 1 : -1;
      nodeService.setProperty(discussableAncestor,ForumModel.PROP_COMMENT_COUNT,existingCommentCountInt + delta);
    }
  }
}

Fixed version (ground truth):
/** 
 * This method adjusts the   {@link ForumModel#PROP_COMMENT_COUNT} based on the supplied increment/decrement flag.
 * @param fmPostNode the fm:post node (the comment node)
 * @param incrementing <tt>true</tt> if we're incrementing the count, else <tt>false</tt>.
 */
private void adjustCommentCount(NodeRef fmPostNode,boolean incrementing){
  NodeRef discussableAncestor=commentService.getDiscussableAncestor(fmPostNode);
  if (discussableAncestor != null) {
    if (discussableNodeRequiresFullRecount(discussableAncestor)) {
      Integer recount=calculateCommentTotalByNodeCounting(discussableAncestor);
      if (recount != null) {
        nodeService.addAspect(discussableAncestor,ForumModel.ASPECT_COMMENTS_ROLLUP,null);
        int newCountValue=recount;
        if (!incrementing) {
          newCountValue--;
        }
        if (log.isDebugEnabled()) {
          log.debug(discussableAncestor + "String_Node_Str" + newCountValue);
        }
        nodeService.setProperty(discussableAncestor,ForumModel.PROP_COMMENT_COUNT,newCountValue);
      }
    }
 else {
      Integer existingCommentCount=(Integer)nodeService.getProperty(discussableAncestor,ForumModel.PROP_COMMENT_COUNT);
      int existingCommentCountInt=existingCommentCount == null ? 0 : existingCommentCount.intValue();
      int delta=incrementing ? 1 : -1;
      nodeService.setProperty(discussableAncestor,ForumModel.PROP_COMMENT_COUNT,existingCommentCountInt + delta);
    }
  }
}