You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2021/03/04 18:16:49 UTC
[maven-artifact-plugin] branch master updated: [MARTIFACT-13] take
care about missing zip entry
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 3104d77 [MARTIFACT-13] take care about missing zip entry
3104d77 is described below
commit 3104d7759b1585e2bcb9c65714f105be59a5c72d
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Mar 4 19:16:43 2021 +0100
[MARTIFACT-13] take care about missing zip entry
---
.../maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
index f5865b9..5bcecb8 100644
--- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
+++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
@@ -52,6 +52,7 @@ import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
/**
* Utility to download or generate reference buildinfo.
@@ -234,7 +235,12 @@ class ReferenceBuildinfoUtil
private String extractOsName( Artifact a, JarFile jar )
{
String entryName = "META-INF/maven/" + a.getGroupId() + '/' + a.getArtifactId() + "/pom.properties";
- try ( InputStream in = jar.getInputStream( jar.getEntry( entryName ) ) )
+ ZipEntry zipEntry = jar.getEntry( entryName );
+ if ( zipEntry == null )
+ {
+ return null;
+ }
+ try ( InputStream in = jar.getInputStream( zipEntry ) )
{
String content = IOUtil.toString( in, StandardCharsets.UTF_8.name() );
log.debug( "Manifest content: " + content );