cstamas commented on code in PR #175:
URL:
https://github.com/apache/maven-shade-plugin/pull/175#discussion_r1114290727
##########
src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java:
##########
@@ -846,29 +833,29 @@ private void replaceFile( File oldFile, File newFile )
private void copyFiles( File source, File target )
throws IOException
{
- try ( InputStream in = new FileInputStream( source );
- OutputStream out = new FileOutputStream( target ) )
+ try ( InputStream in = Files.newInputStream( source.toPath() );
+ OutputStream out = Files.newOutputStream( target.toPath() ) )
{
IOUtil.copy( in, out );
}
}
private File resolveArtifactForClassifier( Artifact artifact, String
classifier )
{
- DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate();
- coordinate.setGroupId( artifact.getGroupId() );
- coordinate.setArtifactId( artifact.getArtifactId() );
- coordinate.setVersion( artifact.getVersion() );
- coordinate.setExtension( "jar" );
- coordinate.setClassifier( classifier );
+ ArtifactType artifactType =
session.getRepositorySession().getArtifactTypeRegistry().get(
artifact.getType() );
Review Comment:
This is NPE prone: i forgot that resolver ArtifactTypeRegistry is DIFFERENT
that maven's ArtifactHandlerManager (never returns null).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]