#48 ✓resolved
Thatcher

Ajax in setTimeout throws error

Reported by Thatcher | February 17th, 2009 @ 07:30 AM | in 1.0 Release

This is an interesting and slightly difficult problem becuase what is apparently happening in the threaded environment is that


for(var prop in foo)

will iterate over properties of the Java Object. Even though the object is created in the script context as a simple object {bar:"abc"}; This happens when we call $.ajax({}) because the jquery ajax method calls $.extend wich iterates over the property and throws

js: Java class "[B" has no public instance field or method named "nodeType".

Exception in thread "Thread-8" org.mozilla.javascript.EvaluatorException: Java class "[B" has no public instance field or m
        at org.mozilla.javascript.tools.ToolErrorReporter.runtimeError(ToolErrorReporter.java:144)
        at org.mozilla.javascript.Context.reportRuntimeError(Context.java:922)
        at org.mozilla.javascript.Context.reportRuntimeError(Context.java:978)
        at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:948)
        at org.mozilla.javascript.NativeJavaArray.get(NativeJavaArray.java:103)
        at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1601)
        at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1398)
        at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1384)
        at org.mozilla.javascript.gen.c3._c63(Unknown Source)
        at org.mozilla.javascript.gen.c3.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
        at org.mozilla.javascript.gen.c3._c63(Unknown Source)
        at org.mozilla.javascript.gen.c3.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
        at org.mozilla.javascript.gen.c3._c230(Unknown Source)
        at org.mozilla.javascript.gen.c3.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c10._c2(Unknown Source)
        at org.mozilla.javascript.gen.c10.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
        at org.mozilla.javascript.gen.c2._c868(Unknown Source)
        at org.mozilla.javascript.gen.c2.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
        at org.mozilla.javascript.gen.c2._c9(Unknown Source)
        at org.mozilla.javascript.gen.c2.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
        at org.mozilla.javascript.gen.c2.call(Unknown Source)
        at org.mozilla.javascript.Context$1.run(Context.java:488)
        at org.mozilla.javascript.Context.call(Context.java:499)
        at org.mozilla.javascript.Context.call(Context.java:486)
        at org.mozilla.javascript.JavaAdapter.callMethod(JavaAdapter.java:548)
        at adapter1.run()
        at java.lang.Thread.run(Unknown Source)
js: Java class "[B" has no public instance field or method named "nodeType".

make: *** [runtest] Error 3

thatcher@Flare /opt/apache-tomcat-6.0.16/webapps/env-js

Another interesting thing is that if you call


print(foo);

on the object before the iteration of properties it acts like a normal javascript object.

This is a major blocker in several areas, not just jquery.

Comments and changes to this ticket

  • Thatcher

    Thatcher February 17th, 2009 @ 07:31 AM

    ps to reproduce, just set isLocal to false in envjs/bin/jquery-1.2.6-test.js so that ajax is evaluated.

  • Thatcher

    Thatcher September 9th, 2009 @ 04:37 PM

    • Milestone set to 1.0 Release
    • State changed from “new” to “resolved”
    • Assigned user set to “Thatcher”

    this was corrected by making sure all strings are created with +'' in platform/rhino.js where java is being used directly.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket

Pages