classcast exception at org.mozilla.javascript.Interpreter.interpret when using click event of button in httpunit

RESOLVED INVALID

Status

Rhino
Core
RESOLVED INVALID
14 years ago
13 years ago

People

(Reporter: Rahul Bhardwaj, Assigned: Igor Bukanov)

Tracking

Details

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
Build Identifier: 

     [java] java.lang.ClassCastException
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2581)
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2173)
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2173)
     [java]     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFu
nction.java:58)
     [java]     at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.performEvent(JavaScript.java:162)
     [java]     at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(S
criptableDelegate.java:55)
     [java]     at com.meterware.httpunit.WebResponse$Scriptable.load(WebRespons
e.java:612)
     [java]     at com.meterware.httpunit.javascript.JavaScript$Window.initializ
e(JavaScript.java:424)
     [java]     at com.meterware.httpunit.javascript.JavaScript.run(JavaScript.j
ava:80)
     [java]     at com.meterware.httpunit.javascript.JavaScriptEngineFactory.ass
ociate(JavaScriptEngineFactory.java:46)
     [java]     at com.meterware.httpunit.RequestContext.runScripts(RequestConte
xt.java:44)
     [java]     at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:1
19)
     [java]     at com.meterware.httpunit.WebResponse$Scriptable.setLocation(Web
Response.java:689)
     [java]     at com.meterware.httpunit.javascript.JavaScript$Window.setLocati
on(JavaScript.java:407)
     [java]     at com.meterware.httpunit.javascript.JavaScript$Window.jsSet_loc
ation(JavaScript.java:402)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:324)
     [java]     at org.mozilla.javascript.ScriptableObject.setBySetter(Scriptabl
eObject.java:294)
     [java]     at org.mozilla.javascript.ScriptableObject.put(ScriptableObject.
java:256)
     [java]     at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.put(JavaScript.java:263)
     [java]     at org.mozilla.javascript.ScriptableObject.putProperty(Scriptabl
eObject.java:1476)
     [java]     at org.mozilla.javascript.ScriptRuntime.setName(ScriptRuntime.ja
va:1130)
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2017)
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2173)
     [java]     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFu
nction.java:58)
     [java]     at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.performEvent(JavaScript.java:162)
     [java]     at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(S
criptableDelegate.java:55)
     [java]     at com.meterware.httpunit.Button.doOnClickEvent(Button.java:85)
     [java]     at com.meterware.httpunit.Button.click(Button.java:68)
     [java]     at Example.main(Example.java:43)
     [java] java.lang.RuntimeException: Event 'chkCtrCookie();' failed: java.lan
g.ClassCastException
     [java]     at org.mozilla.javascript.WrappedException.<init>(WrappedExcepti
on.java:56)
     [java]     at org.mozilla.javascript.WrappedException.wrapException(Wrapped
Exception.java:111)
     [java]     at org.mozilla.javascript.ScriptableObject.setBySetter(Scriptabl
eObject.java:296)
     [java]     at org.mozilla.javascript.ScriptableObject.put(ScriptableObject.
java:256)
     [java]     at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.put(JavaScript.java:263)
     [java]     at org.mozilla.javascript.ScriptableObject.putProperty(Scriptabl
eObject.java:1476)
     [java]     at org.mozilla.javascript.ScriptRuntime.setName(ScriptRuntime.ja
va:1130)
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2017)
     [java]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java
:2173)
     [java]     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFu
nction.java:58)
     [java]     at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.performEvent(JavaScript.java:162)
     [java]     at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(S
criptableDelegate.java:55)
     [java]     at com.meterware.httpunit.Button.doOnClickEvent(Button.java:85)
     [java]     at com.meterware.httpunit.Button.click(Button.java:68)
     [java]     at Example.main(Example.java:43)
     [java] Exception: java.lang.RuntimeException: Event 'redir();' failed: java
.lang.RuntimeException: Event 'chkCtrCookie();' failed: java.lang.ClassCastExcep
tion

Reproducible: Always
Steps to Reproduce:
1.create a web request from the app URL
2.get the web response
3.enter user id and password to the login page
4.Click Submit
5.get the response that the login is successful
6.click on ok button on the confirmation page and error occurs

Actual Results:  
I am using HTTPUNIT to do functional testing for my application . Everything 
works fine but as I simulate the clicking of the button on the confirmation 
page , i get a class cast exception naming one of our Java Script functions as 
failed.But it works absolutely fine when we manually login to a browser window 

Expected Results:  
It shouldn't have given any class cast exception
(Assignee)

Comment 1

14 years ago
What was the version of js.jar that was used with HTTPUnit?

Also could you try Rhino from CVS or at least RC1 for Rhino 1.6?
(Reporter)

Comment 2

14 years ago
(In reply to comment #1)
> What was the version of js.jar that was used with HTTPUnit?
> Also could you try Rhino from CVS or at least RC1 for Rhino 1.6?
I am using the current httpunit-1.5.4 from 
http://httpunit.sourceforge.net/index.html

(Assignee)

Comment 3

14 years ago
(In reply to comment #2)
> (In reply to comment #1)
> > What was the version of js.jar that was used with HTTPUnit?
> > Also could you try Rhino from CVS or at least RC1 for Rhino 1.6?
> I am using the current httpunit-1.5.4 from 
> http://httpunit.sourceforge.net/index.html
> 

But which version of js.jar it uses? HTTPUnit is just one of Rhino users and I
have no idea which version of js.jar they include.

> 

(Reporter)

Comment 4

14 years ago
(In reply to comment #3)
--------------------------------------------------------------------------------
I tried using the js.jar present in rhino1_6R1pre_2004-09-23.
I got the following error:
     [java] java.lang.NoClassDefFoundError: org/mozilla/javascript/NotAFunctionE
xception
     [java]     at java.lang.Class.getDeclaredMethods0(Native Method)
     [java]     at java.lang.Class.privateGetDeclaredMethods(Class.java:1627)
     [java]     at java.lang.Class.getDeclaredMethods(Class.java:1114)
     [java]     at org.mozilla.javascript.FunctionObject.getMethodList(FunctionO
bject.java:304)
     [java]     at org.mozilla.javascript.ScriptableObject.defineClass(Scriptabl
eObject.java:763)
     [java]     at org.mozilla.javascript.ScriptableObject.defineClass(Scriptabl
eObject.java:732)
     [java]     at com.meterware.httpunit.javascript.JavaScript.initHTMLObjects(
JavaScript.java:86)
     [java]     at com.meterware.httpunit.javascript.JavaScript.run(JavaScript.j
ava:77)
     [java]     at com.meterware.httpunit.javascript.JavaScriptEngineFactory.ass
ociate(JavaScriptEngineFactory.java:46)
     [java]     at com.meterware.httpunit.FrameHolder.<init>(FrameHolder.java:44
)
     [java]     at com.meterware.httpunit.WebWindow.<init>(WebWindow.java:218)
     [java]     at com.meterware.httpunit.WebClient.<init>(WebClient.java:50)
     [java]     at com.meterware.httpunit.WebConversation.<init>(WebConversation
.java:46)
     [java]     at Example.main(Example.java:11)
     [java] Exception in thread "main"
     [java] Java Result: 1
-------------------------------------------------------------------------------
> (In reply to comment #2)
> > (In reply to comment #1)
> > > What was the version of js.jar that was used with HTTPUnit?
> > > Also could you try Rhino from CVS or at least RC1 for Rhino 1.6?
> > I am using the current httpunit-1.5.4 from 
> > http://httpunit.sourceforge.net/index.html
> > 
> But which version of js.jar it uses? HTTPUnit is just one of Rhino users and I
> have no idea which version of js.jar they include.
> > 

(Assignee)

Comment 5

13 years ago
I close this as invalid but feel free to reopen this if the bug is in rhino 1.6R1
(Assignee)

Comment 6

13 years ago
I close this as invalid but feel free to reopen this if the bug is in rhino 1.6R1
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.