0

ClientInfoEvent ClassCastException: java.lang.Double cannot be cast to java.lang.Integer

asked 2015-03-16 12:19:20 +0800

khkim gravatar image khkim
18 2

Hi

ZK version : ZK EE 7.0.2

We have been getting this exception frequently. I am wondering if anyone else seen this and any idea on how to fix it?

Thanks!

Stack trace: 13-Mar-15 07:50:09.027 [http-apr-8443-exec-7] ERROR [j:] org.zkoss.zk.ui.impl.UiEngineImpl: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer at org.zkoss.zk.ui.event.ClientInfoEvent.getInt(ClientInfoEvent.java:60) at org.zkoss.zk.ui.event.ClientInfoEvent.getClientInfoEvent(ClientInfoEvent.java:54) at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:720) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1249) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2462) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2451) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)

delete flag offensive retag edit

Comments

can you put the complete stacktrace of your logging?

chillworld ( 2015-03-16 12:22:58 +0800 )edit

6 Answers

Sort by ยป oldest newest most voted
1

answered 2015-03-31 03:58:10 +0800

vincentjian gravatar image vincentjian
2245 6

updated 2015-03-31 04:02:50 +0800

This may happen when browser zooms in/out in mobile device and then the screen width/height become double value. You can override the javascript to parse the value to integer before sending the client info event.

<script defer="true"><![CDATA[
var _portrait = {'0': true, '180': true}, //default portrait definition
    _initLandscape = jq.innerWidth() > jq.innerHeight(), // initial orientation is landscape or not
    _initDefault = _portrait[window.orientation]; //default orientation

zAu.cmd0.clientInfo = function(dtid) {
    zAu._cInfoReg = true;
    var orient = '',
        dpr = 1;

    if (zk.mobile) {
        //change default portrait definition because landscape is the default orientation for this device/browser.
        if ((_initLandscape && _initDefault) || (!_initLandscape && !_initDefault))
            _portrait = {'-90': true, '90': true};

        orient = _portrait[window.orientation] ? 'portrait' : 'landscape';
    } else {
        orient = jq.innerWidth() > jq.innerHeight() ? 'landscape' : 'portrait';
    }

    if (window.devicePixelRatio)
        dpr = window.devicePixelRatio;

    zAu.send(new zk.Event(zk.Desktop.$(dtid), 'onClientInfo', 
        [new Date().getTimezoneOffset(),
        zk.parseInt(screen.width), zk.parseInt(screen.height), screen.colorDepth,
        zk.parseInt(jq.innerWidth()), zk.parseInt(jq.innerHeight()), zk.parseInt(jq.innerX()), zk.parseInt(jq.innerY()), dpr.toFixed(1), orient],
        {implicit:true, rtags: {onClientInfo: 1}}));
}
]]></script>
link publish delete flag offensive edit

Comments

It is working for me.

hswain ( 2016-09-30 09:54:54 +0800 )edit
1

answered 2015-03-27 05:52:24 +0800

echarish gravatar image echarish flag of Japan
1809 7
http://jp.linkedin.com/in...

I am guessing that you might be passing an integer value to the double component in your code, such kind of issue occurs when we use dobulebox on zul but the property that we set is actually interger.

link publish delete flag offensive edit
0

answered 2015-03-22 14:05:53 +0800

Darksu gravatar image Darksu
1991 1 4

Hello khkim,

Could you install the latest version of zk in order to see if the problem still exists?

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2015-03-30 17:00:14 +0800

khkim gravatar image khkim
18 2

Our QA has not reproduced any more on this issue since last week. It is weird that happened a couple of weeks ago. Thanks for your replay!

link publish delete flag offensive edit
0

answered 2016-10-03 01:16:33 +0800

MDuchemin gravatar image MDuchemin
1441 1 5
ZK Team

Hi Khkim,

Have a look here: http://tracker.zkoss.org/browse/ZK-2633

this is most likely the same issue. Fixed in 8.0.3

link publish delete flag offensive edit
0

answered 2017-08-23 15:02:31 +0800

AnVT gravatar image AnVT
1

@vincentjian

This saved my team

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
3 followers

RSS

Stats

Asked: 2015-03-16 12:19:20 +0800

Seen: 73 times

Last updated: Aug 23 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More