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

Nashorn $ENV.PWD is originally undefined

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8-pool
    • core-libs
    • b69
    • x86
    • windows_8

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

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.3.9600]

        A DESCRIPTION OF THE PROBLEM :
        In Nashorn shell scripting, the variable $ENV.PWD contains the current working directory, that is used when executing commands. However, initially, $ENV.PWD is undefined.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Save the script below to a file "test.js" and run "jjs -scripting test.js" from the command-line.

        print($ENV.PWD);
        $ENV.PWD = "C:\\Users";
        print($ENV.PWD);


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        2 lines are printed: the first is the directory where you saved the script, the second is "C:\Users"
        ACTUAL -
        2 lines are printed: the first is "undefined", the second is "C:\Users"

        REPRODUCIBILITY :
        This bug can be reproduced always.

              mhaupt Michael Haupt
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: