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:17:00 UTC
[jira] [Updated] (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:all-tabpanel ]
Robbie Gemmell updated PROTON-1508:
-----------------------------------
Summary: incorrect size can be returned during Received type encoding (was: Code smell in conditional expressions)
> 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