camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-12059) Remove redundant null checks from instanceof checks
Date Thu, 07 Dec 2017 18:01:00 GMT

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

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

drekbour 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_r155595146
 
 

 ##########
 File path: camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
 ##########
 @@ -248,13 +248,13 @@ public Expression newInstance(CamelContext camelContext) throws Exception
{
 
                     parameters.replaceAll(
                         (k, v) -> {
-                            if (v != null && v instanceof String) {
+                            if (v instanceof String) {
                                 try {
                                     v = camelContext.resolvePropertyPlaceholders((String)
v);
                                 } catch (Exception e) {
                                     throw new IllegalArgumentException(
-                                        String.format("Exception while resolving %s (%s)",
k, v.toString()),
-                                        e
+                                            String.format("Exception while resolving %s (%s)",
k, v.toString()),
+                                            e
 
 Review comment:
   Will remove spurious formatting, note this is because Camel no longer provides intellij
IDE configs mentioned here: http://camel.apache.org/set-up-your-ide.html
   I'm completely liable (especially when using refactoring utils) to change details like
this without being aware. Is there a something you can share then I can just re-run the refactoring
from scratch and force-push to my repo.

----------------------------------------------------------------
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:
users@infra.apache.org


> 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)

Mime
View raw message