Discussion:
[maven-enforcer] branch MENFORCER-314 updated (d2f19c4 -> 9e00adf)
k***@apache.org
2018-12-09 13:01:01 UTC
Permalink
This is an automated email from the ASF dual-hosted git repository.

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


discard d2f19c4 Merge branch 'MENFORCER-314' of https://github.com/famod/maven-enforcer into MENFORCER-314
discard d44147f [MENFORCER-314] - Warn if EnforcerRuleException has no message
new 9e00adf [MENFORCER-314] - Warn if EnforcerRuleException has no 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 (d2f19c4)
\
N -- N -- N refs/heads/MENFORCER-314 (9e00adf)

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:
k***@apache.org
2018-12-09 13:01:02 UTC
Permalink
This is an automated email from the ASF dual-hosted git repository.

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

commit 9e00adf96db69ca34f99241b265b28a2c090e6b6
Author: Falko Modler <***@users.noreply.github.com>
AuthorDate: Sat Oct 27 17:07:02 2018 +0200

[MENFORCER-314] - Warn if EnforcerRuleException has no message

This should help to find out why DependencyConvergence
sometimes fails without providing a message.
---
.../apache/maven/plugins/enforcer/EnforceMojo.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java b/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
index 3fa2b3b..c4c76c0 100644
--- a/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
+++ b/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
@@ -217,16 +217,27 @@ public class EnforceMojo
}
else
{
+ // log a warning in case the exception message is missing
+ // so that the user can figure out what is going on
+ final String exceptionMessage = e.getMessage();
+ if ( exceptionMessage != null )
+ {
+ log.debug( "Adding " + level + " message due to exception", e );
+ }
+ else
+ {
+ log.warn( "Rule " + i + ": " + currentRule + " failed without a message", e );
+ }
+ // add the 'failed/warned' message including exceptionMessage
+ // which might be null in rare cases
if ( level == EnforcerLevel.ERROR )
{
hasErrors = true;
- list.add( "Rule " + i + ": " + currentRule + " failed with message:\n" + e.getMessage() );
- log.debug( "Adding failure due to exception", e );
+ list.add( "Rule " + i + ": " + currentRule + " failed with message:\n" + exceptionMessage );
}
else
{
- list.add( "Rule " + i + ": " + currentRule + " warned with message:\n" + e.getMessage() );
- log.debug( "Adding warning due to exception", e );
+ list.add( "Rule " + i + ": " + currentRule + " warned with message:\n" + exceptionMessage );
}
}
}

Loading...