<commit_before>package org.languager.maven;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import java.io.*;

/**
 * @goal consoleInput
 */
public class ConsoleInputMojo extends AbstractMojo {
    /**
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    protected MavenProject project;

    /**
     * @parameter expression="${prompt}"
     * @required
     */
    protected String prompt;

    /**
     * @parameter expression="${targetProperty}"
     * @required
     */
    protected String targetProperty;

    /**
     * @parameter expression="${defaultValue}"
     */
    protected String defaultValue;

    /**
     * @parameter expression="${showIfTargetSet}"
     */
    protected boolean showIfTargetSet;

    public void execute() throws MojoExecutionException, MojoFailureException {
        if (showIfTargetSet || project.getProperties().getProperty(targetProperty) == null) {
            System.out.print(prompt);
            if (defaultValue != null) {
                System.out.print(" (" + defaultValue + ")");
            }
            System.out.print(": ");
            try {
                String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
                if ((input == null || input.length() == 0) && defaultValue != null) {
                    input = defaultValue;
                }
                project.getProperties().setProperty(targetProperty, input);
            } catch (IOException e) {
                throw new MojoExecutionException("Problem reading input", e);
            }
        }
    }
}
<commit_msg>improved property handling for console input<commit_after>package org.languager.maven;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import java.io.*;

/**
 * @goal consoleInput
 */
public class ConsoleInputMojo extends AbstractMojo {
    /**
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    protected MavenProject project;

    /**
     * @parameter expression="${prompt}"
     * @required
     */
    protected String prompt;

    /**
     * @parameter expression="${targetProperty}"
     * @required
     */
    protected String targetProperty;

    /**
     * @parameter expression="${defaultValue}"
     */
    protected String defaultValue;

    /**
     * @parameter expression="${showIfTargetSet}"
     */
    protected boolean showIfTargetSet;

    public void execute() throws MojoExecutionException, MojoFailureException {
        String property = project.getProperties().getProperty(targetProperty);
        if (property == null) {
            property = System.getProperty(targetProperty);
            project.getProperties().setProperty(targetProperty, property);
        }
        if (showIfTargetSet || property == null) {
            System.out.print(prompt);
            if (defaultValue != null) {
                System.out.print(" (" + defaultValue + ")");
            }
            System.out.print(": ");
            try {
                String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
                if ((input == null || input.length() == 0) && defaultValue != null) {
                    input = defaultValue;
                }
                project.getProperties().setProperty(targetProperty, input);
            } catch (IOException e) {
                throw new MojoExecutionException("Problem reading input", e);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.11955136375223044, 'fraction_numerical': 0.0005098139179199592, 'mean_word_length': 2.424083769633508, 'pattern_counts': {'":': 2, '<': 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': '4047723', 'n_tokens_mistral': 1010, 'n_tokens_neox': 965, 'n_words': 201}