You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "aaaZayne (via GitHub)" <gi...@apache.org> on 2026/04/19 16:33:44 UTC
[PR] introduce private method to remove clones [struts]
aaaZayne opened a new pull request, #1666:
URL: https://github.com/apache/struts/pull/1666
Simplify error handling by introducing _ErrorIfAbsent_
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] introduce private method to remove clones [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #1666:
URL: https://github.com/apache/struts/pull/1666
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] introduce private method to remove clones [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart commented on code in PR #1666:
URL: https://github.com/apache/struts/pull/1666#discussion_r3108260508
##########
core/src/main/java/org/apache/struts2/dispatcher/multipart/AbstractMultiPartRequest.java:
##########
@@ -278,15 +276,17 @@ public void parse(HttpServletRequest request, String saveDir) throws IOException
}
LocalizedMessage errorMessage = buildErrorMessage(exClass, e.getMessage(), args);
- if (!errors.contains(errorMessage)) {
- errors.add(errorMessage);
- }
+ ErrorIfAbsent(errorMessage);
} catch (IOException e) {
LOG.warn("Unable to parse request", e);
LocalizedMessage errorMessage = buildErrorMessage(e.getClass(), e.getMessage(), new Object[]{});
- if (!errors.contains(errorMessage)) {
- errors.add(errorMessage);
- }
+ ErrorIfAbsent(errorMessage);
+ }
+ }
+
+ private void ErrorIfAbsent(LocalizedMessage errorMessage) {
Review Comment:
Naming is wrong, it must use `camelCase` notation and it would be good to better express what it does, eg.: `addErrorIfAbsent` or `registerErrorIfAbsent`
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org