jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rony G. Flatscher" <Rony.Flatsc...@wu-wien.ac.at>
Subject Question on strange "java.lang.IllegalAccessException" in "EngineUtils.callBeanMethod(...)"
Date Mon, 10 Feb 2003 22:23:57 GMT
Hi there,

for a non-Java  based scripting language (Rexx) I have been extending 
the functionality on the BSF 2.2 version with the intent to add that 
functionality to BSF 2.3 ASAP.

Being in the final testing stages, I have run into a problem for which I 
request some help/hints in this group of experts: while trying to invoke 
the method "hasMoreElements" (has no arguments) on an object of a class 
which implements the "Enumerator" interface I ran into the following 
exception (in "EngineUtils.callBeanMethod()"):

-------------------- cut here -----------------------
bean=[java.util.Hashtable$Enumerator@63cb94], class=[class 
java.util.Hashtable$Enumerator], iterating over methods:
        0/14: [getClass]
        1/14: [hashCode]
        2/14: [equals]
        3/14: [toString]
        4/14: [notify]
        5/14: [notifyAll]
        6/14: [wait]
        7/14: [wait]
        8/14: [wait]
        9/14: [hasMoreElements]
---
com.ibm.bsf.BSFException: method invocation failed: 
java.lang.IllegalAccessException: java/util/Hashtable$Enumerator
        at com.ibm.bsf.util.EngineUtils.callBeanMethod(EngineUtils.java:159)
        at 
com.ibm.bsf.engines.rexx.RexxAndJava.javaCallBSF(RexxAndJava.java:1339)
-------------------- cut here -----------------------

The above contains the printout of debug information showing the methods 
of the Enumeration. The method found and to be executed via 
"callBeanMethod" is "hasMoreElements".

Now, needless to say, being able to use the methods defined by 
interfaces is essential, hence I am very eager to solve this problem. If 
anyone can provide some hints/tips/insights or ideas for workarounds, I 
would *really*, *really* appreciate it a *lot*!

TIA,

---rony

P.S.:  The given line-number in EngineUtils.java should be 157, not 159. 
The reason: I am using the patched version of EngineUtils which 
therefore is able to deal with arguments of type "Character". In this 
particular case no arguments are given for the Enumerator method 
"hasMoreElements()".

P.P.S.: I am trying to enumerate all the keys of the Properties object 
received via the System class. Here's the Object Rexx code (building on 
the procedural Rexx interface):

-------------------- cut here -----------------------
/* Object Rexx (message operator is the tilde: ~) */

system=.bsf.cls~Class.JC~forName("string", "java.lang.System")  -- get 
the class object for "System", o.k.

properties = system~getProperties     -- get the System properties, o.k.
enum = properties~propertyNames       -- get an enumeration of the 
property names, o.k.

do while enum~hasMoreElements         -- loop over enumeration: BOMBS!
   key = enum~nextElement             -- get next element
   say "key:" key "value:" properties~getProperty("String", key)
end

::requires "BSF.cls"                  -- get the Object Rexx support for 
"bsf4rexx"
-------------------- cut here -----------------------




Mime
View raw message