[ 
https://issues.apache.org/jira/browse/CAMEL-12059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16280935#comment-16280935
 ] 

ASF GitHub Bot commented on CAMEL-12059:
----------------------------------------

aldettinger commented on a change in pull request #2129: CAMEL-12059: Remove 
redundant null checks from instanceof checks
URL: https://github.com/apache/camel/pull/2129#discussion_r155361948
 
 

 ##########
 File path: camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
 ##########
 @@ -192,7 +192,7 @@ public boolean onExchange(Exchange exchange) {
                 // and just continue to route that on the consumer side, which 
causes the EventNotifier not to
                 // emit events when the consumer received the exchange, as its 
already done. For example by
                 // ProducerTemplate which creates the UoW before producing 
messages.
-                if (exchange.getFromEndpoint() != null && 
exchange.getFromEndpoint() instanceof DirectEndpoint) {
+                if (exchange.getFromEndpoint() instanceof DirectEndpoint) {
                     return true;
 
 Review comment:
   exchange.getFromEndpoint() would be idempotent most of the time, so this ok.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Remove redundant null checks from instanceof checks
> ---------------------------------------------------
>
>                 Key: CAMEL-12059
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12059
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.20.1
>            Reporter: Marc Carter
>            Priority: Trivial
>
> The null check in
> {{if (exchange.getFromEndpoint() != null && exchange.getFromEndpoint() 
> instanceof DirectEndpoint)}}
> is redundant, this is equivalent to
> {{if (exchange.getFromEndpoint() instanceof DirectEndpoint)}}
> Basic use of IntelliJ Structural Search and Replace with:
> {{$Expr$ != null && $Expr$ instanceof $Type$}}
> finds (and can correct) dozens of examples



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to