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

CharBuffer.array() causing java.lang.UnsupportedOperationException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u25
    • Fix Version/s: 8u25
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_25"
      Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.10.1

      A DESCRIPTION OF THE PROBLEM :
      When creating CharBuffer using ByteBuffer.asCharBuffer(), the instance of the ByteBufferAsCharBufferB is created and it has memeber
      protected final ByteBuffer bb
      Which is filled with the buffer bytes, but when calling array() method on it (method from the super class), the array method check if the member hb from the super class in not null, but it's null then the exception is thrown.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      CharBuffer cBuffer = ByteBuffer.wrap(...byte array).asCharBuffer();
      cBuffer.array();

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected char array
      ACTUAL -
      java.lang.UnsupportedOperationException is thrown.

      Caused by: java.lang.UnsupportedOperationException
      at java.nio.CharBuffer.array(CharBuffer.java:994)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.UnsupportedOperationException is thrown.

      Caused by: java.lang.UnsupportedOperationException
      at java.nio.CharBuffer.array(CharBuffer.java:994)


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              bpb Brian Burkhalter
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: