maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven] 2997ms commented on a change in pull request #337: [MNG-6891] Improve user-friendliness --fail-on-severity
Date Tue, 02 Jun 2020 16:12:50 GMT

2997ms commented on a change in pull request #337:
URL: https://github.com/apache/maven/pull/337#discussion_r434002531



##########
File path: maven-slf4j-wrapper/src/main/java/org/apache/maven/logwrapper/LogLevelRecorder.java
##########
@@ -21,17 +21,29 @@
 
 import org.slf4j.event.Level;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Responsible for keeping state of whether the threshold of the --fail-on-severity flag
has been hit.
  */
 public class LogLevelRecorder
 {
+    private static final Map<String, Level> ACCEPTED_LEVELS = new HashMap<>();
+    static
+    {
+        ACCEPTED_LEVELS.put( "WARN", Level.WARN );
+        ACCEPTED_LEVELS.put( "WARNING", Level.WARN );
+        ACCEPTED_LEVELS.put( "ERROR", Level.ERROR );
+    }
+
     private final Level logThreshold;
     private boolean metThreshold = false;
 
     public LogLevelRecorder( String threshold )
     {
-        Level level = Level.valueOf( threshold );
+        Level level = determineThresholdLevel( threshold );
+
         if ( level.toInt() < Level.WARN.toInt() )

Review comment:
       Then this won't be executed, I make a pr to delete this. https://github.com/apache/maven/pull/360





----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message