0

close a page with echoEvent + doModal casues InvocationTargetException and InterruptedException

asked 2012-03-13 11:25:39 +0800

Neus gravatar image Neus
1415 14

Hi,
I have a page that calls a modal window. Before the doModal is called I execute a Events.echoEvent to do some actions after the window is shown.
After the window is loaded (and the event is executed) if I close the page with the browser X this exception is thrown:

GRAVE: 
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:108)
	at org.zkoss.bind.impl.BinderImpl.doExecute(BinderImpl.java:1612)
	at org.zkoss.bind.impl.BinderImpl.doCommand(BinderImpl.java:1365)
	at org.zkoss.bind.impl.BinderImpl.access$1400(BinderImpl.java:100)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1249)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1214)
	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2699)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2670)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2611)
	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:534)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:461)
Caused by: org.zkoss.zk.ui.UiException: java.lang.InterruptedException: Destroy desktop [Desktop z_1_v:/Pyme/IncidenciasyTareas/SeguimientoIncidencias/SeguimientoTareas.zul]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.zkoss.lang.Classes.newInstance(Classes.java:73)
	at org.zkoss.lang.Exceptions.wrap(Exceptions.java:161)
	at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:44)
	at org.zkoss.zul.Window.enterModal(Window.java:616)
	at org.zkoss.zul.Window.doModal(Window.java:545)
	at org.sts.Pyme.PantallasZul.IncidenciasyTareas.SeguimientoIncidencias.SeguimientoTareas.SeleccionaTarea(SeguimientoTareas.java:2755)
	at org.sts.Pyme.PantallasZul.IncidenciasyTareas.SeguimientoIncidencias.SeguimientoTareas.DobleClickFila(SeguimientoTareas.java:2726)
	... 16 more
Caused by: java.lang.InterruptedException: Destroy desktop [Desktop z_1_v:/Pyme/IncidenciasyTareas/SeguimientoIncidencias/SeguimientoTareas.zul]
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend0(EventProcessingThreadImpl.java:244)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend(EventProcessingThreadImpl.java:190)
	at org.zkoss.zk.ui.impl.UiEngineImpl.wait(UiEngineImpl.java:1534)
	at org.zkoss.zk.ui.Executions.wait(Executions.java:703)
	at org.zkoss.zul.Window.enterModal(Window.java:614)
	... 19 more
13-mar-2012 12:15:46 org.zkoss.bind.impl.BinderImpl$CommandEventListener onEvent:1216
GRAVE: java.lang.InterruptedException: Destroy desktop [Desktop z_1_v:/Pyme/IncidenciasyTareas/SeguimientoIncidencias/SeguimientoTareas.zul]
org.zkoss.zk.ui.UiException: java.lang.InterruptedException: Destroy desktop [Desktop z_1_v:/Pyme/IncidenciasyTareas/SeguimientoIncidencias/SeguimientoTareas.zul]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.zkoss.lang.Classes.newInstance(Classes.java:73)
	at org.zkoss.lang.Exceptions.wrap(Exceptions.java:161)
	at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:44)
	at org.zkoss.zul.Window.enterModal(Window.java:616)
	at org.zkoss.zul.Window.doModal(Window.java:545)
	at org.sts.Pyme.PantallasZul.IncidenciasyTareas.SeguimientoIncidencias.SeguimientoTareas.SeleccionaTarea(SeguimientoTareas.java:2755)
	at org.sts.Pyme.PantallasZul.IncidenciasyTareas.SeguimientoIncidencias.SeguimientoTareas.DobleClickFila(SeguimientoTareas.java:2726)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:108)
	at org.zkoss.bind.impl.BinderImpl.doExecute(BinderImpl.java:1612)
	at org.zkoss.bind.impl.BinderImpl.doCommand(BinderImpl.java:1365)
	at org.zkoss.bind.impl.BinderImpl.access$1400(BinderImpl.java:100)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1249)
	at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1214)
	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2699)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2670)
	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2611)
	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:534)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:461)
Caused by: java.lang.InterruptedException: Destroy desktop [Desktop z_1_v:/Pyme/IncidenciasyTareas/SeguimientoIncidencias/SeguimientoTareas.zul]
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend0(EventProcessingThreadImpl.java:244)
	at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.doSuspend(EventProcessingThreadImpl.java:190)
	at org.zkoss.zk.ui.impl.UiEngineImpl.wait(UiEngineImpl.java:1534)
	at org.zkoss.zk.ui.Executions.wait(Executions.java:703)
	at org.zkoss.zul.Window.enterModal(Window.java:614)
	... 19 more

This is how I open the window:
Events.echoEvent("onMostrarDatos", oWNuevaIncidencia, null);
oWNuevaIncidencia.doModal();

Any idea why is this happening?
Thank you!

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-03-13 11:34:09 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

echo event is not synchronize, and is executed in new thread, maybe the problem is that because doModal is execute in current thread. i'm not sure but maybe is that.

link publish delete flag offensive edit

answered 2012-03-13 11:38:35 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

updated 2012-03-13 11:39:56 +0800

i saw in my code and i put the event below before domodal();

  this.addEventListener("onClose", new EventListener() {
        
        @Override
        public void onEvent(Event event) throws Exception {
        closeReportWindow();
        }
        });
        //try {
        this.appendChild(report);
        
        if (modal == true) {
        try {
        this.doModal();.......

  private void closeReportWindow() {
        if (logger.isDebugEnabled()) {
            logger.debug("detach Report and close ReportWindow");
        }
        report.removeEventListener("onClose", new EventListener() {

            @Override
            public void onEvent(Event event) throws Exception {
                closeReportWindow();
            }
        });

        report.detach();
        this.onClose();

    }

link publish delete flag offensive edit

answered 2012-03-13 12:30:59 +0800

Neus gravatar image Neus
1415 14

updated 2012-03-13 12:34:23 +0800

I tried to set a postEvent instead of echoEvent but I used the echoEvent because I want to fire that event after doModal is called. And postEvent fire it before it is called.
And I can't write it after doModal because it wouldn't be called until the modal window is closed.
I don't know another way to do this...

link publish delete flag offensive edit

answered 2012-03-15 01:42:47 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

could you provide a reproducible code? it is easier for tracing this issue.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2012-03-13 11:25:39 +0800

Seen: 234 times

Last updated: Mar 15 '12

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