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

(bf) NullPointerException when bulk putting from non-direct IntBuffer to direct

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • core-libs
    • b55
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      When running the attached program, an unexpected NullPointerException occurs.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile and run the attached program
      2. Observe a NullPointerException.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected the program to just run until completion, with no output.
      ACTUAL -
      A NullPointerException occurs.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.NullPointerException
              at java.nio.DirectIntBufferS.put(DirectIntBufferS.java:304)
              at java.nio.DirectIntBufferS.put(DirectIntBufferS.java:289)
              at BufferTest.main(BufferTest.java:7)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.nio.*;

      public class BufferTest {
          public static void main(String[] args) {
              IntBuffer direct_buffer = ByteBuffer.allocateDirect(100).asIntBuffer();
              IntBuffer nondirect_buffer = ByteBuffer.allocate(100).asIntBuffer();
              direct_buffer.put(nondirect_buffer);
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use buffer of the same type (direct vs. non-direct)
      ###@###.### 2005-1-25 04:50:16 GMT

            sjiang Shanliang Jiang (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: