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

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

JC created PROTON-1508:
--------------------------

             Summary: 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