You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/04/29 19:15: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=16829635#comment-16829635 ] 

ASF subversion and git services commented on PROTON-1508:
---------------------------------------------------------

Commit c63732a89586dbdb52c4b46e22b9c565699f10ad in qpid-proton-j's branch refs/heads/master from Timothy Bish
[ https://gitbox.apache.org/repos/asf?p=qpid-proton-j.git;h=c63732a ]

PROTON-1508 Fix incorrect size value returned from Received type

> 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
(v7.6.3#76005)

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