Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3214

Desktop cleanup cleans current execution even if not related

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.0.3
    • 8.0.2
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.0.3 S4

      In SimpleDesktopCache [line: 117] - SimpleDesktopCache (called when cleaning a Desktop). the current ExecutionCtrl is set to null, which causes the current Execution to also be set to null.
      This happens event if the desktop to clean is not the desktop in which the Execution happens.

      Reproduce with:

      <zk>
      	<div apply="local.support.Wfsfaa.support3273.IndividualInvalidateSessionComposer">
      		<label id="lbl"/>
      		<listbox id="lb"/>
      		<button id="btn"/>
      	</div>
      </zk>
      
      public class IndividualInvalidateSessionComposer extends SelectorComposer {
      
      	private static final String SESSION_LIST = "SessionList";
      	@Wire
      	private Listbox lb;
      	@Wire
      	private Label lbl;
      
      	private ListModelList<HttpSession> mySessionLmL;
      	
      	private List<HttpSession> getAllSessions(){
      		return (List<HttpSession>) WebApps.getCurrent().getAttribute(SESSION_LIST);
      	}
      
      	private HttpSession getCurrentSession(){
      		return (HttpSession) Sessions.getCurrent().getNativeSession();
      	}
      	
      	@Override
      	public void doAfterCompose(Component comp) throws Exception {
      		super.doAfterCompose(comp);
      		if(getAllSessions()==null){
      			WebApps.getCurrent().setAttribute(SESSION_LIST,new ArrayList<HttpSession>());
      		}
      		if(!getAllSessions().contains(getCurrentSession())){
      			getAllSessions().add(getCurrentSession());
      		}
      		lb.setItemRenderer(new ListitemRenderer<HttpSession>() {
      			public void render(Listitem arg0, HttpSession arg1, int arg2) throws Exception {
      				String sessionId = arg1.getId();
      				Listcell cell = new Listcell(sessionId);
      				arg0.appendChild(cell);
      			}
      		});
      		mySessionLmL = new ListModelList<HttpSession>(getAllSessions());
      		lb.setModel(mySessionLmL);
      		lbl.setValue("current Id : "+getCurrentSession().getId());
      	}
      	
      	@Listen("onClick=#btn")
      	public void handleClick(){
      		final HttpSession selectedHttpSession = mySessionLmL.getSelection().iterator().next();
      		if(selectedHttpSession!=null){
      					selectedHttpSession.invalidate();
      			getAllSessions().remove(selectedHttpSession);
      		}
      		System.out.println(Executions.getCurrent());
      	}
      }
      

            SEFI SEFI
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: