Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1508

incorrect size can be returned during Received type encoding

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: proton-j-0.32.0
    • Fix Version/s: proton-j-0.33.0
    • Component/s: proton-j
    • Labels:
      None

      Description

      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

       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         }
      

      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!

        Attachments

          Activity

            People

            • Assignee:
              tabish Timothy Bish
              Reporter:
              lifove JC
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: