<commit_before>package com.tactfactory.harmony.dependencies.libraries;

import java.io.File;
import java.io.FileFilter;
import java.util.HashMap;
import java.util.Map;

import com.tactfactory.harmony.utils.ConsoleUtils;

/**
 * Library Pool. Contains all the libraries brought by 
 * the core and all the bundles.
 */
public class LibraryPool {
	/** File filter to parse only libraries. */
	private final FileFilter filter = new FileFilter() {
		
		@Override
		public boolean accept(File pathname) {
			//return pathname.isDirectory() 
			//		|| pathname.getName().endsWith(".jar");
			return pathname.isDirectory()
					|| pathname.getAbsolutePath().contains("lib/");
		}
	};
	/** Map of all the libraries <FileName, File>. */
	private final Map<String, File> pool = new HashMap<String, File>();
	
	/**
	 * Get the File pointing to the library file.
	 * @param fileName The filename of the library
	 * @return The library File
	 */
	public File getLibrary(String fileName) {
		return this.pool.get(fileName);
	}
	
	/**
	 * Parse the given file to find all the available libraries in 
	 * order to fill the pool.
	 * @param file The folder to parse
	 */
	public void parseLibraries(File file) {
		if (file.exists()) {
			if (file.isDirectory()) {
				File[] files = file.listFiles(this.filter);
				for (File f : files) {
					this.parseLibraries(f);
				}
			} else if (file.isFile()) {
				String path = file.getAbsolutePath();
				String fileName = path.substring(path.indexOf("lib/") + 4);
				if (this.pool.get(fileName) != null) {
					ConsoleUtils.displayWarning(
							"The library " 
							+ fileName
							+ " has been found multiple times."
							+ "Keeping "
							+ this.pool.get(fileName).getAbsolutePath());
				} else {
					ConsoleUtils.displayDebug("Adding library " + fileName
							+ " to the pool.");
					this.pool.put(fileName, file);
				}
			}
			
		}
	}
}<commit_msg>Fix #2900<commit_after>package com.tactfactory.harmony.dependencies.libraries;

import java.io.File;
import java.io.FileFilter;
import java.util.HashMap;
import java.util.Map;

import com.tactfactory.harmony.utils.ConsoleUtils;

/**
 * Library Pool. Contains all the libraries brought by 
 * the core and all the bundles.
 */
public class LibraryPool {
	/** File filter to parse only libraries. */
	private final FileFilter filter = new FileFilter() {
		
		@Override
		public boolean accept(File pathname) {
			//return pathname.isDirectory() 
			//		|| pathname.getName().endsWith(".jar");
			return pathname.isDirectory()
					|| (pathname.getAbsolutePath().lastIndexOf("lib/")
							> pathname.getAbsolutePath().lastIndexOf("vendor/"));
		}
	};
	/** Map of all the libraries <FileName, File>. */
	private final Map<String, File> pool = new HashMap<String, File>();
	
	/**
	 * Get the File pointing to the library file.
	 * @param fileName The filename of the library
	 * @return The library File
	 */
	public File getLibrary(String fileName) {
		return this.pool.get(fileName);
	}
	
	/**
	 * Parse the given file to find all the available libraries in 
	 * order to fill the pool.
	 * @param file The folder to parse
	 */
	public void parseLibraries(File file) {
		if (file.exists()) {
			if (file.isDirectory()) {
				File[] files = file.listFiles(this.filter);
				for (File f : files) {
					this.parseLibraries(f);
				}
			} else if (file.isFile()) {
				String path = file.getAbsolutePath();
				String fileName = path.substring(path.lastIndexOf("lib/") + 4);
				if (this.pool.get(fileName) != null) {
					ConsoleUtils.displayWarning(
							"The library " 
							+ fileName
							+ " has been found multiple times."
							+ "Keeping "
							+ this.pool.get(fileName).getAbsolutePath());
				} else {
					ConsoleUtils.displayDebug("Adding library " + fileName
							+ " to the pool.");
					this.pool.put(fileName, file);
				}
			}
			
		}
	}
}
{'fraction_non_alphanumeric': 0.13076126359399276, 'fraction_numerical': 0.0015535991714137752, 'mean_word_length': 3.0577731092436973, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '6889754', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1162, 'n_words': 328}