You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Robbie Gemmell (JIRA)" <ji...@apache.org> on 2019/05/01 10:24:00 UTC

[jira] [Commented] (PROTON-1508) incorrect size can be returned during Received type encoding

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

Robbie Gemmell commented on PROTON-1508:
----------------------------------------

It was a bug and the change looks good, though since both fields are mandatory the only situation it would have had any effect would already be an illegal state to be in (and as Rob said, don't know of anything using this).

> incorrect size can be returned during Received type encoding
> ------------------------------------------------------------
>
>                 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
>             Fix For: proton-j-0.33.0
>
>
> 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