Program: 153626
Project: 153626
Buggy source:
public void sendNotificationToPosters(AddedNodeFact nodeFact,KnowledgeHelper drools) throws RepositoryException {
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",nodeFact.getPath());
  }
  try {
    boolean spamDetected=false;
    JCRNodeWrapper node=nodeFact.getNode();
    if (node.isNodeType(SPAM_DETECTED_MIXIN)) {
      spamDetected=true;
      logger.info("String_Node_Str",node.getPath());
      if (sendSpamNotificationsToAdministrator) {
        logger.info("String_Node_Str");
      }
    }
    User user=(User)drools.getWorkingMemory().getGlobal("String_Node_Str");
    List<String> emails=new ArrayList<String>();
    if ((spamDetected && sendSpamNotificationsToAdministrator) || (!spamDetected)) {
      String administratorEmail=toAdministratorMail ? SettingsBean.getInstance().getMail_administrator() : email_to;
      emails.add(administratorEmail);
    }
    Locale defaultLocale=null;
    if (node.getExistingLocales() != null && node.getExistingLocales().size() > 0) {
      defaultLocale=node.getExistingLocales().get(0);
    }
    if (defaultLocale == null) {
      defaultLocale=SettingsBean.getInstance().getDefaultLocale();
    }
    Map<String,Object> bindings=new HashMap<String,Object>();
    bindings.put("String_Node_Str",node.getParent());
    bindings.put("String_Node_Str",node);
    bindings.put("String_Node_Str",node.getParent().getParent());
    bindings.put("String_Node_Str",user);
    bindings.put("String_Node_Str",new DateTool());
    bindings.put("String_Node_Str",new EscapeTool());
    bindings.put("String_Node_Str",Calendar.getInstance());
    bindings.put("String_Node_Str",defaultLocale);
    bindings.put("String_Node_Str",spamDetected);
    bindings.put("String_Node_Str",forumHostUrlPart + Jahia.getContextPath() + node.getParent().getUrl());
    Map<String,Locale> preferredLocales=new HashMap<String,Locale>();
    if (sendNotificationsToContributors && !spamDetected) {
      List<JCRNodeWrapper> postList=JCRContentUtils.getChildrenOfType(node.getParent(),"String_Node_Str");
      Iterator<JCRNodeWrapper> postIterator=postList.iterator();
      JahiaUserManagerService userManager=ServicesRegistry.getInstance().getJahiaUserManagerService();
      String currentUser=user.getName();
      while (postIterator.hasNext()) {
        JCRNodeWrapper post=postIterator.next();
        String creator=post.getCreationUser();
        String email=null;
        if (creator != null) {
          JahiaUser jahiaUser=userManager.lookupUser(creator);
          if (user != null && !(creator).equals(currentUser)) {
            boolean emailNotificationsDisabled="String_Node_Str".equals(jahiaUser.getProperty("String_Node_Str"));
            if (!emailNotificationsDisabled) {
              email=jahiaUser.getProperty("String_Node_Str");
              if (email != null && !emails.contains(email) && email.length() > 5) {
                emails.add(email);
                if (getPreferredLocale(jahiaUser) != null) {
                  preferredLocales.put(email,getPreferredLocale(jahiaUser));
                }
              }
            }
          }
        }
      }
    }
    if (emails.size() > 0) {
      Iterator<String> emailIterator=emails.iterator();
      while (emailIterator.hasNext()) {
        String destinationEmail=emailIterator.next();
        try {
          Locale userLocale=defaultLocale;
          if (preferredLocales.containsKey(destinationEmail)) {
            userLocale=preferredLocales.get(destinationEmail);
          }
          mailService.sendMessageWithTemplate(templatePath,bindings,destinationEmail,email_from,"String_Node_Str","String_Node_Str",userLocale,"String_Node_Str");
          logger.info("String_Node_Str" + destinationEmail + "String_Node_Str"+ userLocale);
        }
 catch (        Exception e) {
          logger.info("String_Node_Str",e);
        }
      }
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + nodeFact.getPath() + "String_Node_Str"+ e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void sendNotificationToPosters(AddedNodeFact nodeFact,KnowledgeHelper drools) throws RepositoryException {
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",nodeFact.getPath());
  }
  try {
    boolean spamDetected=false;
    JCRNodeWrapper node=nodeFact.getNode();
    if (node.isNodeType(SPAM_DETECTED_MIXIN)) {
      spamDetected=true;
      logger.info("String_Node_Str",node.getPath());
      if (sendSpamNotificationsToAdministrator) {
        logger.info("String_Node_Str");
      }
    }
    User user=(User)drools.getWorkingMemory().getGlobal("String_Node_Str");
    List<String> emails=new ArrayList<String>();
    if ((spamDetected && sendSpamNotificationsToAdministrator) || (!spamDetected)) {
      String administratorEmail=toAdministratorMail ? SettingsBean.getInstance().getMail_administrator() : email_to;
      emails.add(administratorEmail);
    }
    Locale defaultLocale=null;
    if (node.getExistingLocales() != null && node.getExistingLocales().size() > 0) {
      defaultLocale=node.getExistingLocales().get(0);
    }
    if (defaultLocale == null) {
      defaultLocale=SettingsBean.getInstance().getDefaultLocale();
    }
    Map<String,Object> bindings=new HashMap<String,Object>();
    bindings.put("String_Node_Str",node.getParent());
    bindings.put("String_Node_Str",node);
    bindings.put("String_Node_Str",node.getParent().getParent());
    bindings.put("String_Node_Str",user);
    bindings.put("String_Node_Str",new DateTool());
    bindings.put("String_Node_Str",new EscapeTool());
    bindings.put("String_Node_Str",Calendar.getInstance());
    bindings.put("String_Node_Str",spamDetected);
    bindings.put("String_Node_Str",forumHostUrlPart + Jahia.getContextPath() + node.getParent().getUrl());
    Map<String,Locale> preferredLocales=new HashMap<String,Locale>();
    if (sendNotificationsToContributors && !spamDetected) {
      List<JCRNodeWrapper> postList=JCRContentUtils.getChildrenOfType(node.getParent(),"String_Node_Str");
      Iterator<JCRNodeWrapper> postIterator=postList.iterator();
      JahiaUserManagerService userManager=ServicesRegistry.getInstance().getJahiaUserManagerService();
      String currentUser=user.getName();
      while (postIterator.hasNext()) {
        JCRNodeWrapper post=postIterator.next();
        String creator=post.getCreationUser();
        String email=null;
        if (creator != null) {
          JahiaUser jahiaUser=userManager.lookupUser(creator);
          if (user != null && !(creator).equals(currentUser)) {
            boolean emailNotificationsDisabled="String_Node_Str".equals(jahiaUser.getProperty("String_Node_Str"));
            if (!emailNotificationsDisabled) {
              email=jahiaUser.getProperty("String_Node_Str");
              if (email != null && !emails.contains(email) && email.length() > 5) {
                emails.add(email);
                if (getPreferredLocale(jahiaUser) != null) {
                  preferredLocales.put(email,getPreferredLocale(jahiaUser));
                }
              }
            }
          }
        }
      }
    }
    if (emails.size() > 0) {
      Iterator<String> emailIterator=emails.iterator();
      while (emailIterator.hasNext()) {
        String destinationEmail=emailIterator.next();
        try {
          Locale userLocale=defaultLocale;
          if (preferredLocales.containsKey(destinationEmail)) {
            userLocale=preferredLocales.get(destinationEmail);
          }
          bindings.put("String_Node_Str",userLocale);
          mailService.sendMessageWithTemplate(templatePath,bindings,destinationEmail,email_from,"String_Node_Str","String_Node_Str",userLocale,"String_Node_Str");
          logger.info("String_Node_Str" + destinationEmail + "String_Node_Str"+ userLocale);
        }
 catch (        Exception e) {
          logger.info("String_Node_Str",e);
        }
      }
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + nodeFact.getPath() + "String_Node_Str"+ e.getMessage(),e);
  }
}