Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 891169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:50:54+00:00 2026-05-15T13:50:54+00:00

Here’s a very simple example of what I see: jrunscript -f – js> var

  • 0

Here’s a very simple example of what I see:

jrunscript -f -
js> var d = new java.util.Date();
js> var m = d.getClass().getMethods();
js> println(m[0].getClass().getName());
java.lang.reflect.Method
js> var name = m[0].getName();
script error: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.UnsupportedOperationException: invocation not supported (<STDIN>#1) in <STDIN> at line number 1
js> var time = d.getTime();
js> println(time);
1278421741768
js> 

The variable “d” is a Java “Date” instance, and “m” is the array of Java “Method” objects for the “Date” class. When I try to call getName() on one of the “Method” instances, however, it doesn’t work. Note that calling getTime() on the “Date” instance works fine, as do pretty much all other calls to Java objects. (Well, I haven’t run an exhaustive exploration of course, but it generally works and that’s why “Method” seems weird.)

If I write (on the Java side) a class that basically wraps “Method” and delegates, that works fine. So it’s not like there’s some intrinsic barrier between the Javascript domain and the stuff that “Method” supplies. (Indeed, I imagine that the script layer itself has to do reflection to provide the basic facility in the first place.)

I recall having encountered and hacked around this problem the last time I was fooling around with Rhino via the JDK 6 script framework. I don’t recall whether I figured out why it happens or not. Does anybody know?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:50:54+00:00Added an answer on May 15, 2026 at 1:50 pm

    IIRC, it’s because a number of methods use the immediate caller for certain security checks. If you use Method.invoke to call these methods, then the caller of invoke is taken as the immediate caller. These methods are listed in section 6 of the current Java Secure Coding Guidelines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found this example on StackOverflow: var people = new List<Person> { new
Here's a coding problem for those that like this kind of thing. Let's see
Here is a link my example of the misaligned table rows Click preview in
Here's an excerpt from java.text.CharacterIterator documentation: This interface defines a protocol for bidirectional iteration
Here is an example table: ID time data type 0 0100 xyz 0 1
Here a simple question : What do you think of code which use try
Here's what I'm trying to do... It's quite simple and obviously there must be
Here is my question. I am having this simple menu. <div id=menu> <ul> <li>
Here's my simple first attempt at a python extension using boost. Can someone help
Here's a simple, 45 line console application that reproduces the bug on my Win

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.