cstamas commented on code in PR #175:
URL: 
https://github.com/apache/maven-shade-plugin/pull/175#discussion_r1114292021


##########
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() );
+        org.eclipse.aether.artifact.DefaultArtifact coordinate = new 
DefaultArtifact( artifact.getGroupId(),
+                artifact.getArtifactId(), classifier, 
artifactType.getExtension(), artifact.getVersion(),

Review Comment:
   actually this `artifactType.getExtension()` is NPE prone, as artifactType 
can be 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]

Reply via email to