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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]