Cleaning up error reporting some for project building, and attempting to make the error reporter instances propagate to the aspects binding them to the error sources.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@599503 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-11-29 16:33:57 +00:00
parent 9732014c53
commit b61bb393a8
13 changed files with 246 additions and 203 deletions

View File

@ -3,21 +3,9 @@ package org.apache.maven.errors;
public abstract aspect AbstractCoreReporterManagerAspect
{
private CoreErrorReporter reporter;
public void setCoreErrorReporter( CoreErrorReporter reporter )
{
this.reporter = reporter;
}
protected CoreErrorReporter getReporter()
{
if ( reporter == null )
{
reporter = new DefaultCoreErrorReporter();
}
return reporter;
return CoreReporterManager.getReporter();
}
}

View File

@ -1,14 +0,0 @@
package org.apache.maven.errors;
import org.aspectj.lang.Aspects;
public aspect CoreReporterManagerAspect
{
public void setReporter( CoreErrorReporter reporter )
{
BuildFailureReporterAspect buildFailureReporterAspect = (BuildFailureReporterAspect) Aspects.aspectOf( BuildFailureReporterAspect.class );
buildFailureReporterAspect.setCoreErrorReporter( reporter );
}
}

View File

@ -0,0 +1,32 @@
package org.apache.maven.errors;
public final class CoreReporterManager
{
private static CoreErrorReporter reporter;
private CoreReporterManager()
{
}
public static CoreErrorReporter getReporter()
{
if ( reporter == null )
{
reporter = new DefaultCoreErrorReporter();
}
return reporter;
}
public static void setReporter( CoreErrorReporter instance )
{
reporter = instance;
}
public static void clearReporter()
{
reporter = null;
}
}

View File

@ -12,14 +12,6 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
public privileged aspect CacheCleanerAspect
{
private pointcut executeMethod():
execution( * MavenEmbedder.execute( .. ) );
before(): executeMethod()
{
System.out.println( "Executing with cache-cleanup enabled." );
}
private ModelLineageBuilder MavenEmbedder.modelLineageBuilder;
private pointcut embedderStarted( MavenEmbedder embedder ):

View File

@ -9,43 +9,39 @@ import org.apache.maven.BuildFailureException;
import org.apache.maven.cli.CLIReportingUtils;
import org.apache.maven.embedder.MavenEmbedder;
import org.apache.maven.errors.CoreErrorReporter;
import org.apache.maven.errors.CoreReporterManagerAspect;
import org.apache.maven.errors.CoreReporterManager;
import org.apache.maven.errors.DefaultCoreErrorReporter;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.project.aspect.ProjectReporterManagerAspect;
import org.apache.maven.project.error.DefaultProjectErrorReporter;
import org.apache.maven.project.error.ProjectReporterManager;
import org.apache.maven.project.error.ProjectErrorReporter;
import org.apache.maven.project.ProjectBuildingException;
public privileged aspect ErrorReportingAspect
{
private ProjectErrorReporter projectErrorReporter;
private CoreErrorReporter coreErrorReporter;
private pointcut embedderCalls():
execution( public MavenExecutionResult MavenEmbedder.*( .. ) );
execution( public * MavenEmbedder.*( .. ) );
// TODO: Use MavenExecutionRequest to allow configuration of the reporters to be used.
before():
Object around():
embedderCalls() && !cflow( embedderCalls() )
{
projectErrorReporter = new DefaultProjectErrorReporter();
ProjectReporterManagerAspect prma = (ProjectReporterManagerAspect) Aspects.aspectOf( ProjectReporterManagerAspect.class );
prma.setReporter( projectErrorReporter );
coreErrorReporter = new DefaultCoreErrorReporter();
CoreReporterManagerAspect crma = (CoreReporterManagerAspect) Aspects.aspectOf( CoreReporterManagerAspect.class );
crma.setReporter( coreErrorReporter );
try
{
return proceed();
}
finally
{
ProjectReporterManager.clearReporter();
CoreReporterManager.clearReporter();
}
}
boolean around( ProjectBuildingException e, boolean showStackTraces, StringWriter writer ):
execution( private static boolean CLIReportingUtils.handleProjectBuildingException( ProjectBuildingException, boolean, StringWriter ) )
&& args( e, showStackTraces, writer )
{
ProjectErrorReporter projectErrorReporter = ProjectReporterManager.getReporter();
if ( projectErrorReporter == null )
{
return proceed( e, showStackTraces, writer );
@ -65,7 +61,10 @@ public privileged aspect ErrorReportingAspect
writer.write( CLIReportingUtils.NEWLINE );
writer.write( CLIReportingUtils.NEWLINE );
Throwable cause = projectErrorReporter.getRealCause( reportingError );
cause.printStackTrace( new PrintWriter( writer ) );
if ( cause != null )
{
cause.printStackTrace( new PrintWriter( writer ) );
}
}
writer.write( CLIReportingUtils.NEWLINE );
@ -86,12 +85,16 @@ public privileged aspect ErrorReportingAspect
execution( private static boolean CLIReportingUtils.handleBuildFailureException( BuildFailureException, boolean, StringWriter ) )
&& args( e, showStackTraces, writer )
{
CoreErrorReporter coreErrorReporter = CoreReporterManager.getReporter();
if ( coreErrorReporter == null )
{
return proceed( e, showStackTraces, writer );
}
else
{
System.out.println( "Checking core error reporter for help." );
Throwable reportingError = coreErrorReporter.findReportedException( e );
boolean result = false;
@ -105,7 +108,10 @@ public privileged aspect ErrorReportingAspect
writer.write( CLIReportingUtils.NEWLINE );
writer.write( CLIReportingUtils.NEWLINE );
Throwable cause = coreErrorReporter.getRealCause( reportingError );
cause.printStackTrace( new PrintWriter( writer ) );
if ( cause != null )
{
cause.printStackTrace( new PrintWriter( writer ) );
}
}
writer.write( CLIReportingUtils.NEWLINE );

View File

@ -1,26 +1,17 @@
package org.apache.maven.project.aspect;
import org.apache.maven.project.error.DefaultProjectErrorReporter;
import org.apache.maven.project.error.ProjectErrorReporter;
import org.apache.maven.project.error.ProjectReporterManager;
public abstract aspect AbstractProjectErrorReporterAspect
public abstract aspect AbstractProjectErrorReporterAspect issingleton()
{
private ProjectErrorReporter reporter;
public void setProjectErrorReporter( ProjectErrorReporter reporter )
{
this.reporter = reporter;
}
protected pointcut notWithinAspect():
!within( org.apache.maven.project.aspect.*+ );
protected ProjectErrorReporter getReporter()
{
if ( reporter == null )
{
reporter = new DefaultProjectErrorReporter();
}
return reporter;
return ProjectReporterManager.getReporter();
}
}

View File

@ -27,11 +27,13 @@ public privileged aspect PBEDerivativeReporterAspect
private pointcut mavenTools_buildDeploymentArtifactRepository( DeploymentRepository repo ):
call( ArtifactRepository MavenTools+.buildDeploymentArtifactRepository( DeploymentRepository ) )
&& args( repo );
&& args( repo )
&& notWithinAspect();
private pointcut pbldr_processProjectLogic( MavenProject project, File pomFile ):
execution( private MavenProject DefaultMavenProjectBuilder.processProjectLogic( MavenProject, File, .. ) )
&& args( project, pomFile, .. );
&& args( project, pomFile, .. )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -55,7 +57,8 @@ public privileged aspect PBEDerivativeReporterAspect
private pointcut mavenTools_buildArtifactRepository( Repository repo ):
call( ArtifactRepository MavenTools+.buildArtifactRepository( Repository ) )
&& args( repo );
&& args( repo )
&& notWithinAspect();
private boolean processingPluginRepositories = false;
@ -120,9 +123,10 @@ public privileged aspect PBEDerivativeReporterAspect
// InvalidProjectVersionException
private pointcut pbldr_createNonDependencyArtifacts():
call( protected * DefaultMavenProjectBuilder.createPluginArtifacts( .. ) )
( call( protected * DefaultMavenProjectBuilder.createPluginArtifacts( .. ) )
|| call( protected * DefaultMavenProjectBuilder.createReportArtifacts( .. ) )
|| call( protected * DefaultMavenProjectBuilder.createExtensionArtifacts( .. ) );
|| call( protected * DefaultMavenProjectBuilder.createExtensionArtifacts( .. ) ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -173,7 +177,8 @@ public privileged aspect PBEDerivativeReporterAspect
// InvalidDependencyVersionException
private pointcut pbldr_buildInternal():
execution( * DefaultMavenProjectBuilder.buildInternal( .. ) );
execution( * DefaultMavenProjectBuilder.buildInternal( .. ) )
&& notWithinAspect();
private MavenProject projectBeingBuilt;
@ -216,7 +221,8 @@ public privileged aspect PBEDerivativeReporterAspect
protected pointcut mms_createArtifacts( MavenProject project ):
call( public static Set MavenMetadataSource.createArtifacts( .., MavenProject ) )
&& args( .., project );
&& args( .., project )
&& notWithinAspect();
// =========================================================================
// Call Stack:

View File

@ -34,22 +34,26 @@ public privileged aspect ProfileErrorReporterAspect
protected pointcut componentLookupException( ComponentLookupException cause ):
handler( ComponentLookupException )
&& args( cause );
&& args( cause )
&& notWithinAspect();
private pointcut pMgr_isActiveExec( Profile profile, ProfileActivationContext context ):
execution( boolean DefaultProfileManager.isActive( Profile, ProfileActivationContext ) )
&& args( profile, context );
&& args( profile, context )
&& notWithinAspect();
private pointcut pAdv_applyActivatedProfiles( Model model, File pomFile ):
execution( private List DefaultProfileAdvisor.applyActivatedProfiles( Model, File, .. ) )
&& args( model, pomFile, .. );
&& args( model, pomFile, .. )
&& notWithinAspect();
private pointcut applyActivatedProfiles_ComponentLookupException( Model model,
File pomFile,
Profile profile ):
call( List PlexusContainer+.lookupList( .. ) )
&& cflow( pAdv_applyActivatedProfiles( model, pomFile ) )
&& cflow( pMgr_isActiveExec( profile, ProfileActivationContext ) );
&& cflow( pMgr_isActiveExec( profile, ProfileActivationContext ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -73,7 +77,8 @@ public privileged aspect ProfileErrorReporterAspect
protected pointcut profileActivatorCall( ProfileActivator activator ):
call( * ProfileActivator+.*( .. ) )
&& target( activator );
&& target( activator )
&& notWithinAspect();
private pointcut applyActivatedProfiles_ActivatorThrown( ProfileActivator activator,
Model model,
@ -82,7 +87,8 @@ public privileged aspect ProfileErrorReporterAspect
ProfileActivationContext context ):
profileActivatorCall( activator )
&& cflow( pAdv_applyActivatedProfiles( model, pomFile ) )
&& cflow( pMgr_isActiveExec( profile, context ) );
&& cflow( pMgr_isActiveExec( profile, context ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -106,14 +112,16 @@ public privileged aspect ProfileErrorReporterAspect
private pointcut pAdv_loadExternalProjectProfiles( Model model, File pomFile ):
execution( private void DefaultProfileAdvisor.loadExternalProjectProfiles( *, Model, File ) )
&& args( *, model, pomFile );
&& args( *, model, pomFile )
&& notWithinAspect();
private pointcut loadExternalProfiles_profileBuilding( Model model,
File pomFile,
File projectDir ):
call( ProfilesRoot MavenProfilesBuilder+.buildProfiles( File ) )
&& cflow( pAdv_loadExternalProjectProfiles( model, pomFile ) )
&& args( projectDir );
&& args( projectDir )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -153,14 +161,16 @@ public privileged aspect ProfileErrorReporterAspect
private pointcut pAdv_getArtifactRepositoriesFromActiveProfiles( String projectId, File pomFile ):
execution( LinkedHashSet DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles( *, File, String ) )
&& args( *, pomFile, projectId );
&& args( *, pomFile, projectId )
&& notWithinAspect();
private pointcut getArtifactRepositoriesFromActiveProfiles_ComponentLookupException( String projectId,
File pomFile,
Profile profile ):
call( List PlexusContainer+.lookupList( .. ) )
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) )
&& cflow( pMgr_isActiveExec( profile, ProfileActivationContext ) );
&& cflow( pMgr_isActiveExec( profile, ProfileActivationContext ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -189,7 +199,8 @@ public privileged aspect ProfileErrorReporterAspect
ProfileActivationContext context ):
profileActivatorCall( activator )
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) )
&& cflow( pMgr_isActiveExec( profile, context ) );
&& cflow( pMgr_isActiveExec( profile, context ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -216,7 +227,8 @@ public privileged aspect ProfileErrorReporterAspect
File pomFile ):
call( ArtifactRepository MavenTools+.buildArtifactRepository( Repository ) )
&& args( repo )
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) );
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:

View File

@ -16,15 +16,18 @@ public privileged aspect ProjectArtifactErrorReporterAspect
private pointcut mlbldr_resolveParentFromRepositories( Parent parentRef, ArtifactRepository localRepo,
List remoteRepos, String childId, File childPomFile ):
execution( File DefaultModelLineageBuilder.resolveParentFromRepository( Parent, ArtifactRepository, List, String, File ) )
&& args( parentRef, localRepo, remoteRepos, childId, childPomFile );
&& args( parentRef, localRepo, remoteRepos, childId, childPomFile )
&& notWithinAspect();
private pointcut anfe_handler( ArtifactNotFoundException cause ):
handler( ArtifactNotFoundException )
&& args( cause );
&& args( cause )
&& notWithinAspect();
private pointcut are_handler( ArtifactResolutionException cause ):
handler( ArtifactResolutionException )
&& args( cause );
&& args( cause )
&& notWithinAspect();
// =========================================================================
// Call Stack:

View File

@ -1,5 +1,7 @@
package org.apache.maven.project.aspect;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.model.Model;
import org.apache.maven.project.DefaultMavenProjectBuilder;
import org.apache.maven.project.build.model.ModelAndFile;
import org.apache.maven.project.build.model.DefaultModelLineageBuilder;
@ -12,17 +14,15 @@ public privileged aspect ProjectIOErrorReporterAspect
extends AbstractProjectErrorReporterAspect
{
private pointcut pbldr_readProject( String projectId, File pomFile ):
execution( * DefaultMavenProjectBuilder.readModel( String, File, .. ) )
&& args( projectId, pomFile, .. );
private pointcut pbldr_readModel( String projectId, File pomFile ):
execution( Model DefaultMavenProjectBuilder.readModel( String, File, boolean ) )
&& args( projectId, pomFile, * );
private pointcut xppEx_handler( XmlPullParserException cause ):
handler( XmlPullParserException )
&& args( cause );
private pointcut ioEx_handler( IOException cause ):
handler( IOException )
&& args( cause );
private pointcut within_pbldr_readModel( String projectId, File pomFile ):
within( DefaultMavenProjectBuilder )
&& cflow( pbldr_readModel( projectId, pomFile ) )
&& !cflowbelow( pbldr_readModel( String, File ) )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -37,8 +37,9 @@ public privileged aspect ProjectIOErrorReporterAspect
// <------ InvalidProjectModelException
// =========================================================================
before( String projectId, File pomFile, XmlPullParserException cause ):
cflow( pbldr_readProject( projectId, pomFile ) )
&& xppEx_handler( cause )
within_pbldr_readModel( projectId, pomFile )
&& call( ProjectBuildingException.new( .., XmlPullParserException ))
&& args( .., cause )
{
getReporter().reportErrorParsingProjectModel( projectId, pomFile, cause );
}
@ -56,8 +57,9 @@ public privileged aspect ProjectIOErrorReporterAspect
// <------ InvalidProjectModelException
// =========================================================================
before( String projectId, File pomFile, IOException cause ):
cflow( pbldr_readProject( projectId, pomFile ) )
&& ioEx_handler( cause )
within_pbldr_readModel( projectId, pomFile )
&& call( ProjectBuildingException.new( .., IOException ))
&& args( .., cause )
{
getReporter().reportErrorParsingProjectModel( projectId, pomFile, cause );
}
@ -70,6 +72,17 @@ public privileged aspect ProjectIOErrorReporterAspect
execution( * DefaultModelLineageBuilder.readModel( File ) )
&& args( pomFile );
private pointcut within_mlbldr_readModel( File pomFile ):
cflow( mlbldr_readModel( pomFile ) )
&& within( DefaultModelLineageBuilder )
&& notWithinAspect();
private pointcut mlbldr_errorParsingParentPom( ModelAndFile childInfo, File parentPomFile, XmlPullParserException cause ):
cflowbelow( mlbldr_resolveParentPom( childInfo ) )
&& within_mlbldr_readModel( parentPomFile )
&& call( ProjectBuildingException.new( .., XmlPullParserException ) )
&& args( .., cause );
// =========================================================================
// Call Stack:
// =========================================================================
@ -83,13 +96,17 @@ public privileged aspect ProjectIOErrorReporterAspect
// <---------- ProjectBuildingException
// =========================================================================
before( ModelAndFile childInfo, File parentPomFile, XmlPullParserException cause ):
cflow( mlbldr_resolveParentPom( childInfo ) )
&& cflow( mlbldr_readModel( parentPomFile ) )
&& xppEx_handler( cause )
mlbldr_errorParsingParentPom( childInfo, parentPomFile, cause )
{
getReporter().reportErrorParsingParentProjectModel( childInfo, parentPomFile, cause );
}
private pointcut mlbldr_errorReadingParentPom( ModelAndFile childInfo, File parentPomFile, IOException cause ):
cflow( mlbldr_resolveParentPom( childInfo ) )
&& within_mlbldr_readModel( parentPomFile )
&& call( ProjectBuildingException.new( .., IOException ))
&& args( .., cause );
// =========================================================================
// Call Stack:
// =========================================================================
@ -103,15 +120,17 @@ public privileged aspect ProjectIOErrorReporterAspect
// <---------- ProjectBuildingException
// =========================================================================
before( ModelAndFile childInfo, File parentPomFile, IOException cause ):
cflow( mlbldr_resolveParentPom( childInfo ) )
&& cflow( mlbldr_readModel( parentPomFile ) )
&& ioEx_handler( cause )
mlbldr_errorReadingParentPom( childInfo, parentPomFile, cause )
{
getReporter().reportErrorParsingParentProjectModel( childInfo, parentPomFile, cause );
}
private pointcut mlbldr_buildModelLineage():
execution( * DefaultModelLineageBuilder.buildModelLineage( .. ) );
private pointcut mlbldr_errorParsingNonParentPom( File pomFile, XmlPullParserException cause ):
!cflow( mlbldr_resolveParentPom( ModelAndFile ) )
&& cflow( mlbldr_readModel( pomFile ) )
&& call( ProjectBuildingException.new( .., XmlPullParserException ))
&& args( .., cause )
&& notWithinAspect();
// =========================================================================
// Call Stack:
@ -123,14 +142,18 @@ public privileged aspect ProjectIOErrorReporterAspect
// <------ ProjectBuildingException
// =========================================================================
before( File pomFile, XmlPullParserException cause ):
cflow( mlbldr_buildModelLineage() )
&& !cflowbelow( mlbldr_buildModelLineage() )
&& cflow( mlbldr_readModel( pomFile ) )
&& xppEx_handler( cause )
mlbldr_errorParsingNonParentPom( pomFile, cause )
{
getReporter().reportErrorParsingProjectModel( "unknown", pomFile, cause );
}
private pointcut mlbldr_errorReadingNonParentPom( File pomFile, IOException cause ):
!cflow( mlbldr_resolveParentPom( ModelAndFile ) )
&& cflow( mlbldr_readModel( pomFile ) )
&& call( ProjectBuildingException.new( .., IOException ))
&& args( .., cause )
&& notWithinAspect();
// =========================================================================
// Call Stack:
// =========================================================================
@ -141,10 +164,7 @@ public privileged aspect ProjectIOErrorReporterAspect
// <------ ProjectBuildingException
// =========================================================================
before( File pomFile, IOException cause ):
cflow( mlbldr_buildModelLineage() )
&& !cflowbelow( mlbldr_buildModelLineage() )
&& cflow( mlbldr_readModel( pomFile ) )
&& ioEx_handler( cause )
mlbldr_errorReadingNonParentPom( pomFile, cause )
{
getReporter().reportErrorParsingProjectModel( "unknown", pomFile, cause );
}

View File

@ -1,25 +0,0 @@
package org.apache.maven.project.aspect;
import org.aspectj.lang.Aspects;
import org.apache.maven.project.error.ProjectErrorReporter;
public aspect ProjectReporterManagerAspect
{
public void setReporter( ProjectErrorReporter reporter )
{
PBEDerivativeReporterAspect pbeDerivativeReporterAspect = (PBEDerivativeReporterAspect) Aspects.aspectOf( PBEDerivativeReporterAspect.class );
pbeDerivativeReporterAspect.setProjectErrorReporter( reporter );
ProfileErrorReporterAspect profileErrorReporterAspect = (ProfileErrorReporterAspect) Aspects.aspectOf( ProfileErrorReporterAspect.class );
profileErrorReporterAspect.setProjectErrorReporter( reporter );
ProjectIOErrorReporterAspect projectIOErrorReporterAspect = (ProjectIOErrorReporterAspect) Aspects.aspectOf( ProjectIOErrorReporterAspect.class );
projectIOErrorReporterAspect.setProjectErrorReporter( reporter );
ProjectArtifactErrorReporterAspect projectArtifactErrorReporterAspect = (ProjectArtifactErrorReporterAspect) Aspects.aspectOf( ProjectArtifactErrorReporterAspect.class );
projectArtifactErrorReporterAspect.setProjectErrorReporter( reporter );
}
}

View File

@ -76,7 +76,7 @@ public final class ModelUtils
public static void mergePluginLists( PluginContainer childContainer, PluginContainer parentContainer,
boolean handleAsInheritance )
{
if ( childContainer == null || parentContainer == null )
if ( ( childContainer == null ) || ( parentContainer == null ) )
{
// nothing to do.
return;
@ -84,7 +84,7 @@ public final class ModelUtils
List parentPlugins = parentContainer.getPlugins();
if ( parentPlugins != null && !parentPlugins.isEmpty() )
if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() )
{
parentPlugins = new ArrayList( parentPlugins );
@ -98,7 +98,7 @@ public final class ModelUtils
String inherited = plugin.getInherited();
if ( inherited != null && !Boolean.valueOf( inherited ).booleanValue() )
if ( ( inherited != null ) && !Boolean.valueOf( inherited ).booleanValue() )
{
it.remove();
}
@ -120,12 +120,12 @@ public final class ModelUtils
// 1. we're not processing the plugins in an inheritance-based merge
// 2. the parent's <inherited/> flag is not set
// 3. the parent's <inherited/> flag is set to true
if ( !handleAsInheritance || parentInherited == null ||
if ( !handleAsInheritance || ( parentInherited == null ) ||
Boolean.valueOf( parentInherited ).booleanValue() )
{
Plugin childPlugin = (Plugin) childPlugins.get( parentPlugin.getKey() );
if ( childPlugin != null && !assembledPlugins.contains( childPlugin ) )
if ( ( childPlugin != null ) && !assembledPlugins.contains( childPlugin ) )
{
Plugin assembledPlugin = childPlugin;
@ -138,7 +138,7 @@ public final class ModelUtils
// if we're processing this as an inheritance-based merge, and
// the parent's <inherited/> flag is not set, then we need to
// clear the inherited flag in the merge result.
if ( handleAsInheritance && parentInherited == null )
if ( handleAsInheritance && ( parentInherited == null ) )
{
parentPlugin.unsetInheritanceApplied();
}
@ -216,7 +216,7 @@ public final class ModelUtils
public static void mergeReportPluginLists( Reporting child, Reporting parent, boolean handleAsInheritance )
{
if ( child == null || parent == null )
if ( ( child == null ) || ( parent == null ) )
{
// nothing to do.
return;
@ -224,7 +224,7 @@ public final class ModelUtils
List parentPlugins = parent.getPlugins();
if ( parentPlugins != null && !parentPlugins.isEmpty() )
if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() )
{
Map assembledPlugins = new TreeMap();
@ -236,7 +236,7 @@ public final class ModelUtils
String parentInherited = parentPlugin.getInherited();
if ( !handleAsInheritance || parentInherited == null ||
if ( !handleAsInheritance || ( parentInherited == null ) ||
Boolean.valueOf( parentInherited ).booleanValue() )
{
@ -251,7 +251,7 @@ public final class ModelUtils
mergeReportPluginDefinitions( childPlugin, parentPlugin, handleAsInheritance );
}
if ( handleAsInheritance && parentInherited == null )
if ( handleAsInheritance && ( parentInherited == null ) )
{
assembledPlugin.unsetInheritanceApplied();
}
@ -278,7 +278,7 @@ public final class ModelUtils
public static void mergePluginDefinitions( Plugin child, Plugin parent, boolean handleAsInheritance )
{
if ( child == null || parent == null )
if ( ( child == null ) || ( parent == null ) )
{
// nothing to do.
return;
@ -289,7 +289,7 @@ public final class ModelUtils
child.setExtensions( true );
}
if ( child.getVersion() == null && parent.getVersion() != null )
if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) )
{
child.setVersion( parent.getVersion() );
}
@ -306,11 +306,11 @@ public final class ModelUtils
// from here to the end of the method is dealing with merging of the <executions/> section.
String parentInherited = parent.getInherited();
boolean parentIsInherited = parentInherited == null || Boolean.valueOf( parentInherited ).booleanValue();
boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ).booleanValue();
List parentExecutions = parent.getExecutions();
if ( parentExecutions != null && !parentExecutions.isEmpty() )
if ( ( parentExecutions != null ) && !parentExecutions.isEmpty() )
{
List mergedExecutions = new ArrayList();
@ -334,7 +334,7 @@ public final class ModelUtils
assembled = childExecution;
}
else if ( handleAsInheritance && parentInherited == null )
else if ( handleAsInheritance && ( parentInherited == null ) )
{
parentExecution.unsetInheritanceApplied();
}
@ -364,13 +364,13 @@ public final class ModelUtils
public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent,
boolean handleAsInheritance )
{
if ( child == null || parent == null )
if ( ( child == null ) || ( parent == null ) )
{
// nothing to do.
return;
}
if ( child.getVersion() == null && parent.getVersion() != null )
if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) )
{
child.setVersion( parent.getVersion() );
}
@ -378,11 +378,11 @@ public final class ModelUtils
// from here to the end of the method is dealing with merging of the <executions/> section.
String parentInherited = parent.getInherited();
boolean parentIsInherited = parentInherited == null || Boolean.valueOf( parentInherited ).booleanValue();
boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ).booleanValue();
List parentReportSets = parent.getReportSets();
if ( parentReportSets != null && !parentReportSets.isEmpty() )
if ( ( parentReportSets != null ) && !parentReportSets.isEmpty() )
{
Map assembledReportSets = new TreeMap();
@ -404,7 +404,7 @@ public final class ModelUtils
assembledReportSet = childReportSet;
}
else if ( handleAsInheritance && parentInherited == null )
else if ( handleAsInheritance && ( parentInherited == null ) )
{
parentReportSet.unsetInheritanceApplied();
}
@ -444,7 +444,7 @@ public final class ModelUtils
List goals = new ArrayList();
if ( childGoals != null && !childGoals.isEmpty() )
if ( ( childGoals != null ) && !childGoals.isEmpty() )
{
goals.addAll( childGoals );
}
@ -479,7 +479,7 @@ public final class ModelUtils
List reports = new ArrayList();
if ( childReports != null && !childReports.isEmpty() )
if ( ( childReports != null ) && !childReports.isEmpty() )
{
reports.addAll( childReports );
}
@ -568,7 +568,7 @@ public final class ModelUtils
List modules = profile.getModules();
if ( modules != null && !modules.isEmpty() )
if ( ( modules != null ) && !modules.isEmpty() )
{
newProfile.setModules( new ArrayList( modules ) );
}
@ -962,7 +962,7 @@ public final class ModelUtils
List goals = exec.getGoals();
if ( goals != null && !goals.isEmpty() )
if ( ( goals != null ) && !goals.isEmpty() )
{
newExec.setGoals( new ArrayList( goals ) );
}

View File

@ -0,0 +1,32 @@
package org.apache.maven.project.error;
public final class ProjectReporterManager
{
private static ProjectErrorReporter reporter;
private ProjectReporterManager()
{
}
public static ProjectErrorReporter getReporter()
{
if ( reporter == null )
{
reporter = new DefaultProjectErrorReporter();
}
return reporter;
}
public static void setReporter( ProjectErrorReporter instance )
{
reporter = instance;
}
public static void clearReporter()
{
reporter = null;
}
}