Debugging in browser and fixing bck2brwsr was: generated JS issue in Chrome, but not built-in browser

7 views
Skip to first unread message

Jaroslav Tulach

unread,
May 19, 2016, 12:28:59 AM5/19/16
to dukes...@googlegroups.com, erd, bck2...@apidesign.org
### erd : 18. 5. 2016 @ 15:01 ###
> I fixed the 404's by making the classpath prefix just '/'.
>
> After some sleuthing, I figured out the TypeError is caused by Jackson, but
> I'm still unsure of how to fix it. More specifically, invoking ObjectMapper
> breaks everything, eg
>
> static private ObjectMapper mapper = new ObjectMapper();

If you right click on "client-web" project and do "Clean" and then once again
and select "Debug", you'll be able to see reasonable code in the browser.

I used chromium with "Pause on Exceptions" being true and this is the
stacktrace:

invoker.clone__Ljava_lang_Object_2 (emul-0.19-rt.js:256614)
c.getDefault__Ljava_util_TimeZone_2 (emul-0.19-rt.js:102513)
c.initializeCalendar__VLjava_util_Locale_2 (emul-0.19-rt.js:56142)
CLS.cons__VLjava_lang_String_2Ljava_util_Locale_2 (emul-0.19-rt.js:55950)
c.class__V (jackson-databin…2.6.3.js:44848)
com_fasterxml_jackson_databind_util_StdDateFormat (jackson-databin…
2.6.3.js:44885)
c.class__V (jackson-databin…2.6.3.js:43935)
com_fasterxml_jackson_databind_ObjectMapper (jackson-databin…2.6.3.js:43962)
loadClass (bck2brwsr.js:163)
(anonymous function) (dukescript-plot…SNAPSHOT.js:21)
c.class__V (dukescript-plot…PSHOT.js:17248)
net_java_html_plotlyjs_Plotly (dukescript-plot…PSHOT.js:17275)
loadClass (bck2brwsr.js:163)
(anonymous function) (PlotlySample-1.…SNAPSHOT.js:33)
c.onPageLoad__V (PlotlySample-1.…NAPSHOT.js:868)
c.onPageLoad__V (PlotlySample-1.…APSHOT.js:2184)
c.main__V_3Ljava_lang_String_2 (mainclass.js:67)
invokeMethod (bck2brwsr.js:47)
extensionLoaded (bck2brwsr.js:33)

Looks like java.util.TimeZone.getDefault() isn't implemented properly in
bck2brwsr. Do you want to help me fix it? If so, the code is here:
http://source.apidesign.org/hg/bck2brwsr/file/9d46ae9d4a2e/rt/emul/compact/src/main/java/java/util/TimeZone.java#l615
Probably the best way to start is to copy one of the tests at
http://source.apidesign.org/hg/bck2brwsr/file/9d46ae9d4a2e/rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck
and show that there is a difference between TimeZone.getDefault() on HotSpot
and on bck2brwsr VM. And then fix it.

-jt

PS: I tried to use "Custom->Run in Browser via TeaVM", but TeaVM is out of
lack as jackson uses quite a lot of reflection and it cannot handle it.





Jaroslav Tulach

unread,
May 20, 2016, 12:09:02 AM5/20/16
to erd, dukes...@googlegroups.com, bck2...@apidesign.org
Here is the fix of TimeZone.getDefault() to return something:
http://source.apidesign.org/hg/bck2brwsr/rev/4b7ef2a05eb7
-jt

### Jaroslav Tulach : 19. 5. 2016 @ 06:28 ###
Reply all
Reply to author
Forward
0 new messages