You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rob Godfrey (JIRA)" <ji...@apache.org> on 2017/06/21 15:51:00 UTC

[jira] [Commented] (PROTON-1508) Code smell in conditional expressions

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

Rob Godfrey commented on PROTON-1508:
-------------------------------------

That definitely looks like a bug - thanks!  (thankfully I don't think many (any?) people are going to encounter this as it will only occur when informing the sender of a transfer that the message content has been partially received, or when recovering partially received messages on reconnection... and I don't think that functionality is implemented anywhere yet)

> Code smell in conditional expressions
> -------------------------------------
>
>                 Key: PROTON-1508
>                 URL: https://issues.apache.org/jira/browse/PROTON-1508
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-j
>            Reporter: JC
>            Priority: Trivial
>
> Hi
> I've found a code smell in a recent snapshot in GitHub (39a5fa78073a2db52929ba5ef9d685356630e581).
> Path: proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ReceivedType.java
> {code}
>  73         public Object get(final int index)
>  74         {
>  75 
>  76             switch(index)
>  77             {
>  78                 case 0:
>  79                     return _impl.getSectionNumber();
>  80                 case 1:
>  81                     return _impl.getSectionOffset();
>  82             }
>  83 
>  84             throw new IllegalStateException("Unknown index " + index);
>  85 
>  86         }
>  87 
>  88         public int size()
>  89         {
>  90             return _impl.getSectionOffset() != null
>  91                       ? 2
>  92                       : _impl.getSectionOffset() != null
>  93                       ? 1
>  94                       : 0;
>  95 
>  96         }
> {code}
> In Line 90 and 92, conditions are actually same. One of condition should be _impl.getSectionNumber() != or others?
> This might be a trivial thing but wanted to report this just in case.
> Thanks!



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org