Exception on startup on JDK 1.4

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: Norris Boyd, Assigned: Norris Boyd)

Tracking

Details

Attachments

(2 attachments)

(Assignee)

Description

10 years ago
Created attachment 275764 [details] [diff] [review]
Proposed patch

from newsgroup:

I run into this problem today when runing Rhino on JDK 1.4 on Mac:

java.lang.NoSuchMethodError: java.lang.reflect.Method.isVarArgs()Z
at org.mozilla.javascript.jdk15.VMBridge_jdk15.isVarArgs
(VMBridge_jdk15.java:48)

It seems that VMBridge_jdk15 is used although I am on 1.4.

Looking at VMBridge's code for deciding which one to use, I saw that  
it loops through these and tries to instantiate them:

org.mozilla.javascript.VMBridge_custom
org.mozilla.javascript.jdk15.VMBridge_jdk15
org.mozilla.javascript.jdk13.VMBridge_jdk13
org.mozilla.javascript.jdk11.VMBridge_jdk11

And for some reason it seems to be able to instantiate VMBridge_jdk15  
on 1.4 and is happy.

I then looked at VMBridge_jdk15 and did not see any condition that  
should prevent it from being able to do so. Or should the missing  
isVarArgs() be enough a reason for it to not load?

Is it just me, or is this currently broken for 1.4?

Jürg 

Attaching proposed fix from Jürg from later in the same thread.
(Assignee)

Comment 1

10 years ago
Fixed:

Checking in src/org/mozilla/javascript/jdk15/VMBridge_jdk15.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/jdk15/VMBridge_jdk15.java,v  <--  VMBridge_jdk15.java
new revision: 1.1.4.1; previous revision: 1.1
done
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED

Comment 2

10 years ago
Created attachment 275780 [details] [diff] [review]
Updated patch, handling all exceptions correctly

The proposed patch works for me. But I think it should be done differently since org.mozilla.javascript.Kit.newInstanceOrNull does not handle NoSuchMethodException. I am actually not sure anymore why it works, I guess a SecurityException is thrown, which newInstanceOrNull handles.
So here a new version that throws exceptions handled by newInstanceOrNull and also uses the strategy proposed by Attila.
(Assignee)

Comment 3

10 years ago
Okay, I've redone the change based upon the latest patch. The new candidate is now at ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_6R7-candidate2.zip. Please try it out.

Checking in src/org/mozilla/javascript/jdk15/VMBridge_jdk15.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/jdk15/VMBridge_jdk15.java,v  <--  VMBridge_jdk15.java
new revision: 1.1.4.2; previous revision: 1.1.4.1
done

Comment 4

10 years ago
It appears that the old patch is still in place in CVS. This should be updated, since its result is not handled correctly by newInstanceOrNull. Is there a reason for waiting with this?
(Assignee)

Comment 5

10 years ago
Thanks for asking -- I'd committed to the branch for 1.6R7 but not to the trunk for 1.7R1. I've now checked it into the trunk:

Checking in src/org/mozilla/javascript/jdk15/VMBridge_jdk15.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/jdk15/VMBridge_jdk15.java,v  <--  VMBridge_jdk15.java
new revision: 1.5; previous revision: 1.4
done

Comment 6

10 years ago
Can you tell me which build will include this fix?
Thanks.
(Assignee)

Comment 7

10 years ago
This fix is already in 1.6R7. See http://www.mozilla.org/rhino/download.html.

Comment 8

10 years ago
I have tried 1.6R7 but seems the issue still can reproduce. I saw the same NoSuchMethodError.

I will try again

Comment 9

10 years ago
It's my mistake,it works.
Thank you.
You need to log in before you can comment on or make changes to this bug.