[java-mvn-enforcer] branch main updated: JMVN-22 SNAPSHOT version checking is too strict for M2 checking

Rod Widdowson rdw at steadingsoftware.com
Wed Jan 26 14:01:41 UTC 2022


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-mvn-enforcer.

View the commit online:
http://git.shibboleth.net/view/?p=java-mvn-enforcer.git;a=commit;h=fd0357ff0f9a4fcb2b8e85938c48d219813748a0

The following commit(s) were added to refs/heads/main by this push:
     new fd0357f  JMVN-22 SNAPSHOT version checking is too strict for M2 checking
fd0357f is described below

commit fd0357ff0f9a4fcb2b8e85938c48d219813748a0
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Jan 26 09:48:59 2022 +0000

    JMVN-22 SNAPSHOT version checking is too strict for M2 checking
    
    https://shibboleth.atlassian.net/browse/JMVN-22
---
 .../net/shibboleth/mvn/enforcer/impl/M2SigChecker.java   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/main/java/net/shibboleth/mvn/enforcer/impl/M2SigChecker.java b/src/main/java/net/shibboleth/mvn/enforcer/impl/M2SigChecker.java
index a652d2a..968de85 100644
--- a/src/main/java/net/shibboleth/mvn/enforcer/impl/M2SigChecker.java
+++ b/src/main/java/net/shibboleth/mvn/enforcer/impl/M2SigChecker.java
@@ -90,6 +90,13 @@ public class M2SigChecker extends BaseSigChecker {
                 return result;
             }
             final PomArtifact info  = artifactFromPath(relativePath);
+            if (info == null || info.getVersion() == null) {
+                log.error("Badly located jar file {}", file);
+                return result;
+            }
+            if (info.getVersion().endsWith("SNAPSHOT")) {
+                return result;
+            }
             if (!checkSignature(new BufferedInputStream(new FileInputStream(file.toFile())), info)) {
                 failCount ++;
             }
@@ -102,9 +109,18 @@ public class M2SigChecker extends BaseSigChecker {
          */
         private PomArtifact artifactFromPath(Path path) {
             final Path versionDir = path.getParent();
+            if (versionDir == null) {
+                return null;
+            }
             final Path artifactDir = versionDir.getParent();
+            if (artifactDir  == null) {
+                return null;
+            }
             final String artifactId = artifactDir.getFileName().toString();
             final Path groupDir = artifactDir.getParent();
+            if (groupDir  == null) {
+                return null;
+            }
             final String version = versionDir.getFileName().toString();
             final String fileName = path.getFileName().toString();
             final String garnish;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list