<commit_before>// Copyright (c) 2003-2012, Jodd Team (jodd.org). All Rights Reserved.

package jodd.prjtools;

import jodd.io.FileUtil;
import jodd.io.findfile.FindFile;
import jodd.io.findfile.WildcardFindFile;
import jodd.util.StringUtil;

import java.io.File;
import java.io.IOException;

/**
 * Formats java sources.
 */
public class JavaSourceFormatter {
	
	private static final String COPYRIGHT = "// Copyright (c) 2003-2012, Jodd Team (jodd.org). All Rights Reserved.";

	private static final boolean WRITE_MODE = false;

	public static void main(String[] args) throws IOException {
		JavaSourceFormatter formatter = new JavaSourceFormatter();

		formatter.format("mod/jodd");
	}

	public void format(String sourceRoot) throws IOException {

		System.out.println("*** format: " + sourceRoot);

		FindFile ff = new WildcardFindFile("**/*.java", true)
				.setRecursive(true)
				.setIncludeDirs(false)
				.searchPath(sourceRoot);

		File f;
		while ((f = ff.nextFile()) != null) {
			format(f);
		}
	}

	/**
	 * Formats java file.
	 */
	private void format(File file) throws IOException {

		// reads original content
		String originalContent = FileUtil.readString(file);


		// COPYRIGHT
		String content = StringUtil.trimLeft(originalContent);
		
		int index = StringUtil.indexOfChars(content, "\r\n");
		if (index != -1) {
			content = COPYRIGHT + content.substring(index);
		}

		// the end, detects changes
		if (!originalContent.equals(content)) {
			System.out.println("copyright: " + file.getName());
			if (WRITE_MODE) {
				FileUtil.writeString(file, content);
			}
		}
	}

}<commit_msg>Java source formatter - copyright; drops dependency on IDEAs plugin.<commit_after>// Copyright (c) 2003-2012, Jodd Team (jodd.org). All Rights Reserved.

package jodd.prjtools;

import jodd.io.FileUtil;
import jodd.io.findfile.FindFile;
import jodd.io.findfile.WildcardFindFile;
import jodd.util.StringUtil;

import java.io.File;
import java.io.IOException;

/**
 * Formats java sources.
 */
public class JavaSourceFormatter {

	/**
	 * Set this to TRUE to write changes.
	 */
	private static final boolean WRITE_MODE = false;

	private static final String COPYRIGHT = "// Copyright (c) 2003-2012, Jodd Team (jodd.org). All Rights Reserved.";

	public static void main(String[] args) throws IOException {
		JavaSourceFormatter formatter = new JavaSourceFormatter();

		formatter.format("mod/jodd");
		formatter.format("mod/jodd-wot");
	}

	public void format(String sourceRoot) throws IOException {

		System.out.println("*** format: " + sourceRoot);

		FindFile ff = new WildcardFindFile("**/*.java", true)
				.setRecursive(true)
				.setIncludeDirs(false)
				.searchPath(sourceRoot);

		File f;
		while ((f = ff.nextFile()) != null) {
			format(f);
		}
	}

	/**
	 * Formats java file.
	 */
	private void format(File file) throws IOException {

		// reads original content
		String originalContent = FileUtil.readString(file);


		// COPYRIGHT
		String content = StringUtil.trimLeft(originalContent);

		if (content.startsWith("//")) {
			int index = StringUtil.indexOfChars(content, "\r\n");
			if (index != -1) {
				content = COPYRIGHT + content.substring(index);
			}
		} else {
			content = COPYRIGHT + "\r\n\r\n" + content;
		}

		// the end, detects changes
		if (!originalContent.equals(content)) {
			System.out.println("copyright: " + file.getName());
			if (WRITE_MODE) {
				FileUtil.writeString(file, content);
			}
		}
	}

}
{'fraction_non_alphanumeric': 0.13497822931785197, 'fraction_numerical': 0.009869375907111757, 'mean_word_length': 3.7270233196159124, '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': '1787555', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1067, 'n_words': 277}