Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8239022

Error in SSLEngine Javadoc sample code

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      This is a documentation issue

      A DESCRIPTION OF THE PROBLEM :
      The sample code for handling buffer underflow during SSLEngine.wrap references the wrong buffer. It should reference "src" instead of "dst". I have annotated the snippet below:

         BUFFER_UNDERFLOW:
             int netSize = engine.getSession().getPacketBufferSize();
             // Resize buffer if needed.
             if (netSize > dst.capacity()) { ----> this should be src.capacity()
                 ByteBuffer b = ByteBuffer.allocate(netSize);
                 src.flip();
                 b.put(src);
                 src = b;
             }
             // Obtain more inbound network data for src,
             // then retry the operation.
             break;


        Attachments

          Activity

            People

            Assignee:
            wetmore Bradford Wetmore
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: