Uploaded image for project: 'Commons Codec'
  1. Commons Codec
  2. CODEC-261

Unable to encode read-only ByteBuffer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.13
    • 1.14
    • None

    Description

      A read-only array-backed ByteBuffer fails to encode, because the backing array is not accessible.

      Hex.encodeHex(ByteBuffer.wrap(new byte[]{1}).asReadOnlyBuffer())
      
      java.nio.ReadOnlyBufferException
          at java.nio.ByteBuffer.array(ByteBuffer.java:996)
          at org.apache.commons.codec.binary.Hex.encodeHex(Hex.java:213)
          at org.apache.commons.codec.binary.Hex.encodeHex(Hex.java:172)
          at org.apache.commons.codec.binary.Hex.encodeHex(Hex.java:140)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jameshowe James Howe
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: