reta commented on a change in pull request #656: Consolidate getTargetMethod
calls
URL: https://github.com/apache/cxf/pull/656#discussion_r398959852
##########
File path:
core/src/main/java/org/apache/cxf/validation/AbstractValidationInterceptor.java
##########
@@ -108,15 +107,7 @@ protected Method getServiceMethod(Message message) {
Message inMessage = message.getExchange().getInMessage();
Method method = null;
if (inMessage != null) {
- method = (Method)inMessage.get("org.apache.cxf.resource.method");
- if (method == null) {
- BindingOperationInfo bop =
inMessage.getExchange().getBindingOperationInfo();
- if (bop != null) {
- MethodDispatcher md = (MethodDispatcher)
-
inMessage.getExchange().getService().get(MethodDispatcher.class.getName());
- method = md.getMethod(bop);
- }
- }
+ method = MessageUtils.getTargetMethod(inMessage, null);
Review comment:
Minor, may be introducing the overloaded method
`MessageUtils.getTargetMethod(inMessage)` (which calls the original one with
`null` supplier) would be a bit more cleaner, no need to guess what second
argument is. Alternatively, could be `Optional<Method>` so the caller can raise
exceptions or get along with `null`. What do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services