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

JShell: crashes with extremely long result value

XMLWordPrintable

    • b133
    • x86_64
    • linux
    • Verified

      FULL PRODUCT VERSION :
      JDK 9build120

      ADDITIONAL OS VERSION INFORMATION :
      4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When a lsit shall be assigned, jshell crashes

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      jshell> List<Long> numbers = new ArrayList<>();
      numbers ==> []
                                                                                                                                                                                                                     
      jshell> Random random = new Random();
      random ==> java.util.Random@5622fdf
                                                                                                                                                                                                                     
      jshell> int max = 1000000 + random.nextInt(1000000);
      max ==> 1054302
                                                                                                                                                                                                                     
      jshell> for (int i = 0; i < max; i++) {
         ...> numbers.add((long)random.nextInt(100));
         ...> }
                                                                                                                                                                                                                     
      jshell> numbers.stream().count()
      $10 ==> 1054302
      (Its possible to use the list)
      jshell> numbers
                                                 
      | State engine terminated.
      | Restore definitions with: /reload -restore
      Exception in thread "main" java.io.UTFDataFormatException
              at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(java.base@9-ea/ObjectOutputStream.java:2169)
              at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(java.base@9-ea/ObjectOutputStream.java:2012)
              at java.io.ObjectOutputStream.writeUTF(java.base@9-ea/ObjectOutputStream.java:869)
              at jdk.internal.jshell.remote.RemoteAgent.commandLoop(jdk.jshell@9-ea/RemoteAgent.java:138)
              at jdk.internal.jshell.remote.RemoteAgent.main(jdk.jshell@9-ea/RemoteAgent.java:62)
      numbers ==>
       

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the list shall be assigned to a new variable
      ACTUAL -
      Exception

      REPRODUCIBILITY :
      This bug can be reproduced always.

            rfield Robert Field (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: