mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
06.15.2011 d44745cf3a55bf943670fe8b262874bcc414ca34
opendj-sdk/opends/src/server/org/opends/server/protocols/asn1/ASN1ByteChannelReader.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS.
 */
package org.opends.server.protocols.asn1;
@@ -330,9 +331,18 @@
    }
    byteBuffer.clear();
    int read = byteChannel.read(byteBuffer);
    byteBuffer.flip();
    return read;
    try
    {
      int read = byteChannel.read(byteBuffer);
      return read;
    }
    finally
    {
      // Make sure that the buffer is flipped even if the read fails in order to
      // ensure that subsequent calls which query the remaining data return
      // valid results.
      byteBuffer.flip();
    }
  }
  /**
@@ -362,6 +372,16 @@
  }
  /**
   * Returns {@code true} if this ASN.1 reader contains unread data.
   *
   * @return {@code true} if this ASN.1 reader contains unread data.
   */
  public boolean hasRemainingData()
  {
    return (saveBufferReader.remaining() != 0) || (byteBuffer.remaining() != 0);
  }
  /**
   * {@inheritDoc}
   */
  public int peekLength() throws ASN1Exception {