Copilot commented on code in PR #1813:
URL: https://github.com/apache/struts/pull/1813#discussion_r3651975999


##########
core/src/main/java/org/apache/struts2/config/entities/PackageConfig.java:
##########
@@ -517,6 +518,26 @@ public Builder addActionConfig(String name, ActionConfig 
action) {
             return this;
         }
 
+        /**
+         * Re-inserts this package's action configs into a new 
insertion-ordered map,
+         * ordered by the supplied comparator over the action-name keys. Must 
be called
+         * before {@link #build()}.
+         *
+         * @param byActionName comparator over action names determining match 
precedence
+         * @return this builder
+         * @since 7.3.0 (WW-3784)
+         */
+        public Builder reorderActionConfigs(Comparator<String> byActionName) {
+            List<Map.Entry<String, ActionConfig>> entries = new 
ArrayList<>(target.actionConfigs.entrySet());
+            entries.sort(Map.Entry.comparingByKey(byActionName));
+            Map<String, ActionConfig> reordered = new LinkedHashMap<>();

Review Comment:
   `PackageConfig.Builder.reorderActionConfigs(...)` accepts a public 
comparator but doesn’t validate it. If `byActionName` is null, this will fail 
later with a less-clear NPE from `comparingByKey`, rather than at the API 
boundary with an explicit message.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to