<commit_before>package de.predic8.routes;

import de.predic8.util.AttachLogfile;
import de.predic8.util.PropertyFile;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Predicate;
import org.apache.camel.builder.PredicateBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class HashNotification extends RouteBuilder {

    private String fileName;

    public HashNotification() {
        super();
    }

    public HashNotification(String fileName) {
        this.fileName = fileName;
    }

    @Override
    public void configure() throws Exception {

        Endpoint smtp = getContext().getEndpoint(
                String.format("smtp://%s?password=%s&username=%s&to=%s&from=%s"
                        , PropertyFile.getInstance().getProperty("email_smtp")
                        , PropertyFile.getInstance().getProperty("email_password")
                        , PropertyFile.getInstance().getProperty("email_username")
                        , PropertyFile.getInstance().getProperty("email_recipient")
                        , PropertyFile.getInstance().getProperty("email_username")));

        Predicate error = PredicateBuilder.constant(!fileName.isEmpty());

        from("file:document-archive/logs?fileName=log.txt&noop=true")
                .log("Predicate: " + error.toString())
                .choice()
                    .when(error)
                        .log("SENDING HASH ERROR MAIL")
                        .setHeader("subject", simple("Hash Error Detected"))
                        .setHeader("firstName", simple(PropertyFile.getInstance().getProperty("user_name")))
                        .setBody(simple(fileName))
                        .to("freemarker:/email-templates/verify_fail.ftl")
                    .otherwise()
                        .log("SENDING EVERYTHING OK MAIL")
                        .setHeader("subject", simple("Everything OK!"))
                        .setHeader("firstName", simple(PropertyFile.getInstance().getProperty("user_name")))
                        .setBody(simple("No files in your document archive have been changed"))
                        .to("freemarker:/email-templates/verify_ok.ftl")
                .end()
                .process(new AttachLogfile())
                .to(smtp)
                .log("HASH MAIL SEND");
    }

    public void start(String fileName) throws Exception {
        CamelContext ctx = new DefaultCamelContext();
        ctx.addRoutes(new HashNotification(fileName));
        ctx.start();
        Thread.sleep(5000);
    }
<commit_msg>fixed nullpointer<commit_after>package de.predic8.routes;

import de.predic8.util.AttachLogfile;
import de.predic8.util.PropertyFile;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Predicate;
import org.apache.camel.builder.PredicateBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

public class HashNotification extends RouteBuilder {

    private String fileName = "";

    public HashNotification() {
        super();
    }

    public HashNotification(String fileName) {
        this.fileName = fileName;
    }

    @Override
    public void configure() throws Exception {

        Endpoint smtp = getContext().getEndpoint(
                String.format("smtp://%s?password=%s&username=%s&to=%s&from=%s"
                        , PropertyFile.getInstance().getProperty("email_smtp")
                        , PropertyFile.getInstance().getProperty("email_password")
                        , PropertyFile.getInstance().getProperty("email_username")
                        , PropertyFile.getInstance().getProperty("email_recipient")
                        , PropertyFile.getInstance().getProperty("email_username")));

        Predicate error = PredicateBuilder.constant(!fileName.equals(""));

        from("file:document-archive/logs?fileName=log.txt&noop=true")
                .log("Predicate: " + error.toString())
                .choice()
                    .when(error)
                        .log("SENDING HASH ERROR MAIL")
                        .setHeader("subject", simple("Hash Error Detected"))
                        .setHeader("firstName", simple(PropertyFile.getInstance().getProperty("user_name")))
                        .setBody(simple(fileName))
                        .to("freemarker:/email-templates/verify_fail.ftl")
                    .otherwise()
                        .log("SENDING EVERYTHING OK MAIL")
                        .setHeader("subject", simple("Everything OK!"))
                        .setHeader("firstName", simple(PropertyFile.getInstance().getProperty("user_name")))
                        .setBody(simple("No files in your document archive have been changed"))
                        .to("freemarker:/email-templates/verify_ok.ftl")
                .end()
                .process(new AttachLogfile())
                .to(smtp)
                .log("HASH MAIL SEND");
    }

    public void start(String fileName) throws Exception {
        CamelContext ctx = new DefaultCamelContext();
        ctx.addRoutes(new HashNotification(fileName));
        ctx.start();
        Thread.sleep(5000);
    }

{'fraction_non_alphanumeric': 0.1171933784800602, 'fraction_numerical': 0.0026335590669676447, 'mean_word_length': 2.1313309776207303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4328471', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1320, 'n_words': 221}