You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/06/02 16:12:50 UTC

[GitHub] [maven] 2997ms commented on a change in pull request #337: [MNG-6891] Improve user-friendliness --fail-on-severity

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