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

Nashorn scripting: here document with only whitespace gives error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 8u31
    • core-libs
    • b22
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_31"
      Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      In a nashorn script, a here document with only whitespace causes an error.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a file "test.js" with the following content:

      print(<<EOD);

      EOD

      So the file contains 4 lines: 1 blank line inside the here document, & 1 blank line after the second occurrence of EOD.

      Now run the script with the jjs tool, on Windows:
      jjs -scripting test.js

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      a blank line is printed
      ACTUAL -
      test.js:3:3 Here string missing end marker "EOD"
      EOD
               ^

      REPRODUCIBILITY :
      This bug can be reproduced always.

            sdama Srinivas Dama (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: