Program: 89147
Project: 89147
Buggy source:
/** 
 * Attempt to update the template with the updated version
 * @param template
 * @param updatedTemplate
 */
private void updateTemplate(NodeRef template,String templateUpdate){
  if (template == null || !nodeService.exists(template)) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
  }
 else {
    String lastPatchUpdate=(String)nodeService.getProperty(template,PROP_LAST_PATCH_UPDATE);
    if (lastPatchUpdate == null || !name.equals(lastPatchUpdate)) {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + template.toString() + "String_Node_Str"+ templateUpdate+ "String_Node_Str");
      }
      if (!nodeService.hasAspect(template,ContentModel.ASPECT_VERSIONABLE)) {
        nodeService.addAspect(template,ContentModel.ASPECT_VERSIONABLE,null);
        Map<String,Serializable> versionProperties=new HashMap<String,Serializable>(2);
        versionProperties.put(Version.PROP_DESCRIPTION,"String_Node_Str");
        versionProperties.put(VersionModel.PROP_VERSION_TYPE,VersionType.MINOR);
        versionService.createVersion(template,versionProperties);
      }
      InputStream is=getClass().getClassLoader().getResourceAsStream(templateUpdate);
      ContentWriter writer=contentService.getWriter(template,ContentModel.PROP_CONTENT,true);
      writer.putContent(is);
      boolean enabled=auditService.isAuditEnabled();
      auditService.setAuditEnabled(false);
      try {
        nodeService.setProperty(template,PROP_LAST_PATCH_UPDATE,name);
      }
  finally {
        auditService.setAuditEnabled(enabled);
      }
    }
 else {
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + template.toString() + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Attempt to update the template with the updated version
 * @param template
 * @param updatedTemplate
 */
private void updateTemplate(NodeRef template,String templateUpdate){
  if (template == null || !nodeService.exists(template)) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str");
    }
  }
 else {
    String lastPatchUpdate=(String)nodeService.getProperty(template,PROP_LAST_PATCH_UPDATE);
    if (lastPatchUpdate == null || !name.equals(lastPatchUpdate)) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("String_Node_Str" + template.toString() + "String_Node_Str"+ templateUpdate+ "String_Node_Str");
      }
      if (!nodeService.hasAspect(template,ContentModel.ASPECT_VERSIONABLE)) {
        nodeService.addAspect(template,ContentModel.ASPECT_VERSIONABLE,null);
        Map<String,Serializable> versionProperties=new HashMap<String,Serializable>(2);
        versionProperties.put(Version.PROP_DESCRIPTION,"String_Node_Str");
        versionProperties.put(VersionModel.PROP_VERSION_TYPE,VersionType.MINOR);
        versionService.createVersion(template,versionProperties);
      }
      InputStream is=getClass().getClassLoader().getResourceAsStream(templateUpdate);
      ContentWriter writer=contentService.getWriter(template,ContentModel.PROP_CONTENT,true);
      writer.putContent(is);
      boolean enabled=auditService.isAuditEnabled();
      auditService.setAuditEnabled(false);
      try {
        nodeService.setProperty(template,PROP_LAST_PATCH_UPDATE,name);
      }
  finally {
        auditService.setAuditEnabled(enabled);
      }
    }
 else {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("String_Node_Str" + template.toString() + "String_Node_Str");
      }
    }
  }
}