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

Java 6 embedded rhino is not accepting package prefix other than (com & org)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 6u24
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_24"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Professional Version 2002 Service Pack 3

      A DESCRIPTION OF THE PROBLEM :
      In a nutshell Java 6 embedded rhino is not honoring java package names starting with anything other than com & org.

      Let's say I have a java class file called org.test.OrgTest with a main method. I am able to successfully call it from java & jrunscript. Whereas, if I have a class called gov.test.GovTest or ch.test.ChTest , I cannot call it from jrunscript.

      I also tried from ScriptManager class and it is the same behavior. I have created a demo project, which would help you understand better about this bug.

       

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please download the following zip file & extract it & read the readme.txt for the success & failure test cases.

      http://code.google.com/p/scriptmonkey/downloads/detail?name=Java6RhinoPackagePrefixBug.zip&can=2&q=


      Here is how to reproduce this error.

      Successful Test Case 1
      ----------------------
      $ java -classpath Java6RhinoPackagePrefixBugTest.jar com.test.ComTest
      This is ComTest

      $ jrunscript -classpath Java6RhinoPackagePrefixBugTest.jar -e "com.test.ComTest
      .main([]);"
      This is ComTest

      Successful Test Case 2
      ----------------------
      $ java -classpath Java6RhinoPackagePrefixBugTest.jar org.test.OrgTest
      This is OrgTest!

      $ jrunscript -classpath Java6RhinoPackagePrefixBugTest.jar -e "org.test.OrgTest
      .main([]);"
      This is OrgTest!

      Failure Test Case 1
      -------------------
      $ java -classpath Java6RhinoPackagePrefixBugTest.jar ch.test.ChTest
      This is ChTest!

      $ jrunscript -classpath Java6RhinoPackagePrefixBugTest.jar -e "ch.test.ChTest.main([]);"
      script error: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "ch"
      is not defined. (<string>#1) in <string> at line number 1

      Failure Test Case 2
      -------------------
      $ java -classpath Java6RhinoPackagePrefixBugTest.jar gov.test.GovTest
      This is GovTest

      $ jrunscript -classpath Java6RhinoPackagePrefixBugTest.jar -e "gov.test.GovTest.main([]);"
      script error: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "gov" is not defined. (<string>#1) in <string> at line number 1



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      All the source code is embedded within this zip file

      http://code.google.com/p/scriptmonkey/downloads/detail?name=Java6RhinoPackagePrefixBug.zip&can=2&q=
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              sundar Sundararajan Athijegannathan
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: