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

Exception when accessing Enumerator object from VBScript (ASP)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.2
    • deploy
    • tiger
    • x86
    • windows_2000



      Name: gm110360 Date: 04/23/2003


      FULL PRODUCT VERSION :
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

      FULL OS VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      MS Windows Scrip Host version 5.6

      A DESCRIPTION OF THE PROBLEM :
      A simple test bean returns a Properties object froma amethod. The "getPropertyNames" method returns an Enumerator. Method calls on the numerator throw:

      java.lang.IllegalAccessException: Class sun.plugin.com.MethodDispatcher can not access a member of class java.util.Hashtable$Enumerator with modifiers "public"
      at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
      at sun.plugin.com.DispatchImpl.invoke(Unknown Source)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile TestBean.java (below)
      Put it in a Jar
      Run packager against the jar
      Put the jar in j2re1.4.2\axbridge\lib
      Put the resultant DLL in j2re1.4.2\axbridge\bin
      Register the dll using regsvr32

      Create testbean.vbs with the script contents below.
      Run in a DOS box using "cscript testbean.vbs"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Output from the script:

      Microsoft (R) Windows Script Host Version 5.6
      Copyright (C) Microsoft Corporation 1996-2001. Tous droits réservés.

      defaultname
      new name
      OK to here
      End

      Output from the script:

      Microsoft (R) Windows Script Host Version 5.6
      Copyright (C) Microsoft Corporation 1996-2001. Tous droits réservés.

      defaultname
      new name
      OK to here
      C:\Documents and Settings\mbartlet\Mes documents\Scripting\Hello.vbs(10, 2) (nul
      l): java.lang.IllegalAccessException: Class sun.plugin.com.MethodDispatcher can
      not access a member of class java.util.Hashtable$Enumerator with modifiers "publ
      ic"

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      In the DOS console:

      C:\Documents and Settings\mbartlet\Mes documents\Scripting\Hello.vbs(10, 2) (nul
      l): java.lang.IllegalAccessException: Class sun.plugin.com.MethodDispatcher can
      not access a member of class java.util.Hashtable$Enumerator with modifiers "publ
      ic"

      In the Java console:

      java.lang.IllegalAccessException: Class sun.plugin.com.MethodDispatcher can not access a member of class java.util.Hashtable$Enumerator with modifiers "public"
      at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
      at sun.plugin.com.DispatchImpl.invoke(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      The bean code:

      import java.util.*;

      public class TestBean
      {
      public TestBean()
      {
      name = "defaultname";
      }

      public String getName()
      {
      return name;
      }

      public Properties getSystemEnvironment()
      {
      return System.getProperties();
      }

      public void setName(String newName)
      {
      name = newName;
      }

      private String name;
      }

      The script code (executed using Windows Script Engine):

      set cn = CreateObject("TestBean.Bean")
      oldname = cn.name
      WScript.echo(oldname)
      cn.name = "new name"
      newname = cn.name
      WScript.echo(newname)
      set props = cn.systemEnvironment
      set enumb = props.propertyNames()
      WScript.echo("OK to here")
      more = enumb.hasMoreElements
      WScript.echo("End")


      ---------- END SOURCE ----------
      (Review ID: 184658)
      ======================================================================

            ccheung Calvin Cheung
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: