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

Nashorn scripting: here document with only whitespace gives error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u31
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b22
    • CPU:
      x86
    • OS:
      windows_8

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: