<commit_before>package fr.lteconsulting.pomexplorer.commands;

import java.util.List;

import fr.lteconsulting.pomexplorer.Client;
import fr.lteconsulting.pomexplorer.GAV;
import fr.lteconsulting.pomexplorer.GavTools;
import fr.lteconsulting.pomexplorer.Project;
import fr.lteconsulting.pomexplorer.WorkingSession;
import fr.lteconsulting.pomexplorer.javac.JavaSourceAnalyzer;

public class ClassesCommand
{
	@Help( "gives the java classes provided by the session's gavs" )
	public String main( WorkingSession session, Client client )
	{
		return providedBy( session, client, null );
	}

	@Help( "gives the java classes provided by the session's gavs, filtered by the given parameter" )
	public String providedBy( WorkingSession session, Client client, String gavFilter )
	{
		StringBuilder log = new StringBuilder();

		log.append( "<br/>GAV list " + (gavFilter != null ? ("filtering with '" + gavFilter + "'") : "") + ":<br/>" );

		for( GAV gav : GavTools.filterGavs( session.graph().gavs(), gavFilter ) )
		{
			List<String> classes = GavTools.analyseProvidedClasses( session, gav, log );
			for( String className : classes )
				log.append( className + "<br/>" );
		}

		return log.toString();
	}

	@Help( "gives the fqn list of referenced classes by the session's gavs, filtered by the given parameter" )
	public String referencedBy( WorkingSession session, String gavFilter )
	{
		/*
		 * parse all the Java source files in the gav's project directory and
		 * extract all referenced fqns.
		 * 
		 * substract the gav's provided classes from this set, to get external
		 * references
		 */
		StringBuilder log = new StringBuilder();

		JavaSourceAnalyzer analyzer = new JavaSourceAnalyzer();

		for( GAV gav : GavTools.filterGavs( session.graph().gavs(), gavFilter ) )
		{
			Project project = session.projects().forGav( gav );
			if( project == null )
				continue;

			analyzer.analyzeProject( project, true, log );
		}

		return log.toString();
	}
}
<commit_msg>fix npe<commit_after>package fr.lteconsulting.pomexplorer.commands;

import java.util.List;

import fr.lteconsulting.pomexplorer.Client;
import fr.lteconsulting.pomexplorer.GAV;
import fr.lteconsulting.pomexplorer.GavTools;
import fr.lteconsulting.pomexplorer.Project;
import fr.lteconsulting.pomexplorer.Tools;
import fr.lteconsulting.pomexplorer.WorkingSession;
import fr.lteconsulting.pomexplorer.javac.JavaSourceAnalyzer;

public class ClassesCommand
{
	@Help( "gives the java classes provided by the session's gavs" )
	public String main( WorkingSession session, Client client )
	{
		return providedBy( session, client, null );
	}

	@Help( "gives the java classes provided by the session's gavs, filtered by the given parameter" )
	public String providedBy( WorkingSession session, Client client, String gavFilter )
	{
		StringBuilder log = new StringBuilder();

		log.append( "<br/>GAV list " + (gavFilter != null ? ("filtering with '" + gavFilter + "'") : "") + ":<br/>" );

		for( GAV gav : GavTools.filterGavs( session.graph().gavs(), gavFilter ) )
		{
			List<String> classes = GavTools.analyseProvidedClasses( session, gav, log );
			if( classes == null )
			{
				log.append(Tools.warningMessage("No class provided by gav " + gav));
				continue;
			}
			
			for( String className : classes )
				log.append( className + "<br/>" );
		}

		return log.toString();
	}

	@Help( "gives the fqn list of referenced classes by the session's gavs, filtered by the given parameter" )
	public String referencedBy( WorkingSession session, String gavFilter )
	{
		/*
		 * parse all the Java source files in the gav's project directory and
		 * extract all referenced fqns.
		 * 
		 * substract the gav's provided classes from this set, to get external
		 * references
		 */
		StringBuilder log = new StringBuilder();

		JavaSourceAnalyzer analyzer = new JavaSourceAnalyzer();

		for( GAV gav : GavTools.filterGavs( session.graph().gavs(), gavFilter ) )
		{
			Project project = session.projects().forGav( gav );
			if( project == null )
				continue;

			analyzer.analyzeProject( project, true, log );
		}

		return log.toString();
	}
}

{'fraction_non_alphanumeric': 0.11073253833049404, 'fraction_numerical': 0.0, 'mean_word_length': 4.163316582914573, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, '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': '5013707', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1311, 'n_words': 371}