You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by "ottlinger (via GitHub)" <gi...@apache.org> on 2024/09/08 14:36:55 UTC

Re: [PR] RAT-394: fix to make all code use DefaultLog (Harmonize - Part 4) [creadur-rat]

ottlinger commented on code in PR #299:
URL: https://github.com/apache/creadur-rat/pull/299#discussion_r1749253948


##########
apache-rat-core/src/main/java/org/apache/rat/commandline/Arg.java:
##########
@@ -659,4 +675,66 @@ public static void reset() {
             }
         }
     }
+
+    /**
+     * Finds the Arg that an Option is in.
+     * @param optionToFind the Option to locate.
+     * @return The Arg or {@code null} if no Arg is found.
+     */
+    public static Arg findArg(Option optionToFind) {
+        for (Arg arg : Arg.values()) {
+            for (Option candidate : arg.group.getOptions()) {
+                if (optionToFind.equals(candidate)) {
+                    return arg;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Finds the Arg that contains an Option with the specified key.
+     * @param key the key for the Option to locate.
+     * @return The Arg or {@code null} if no Arg is found.
+     */
+    public static Arg findArg(String key) {

Review Comment:
   Is NPE-safeness an issue here?



##########
apache-rat-core/src/main/java/org/apache/rat/commandline/Arg.java:
##########
@@ -659,4 +675,66 @@ public static void reset() {
             }
         }
     }
+
+    /**
+     * Finds the Arg that an Option is in.
+     * @param optionToFind the Option to locate.
+     * @return The Arg or {@code null} if no Arg is found.
+     */
+    public static Arg findArg(Option optionToFind) {

Review Comment:
   Is NPE-safeness an issue here?



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

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

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