<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.sch.ejb;

import hu.sch.services.MailManagerLocal;
import java.util.Date;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.apache.log4j.Logger;

/**
 *
 * @author aldaris
 */
@Stateless
public class MailManagerBean implements MailManagerLocal {
    private static final Logger logger = Logger.getLogger(ValuationManagerBean.class);
    
    @Resource(name = "mail/korokMail")
    private Session mailSession;

    public boolean sendEmail(String to, String subject, String message) {
        System.out.println("E-mail küldése " + to + "-nak.");

        logger.info("E-mail küldése\n" +
                "Címzett: " + to + "\n" +
                "Üzenet: " + message);

        Message msg = new MimeMessage(mailSession);
        try {
            // teszt címzés
            msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("<EMAIL>", false));
//            msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("<EMAIL>", false));

            // rendes címzés
            //msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));

            msg.setSubject("[VIR] "+subject);
            msg.setText(message);
            msg.setSentDate(new Date());

            Transport.send(msg);
            logger.info("Levél sikeresen elküldve.");

        } catch (Exception ex) {
            logger.error("Hiba az e-mail elküldése közben.");
            ex.printStackTrace();
            return false;
        }

        return true;
    }
}<commit_msg>néhány kódszemlés javítás<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.sch.ejb;

import hu.sch.services.MailManagerLocal;
import java.util.Date;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.apache.log4j.Logger;

/**
 *
 * @author aldaris
 */
@Stateless
public class MailManagerBean implements MailManagerLocal {
    private static final Logger logger = Logger.getLogger(MailManagerBean.class);
    
    @Resource(name = "mail/korokMail")
    private Session mailSession;

    public boolean sendEmail(String to, String subject, String message) {
        StringBuilder sb = new StringBuilder();
        sb.append("E-mail küldése ");
        sb.append(to);
        sb.append("-nak.");
        logger.info(sb.toString());

        if (logger.isDebugEnabled())
        {
           StringBuilder sbd = new StringBuilder();

           sbd.append("E-mail küldése\n");
           sbd.append("Címzett: ");
           sbd.append(to);
           sbd.append("\nÜzenet: ");
           sbd.append(message);

           logger.debug(sbd.toString());
        }

        Message msg = new MimeMessage(mailSession);
        try {
            // teszt címzés
            msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("<EMAIL>", false));

            // rendes címzés
            //msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));

            msg.setSubject("[VIR] "+subject);
            msg.setText(message);
            msg.setSentDate(new Date());

            Transport.send(msg);
            logger.info("Levél sikeresen elküldve.");

        } catch (Exception ex) {
            logger.error("Hiba az e-mail elküldése közben.", ex);
            return false;
        }

        return true;
    }
}
{'fraction_non_alphanumeric': 0.12033411641868964, 'fraction_numerical': 0.0005220569042025581, 'mean_word_length': 2.5220588235294117, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3631700', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1120, 'n_words': 240}