diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java index 3132006f0..1737d2aef 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java @@ -588,7 +588,18 @@ public enum Color { auto; public static Optional of(String color) { - return color == null ? Optional.empty() : Optional.of(Color.valueOf(color)); + if (color == null) { + return Optional.empty(); + } else if ("always".equals(color) || "yes".equals(color) || "force".equals(color)) { + return Optional.of(Color.always); + } else if ("never".equals(color) || "no".equals(color) || "none".equals(color)) { + return Optional.of(Color.never); + } else if ("auto".equals(color) || "tty".equals(color) || "if-tty".equals(color)) { + return Optional.of(Color.auto); + } else { + throw new IllegalArgumentException( + "Invalid color configuration value '" + color + "'. Supported are 'auto', 'always', 'never'."); + } } }