[maven-enforcer] branch MENFORCER-317 updated (1aad120 -> b6c9b73)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven-enforcer] branch MENFORCER-317 updated (1aad120 -> b6c9b73)

khmarbaise
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MENFORCER-317
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git.


 discard 1aad120  [MENFORCER-317] - Fix RequireFileChecksum ignores configured message
     add 7b02571  Changed configuration for allowedPluginRepositories
     new b6c9b73  [MENFORCER-317] - Fix RequireFileChecksum ignores configured message

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1aad120)
            \
             N -- N -- N   refs/heads/MENFORCER-317 (b6c9b73)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../it/projects/require-no-repositories-allow-plugin-repo/pom.xml    | 4 +++-
 .../src/it/projects/require-no-repositories-allow-repo/pom.xml       | 4 +++-
 .../require-no-repositories_failure_allowed-plugin-repo/pom.xml      | 5 ++++-
 .../it/projects/require-no-repositories_failure_repositories/pom.xml | 4 +++-
 4 files changed, 13 insertions(+), 4 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[maven-enforcer] 01/01: [MENFORCER-317] - Fix RequireFileChecksum ignores configured message

khmarbaise
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MENFORCER-317
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git

commit b6c9b73f2ef28975733c43f3869bb97d3e166520
Author: Falko Modler <[hidden email]>
AuthorDate: Tue Sep 4 23:44:32 2018 +0200

    [MENFORCER-317] - Fix RequireFileChecksum ignores configured message
---
 .../maven/plugins/enforcer/RequireFileChecksum.java   |  9 +++++++--
 .../plugins/enforcer/TestRequireFileChecksum.java     | 19 +++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
index 1ab2aba..4ec1c54 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
@@ -100,8 +100,13 @@ public class RequireFileChecksum
             }
             if ( !checksum.equalsIgnoreCase( this.checksum ) )
             {
-                throw new EnforcerRuleException( this.type + " hash of " + this.file + " was " + checksum
-                    + " but expected " + this.checksum );
+                String exceptionMessage = getMessage();
+                if ( exceptionMessage == null )
+                {
+                    exceptionMessage = this.type + " hash of " + this.file + " was " + checksum
+                        + " but expected " + this.checksum;
+                }
+                throw new EnforcerRuleException( exceptionMessage );
             }
         }
         catch ( IOException e )
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
index 4333cb3..3f8ed9b 100644
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
@@ -176,6 +176,25 @@ public class TestRequireFileChecksum
     }
 
     @Test
+    public void testFileChecksumMd5ChecksumMismatchFailureWithMessage()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+        String configuredMessage = "testMessage";
+
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( configuredMessage );
+
+        rule.setFile( f );
+        rule.setChecksum( "ffeeddccbbaa99887766554433221100" );
+        rule.setType( "md5" );
+        rule.setMessage( configuredMessage );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
     public void testFileChecksumSha1()
         throws IOException, EnforcerRuleException
     {