maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Schulte (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (MNG-6190) maven-resolver-provider's DefaultArtifactDescriptorReader has mismatched constructor and initService methods
Date Tue, 21 Mar 2017 18:19:41 GMT

     [ https://issues.apache.org/jira/browse/MNG-6190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Christian Schulte closed MNG-6190.
----------------------------------
       Resolution: Fixed
         Assignee: Christian Schulte
    Fix Version/s: 3.5.0

The {{versionRangeResolver}} currently is only passed to the {{DefaultModelResolver}}. It
will be used there in 3.5.0 so this fixes a potential {{NullPointerException}}. Thanks for
reporting. 

> maven-resolver-provider's DefaultArtifactDescriptorReader has mismatched constructor
and initService methods
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-6190
>                 URL: https://issues.apache.org/jira/browse/MNG-6190
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 3.5.0-alpha-1
>            Reporter: Laird Nelson
>            Assignee: Christian Schulte
>             Fix For: 3.5.0
>
>
> In {{DefaultArtifactDescriptorReader.java}}, the constructor annotated with {{@Inject}}
differs in the parameters it takes from its {{initService()}} method.
> This discrepancy means among other things that its {{versionRangeResolver}} field is
never initialized when a DI container is doing injection.
> Here is the relevant code, starting at line 112, with a comment where the problem is:
> {code}
>     @Inject
>     DefaultArtifactDescriptorReader( RemoteRepositoryManager remoteRepositoryManager,
VersionResolver versionResolver,
>                                      ArtifactResolver artifactResolver, ModelBuilder
modelBuilder,
>                                      RepositoryEventDispatcher repositoryEventDispatcher,
LoggerFactory loggerFactory )
>     {
>         setRemoteRepositoryManager( remoteRepositoryManager );
>         setVersionResolver( versionResolver );
>         // XXX <-- Note: no versionRangeResolver
>         setArtifactResolver( artifactResolver );
>         setModelBuilder( modelBuilder );
>         setLoggerFactory( loggerFactory );
>         setRepositoryEventDispatcher( repositoryEventDispatcher );
>     }
>     public void initService( ServiceLocator locator )
>     {
>         setLoggerFactory( locator.getService( LoggerFactory.class ) );
>         setRemoteRepositoryManager( locator.getService( RemoteRepositoryManager.class
) );
>         setVersionResolver( locator.getService( VersionResolver.class ) );
>         setVersionRangeResolver( locator.getService( VersionRangeResolver.class ) );
>         setArtifactResolver( locator.getService( ArtifactResolver.class ) );
>         setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class
) );
>         modelBuilder = locator.getService( ModelBuilder.class );
>         if ( modelBuilder == null )
>         {
>             setModelBuilder( new DefaultModelBuilderFactory().newInstance() );
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message