0

Listbox bug between 6.0.0 and 6.5.2

asked 2013-07-03 01:13:13 +0800

dsised gravatar image dsised
1 1

Hi,

My zk application is working well with ZK 6.0.0.

 <zk.version>6.0.0</zk.version>

When I change my pom.xml to put 6.5.2

<zk.version>6.5.2</zk.version>

Application is working well except with Listbox : when I change an element, I got an Exception :

juil. 03, 2013 10:20:36 AM org.zkoss.zk.ui.impl.UiEngineImpl handleError:1359

SEVERE: >>java.lang.IndexOutOfBoundsException: Index: 13, Size: 0

at org.zkoss.zk.ui.AbstractComponent$ChildIter.<init>(AbstractComponent.java:2848) at org.zkoss.zk.ui.AbstractComponent$ChildIter.<init>(AbstractComponent.java:2840) at org.zkoss.zk.ui.AbstractComponent$Children.listIterator(AbstractComponent.java:185) at java.util.AbstractSequentialList.get(AbstractSequentialList.java:88) at org.zkoss.zul.Combobox.getItemAtIndex(Combobox.java:614) at org.zkoss.zkplus.databind.ComboitemCollectionItem.getComponentAtIndexByOwner(ComboitemCollectionItem.java:56) at org.zkoss.zkplus.databind.DataBinder.getCollectionItems(DataBinder.java:810) at org.zkoss.zkplus.databind.DataBinder.access$200(DataBinder.java:66) at org.zkoss.zkplus.databind.DataBinder$LoadOnSaveEventListener.loadAllBindings(DataBinder.java:1557) at org.zkoss.zkplus.databind.DataBinder$LoadOnSaveEventListener.myLoadAllNodes(DataBinder.java:1481) at org.zkoss.zkplus.databind.DataBinder$LoadOnSaveEventListener.myLoadAllNodes(DataBinder.java:1511) at org.zkoss.zkplus.databind.DataBinder$LoadOnSaveEventListener.loadAllNodes(DataBinder.java:1439) at org.zkoss.zkplus.databind.DataBinder$LoadOnSaveEventListener.doLoad(DataBinder.java:1428) at org.zkoss.zkplus.databind.DataBinder$LoadOnSaveEventListener.onEvent(DataBinder.java:1405) at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2742) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2713) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1717) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1502) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1212) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:600) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:482) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:150) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724)

delete flag offensive retag edit

Comments

I dont think its zk issue, may be somewhere in your code some logic is missing

sjoshi ( 2013-07-03 06:30:24 +0800 )edit

3 Answers

Sort by » oldest newest most voted
0

answered 2013-07-15 06:00:16 +0800

dsised gravatar image dsised
1 1

I think an uppdate was done to binder.loadComponent

I Include a zul file like this

<include id="includeSaisieActivite" src="/_missions/SaisieActivite.zul"/>

Here is the SaisieActivite.zul :

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<?meta http-equiv="X-UA-Compatible" content="chrome=1"?>
<zk>
    <window id="zoneSaisieActivite" mode="modal" position="center"
        visible="@{gestionMissions.actionActivite.enCours}" width="400px"
        title="@{gestionMissions.actionActivite}">

        <grid>
            <columns>
                <column label="" />
                <column label="" />
            </columns>
            <rows>
                <row>
                    <label value="Activite"></label>
                    <combobox mold="rounded" 
                        id="saisiComboActivites"
                        model="@{gestionMissions.listeActivite}"
                        selectedItem="@{gestionMissions.missionActiviteCourant.theActivite, save-when='validerMissionActivite.onClick'}"
                        readonly="true" 
                        disabled="@{gestionMissions.actionActivite.suppression}"
                        constraint="no empty">

                        <comboitem self="@{each=activite}"
                            label="@{activite.nom}" />

                    </combobox>

                </row>
                <row>
                    <label value="Principale" />
                    <checkbox
                        checked="@{gestionMissions.missionActiviteCourant.principale, save-when='validerMissionActivite.onClick'}"
                        value="Principale" disabled="@{gestionMissions.actionActivite.suppression}" />
                </row>

            </rows>
        </grid>



        <div align="center">
            <button id="validerMissionActivite" label="Valider" />
            <button id="annulerMissionActivite" label="Annuler" />
        </div>
    </window>
</zk>

As you can see, I use "@{gestionMissions.actionActivite.enCours}" to set the include visible.

In my model I have this code :

@Listen("onClick = #includeSaisieActivite #zoneSaisieActivite #validerMissionActivite")
public void onClick$validerMissionActivite() {
    setActionActivite(Action.AUCUNE);
    binder.loadComponent(zoneSaisieActivite);
}

So,

  • I change my Actionactivite to "Action.Aucune
  • I ask to zoneSaisieActivite to be reloaded by the binder

The error message is coming with the call of

binder.loadComponent(zoneSaisieActivite);

It's working very fine with ZK 6.0.0 but it crashes with ZK 6.5.2. I think a change has been done to ZK element. Something like "The window become unvisible so some list are not loaded : in my case, the combobox is empty...

To give you more information :

  • if I change for testing like this (I don't use the binder) I have no error :

    @Listen("onClick = #includeSaisieActivite #zoneSaisieActivite #validerMissionActivite") public void onClick$validerMissionActivite() { setActionActivite(Action.AUCUNE); //binder.loadComponent(zoneSaisieActivite); zoneSaisieActivite.setVisible(false); }

  • if I change for testing like this (I don't use the binder) it crashes:

    @Listen("onClick = #includeSaisieActivite #zoneSaisieActivite #validerMissionActivite") public void onClick$validerMissionActivite() { binder.loadComponent(zoneSaisieActivite); }

So, What mmust I do to let binder.loadComponent(zoneSaisieActivite) working ?

Thank you

link publish delete flag offensive edit
0

answered 2013-07-16 00:03:40 +0800

dsised gravatar image dsised
1 1

I done an other test:

If I remove "save-when" in my combobox, The error doesn't appear but I have a bad visual effect on my application (the value is visually changed while I have no clicked on my validate button).

Do you have enougth information to reprocuce the error ?

Thank you.

PS: I'll try to do a little sample ZUL with the error

link publish delete flag offensive edit
0

answered 2013-07-16 03:58:03 +0800

dsised gravatar image dsised
1 1

Here is a working sample to reproduce the bug: Select one line in the list box; Change the language in the combo box and then click OK

As is : - it's working fine with ZK 6.0.0 - it bugs with ZK 6.5.2

If you remove "save-when" in the combo box, there is no bug but the functionality is not good because it has changes my value ils the list box while I have no clicked on OK button.

TestModel.java :

/**
 * 
 */
package nc.mairie.temp;

import java.util.ArrayList;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zkplus.databind.AnnotateDataBinder;
import org.zkoss.zul.Div;


/**
 * @author boulu72
 *
 */
public class TestModel extends SelectorComposer<Component> {

    /**
     * 
     */
    private static final long serialVersionUID = -8608406922690897596L;

    AnnotateDataBinder binder;

    ArrayList<Word> listWord;

    public ArrayList<Word> getListWord() {
        return listWord;
    }

    ArrayList <Lang> listLang = new ArrayList<>();

    public ArrayList<Lang> getListLang () {
        return listLang;
    }


    public class Lang {
        String name;
        String language;

        Lang(String name, String language) {
            this.name = name;
            this.language = language;
        }

        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getLanguage() {
            return language;
        }
        public void setLanguage(String language) {
            this.language = language;
        }

    }


    Word currentWord;

    public class Word {
        String word;
        Lang lang;

        Word(String word, Lang lang) {
            this.word = word;
            this.lang = lang;
        }

        public String getWord() {
            return word;
        }

        public void setWord(String word) {
            this.word = word;
        }

        public Lang getLang() {
            return lang;
        }

        public void setLang(Lang lang) {
            this.lang=lang;
        }

        public String getFullName () {
            return getWord() + " "+ getLang().getLanguage();
        }


    }

    boolean visible = false;

    public Word getCurrentWord(){
        return currentWord;
    }

    public void setCurrentWord(Word word){
        this.currentWord= word;
    }

    public boolean isVisible() {
        return visible;
    }


    @Wire
    Div detailWord;

    @Override
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);

        Lang l1 = new Lang("eng","ENGLISH");
        Lang l2 = new Lang("fr","FRANCAIS");

        listLang.add(l1);
        listLang.add(l2);

        Word p1 = new Word("Hello", listLang.get(0));
        Word p2 = new Word("Coucou", listLang.get(1));

        listWord = new ArrayList<Word>();
        listWord.add(p1);
        listWord.add(p2);

        comp.setAttribute(comp.getId(), this, true);

        binder = new AnnotateDataBinder(comp);
        binder.loadAll();

    }

    @Listen("onClick = #listBoxWord;")
    public void onClick$listBoxWord() {
        visible = true;
        binder.loadComponent(detailWord);
    }

    @Listen("onClick = #btnOk;")
    public void onClick$btnOk() {
        visible = false;
        binder.loadComponent(detailWord);
    }

}

Test.zul:

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<?meta http-equiv="X-UA-Compatible" content="chrome=1"?>
<zk>

    <window id="test" apply="nc.mairie.temp.TestModel">


        <div id="windowListWord">
            <listbox id="listBoxWord" model="@{test.listWord}"
                selectedItem="@{test.currentWord}" width="500px">
                <listhead>
                    <listheader label="word" />
                    <listheader label="lang" />
                    <listheader label="fullName" />
                </listhead>
                <listitem self="@{each=word}">
                    <listcell label="@{word.word}" />
                    <listcell label="@{word.lang.language}" />
                    <listcell label="@{word.fullName}" />
                </listitem>
            </listbox>
        </div>

    <div id="detailWord"  visible="@{test.visible}">
        <grid width="400px">
            <rows>
                <row>
                    First Name:
                    <textbox id="firstName"
                        value="@{test.currentWord.word}" />
                </row>

                <row>
                    Lang:
                        <combobox mold="rounded" 
                        model="@{test.listLang}"
                        selectedItem="@{test.currentWord.lang, save-when='btnOk.onClick'}">
                        <comboitem self="@{each=lang}"
                            label="@{lang.language}" />
                        </combobox>


                </row>
                <row>

                    Full Name:
                    <label id="fullName"
                        value="@{test.currentWord.fullName}" />
                </row>
                <row>
                <button id="btnOk" label="Ok" />
                </row>
            </rows>
        </grid>
    </div>

    </window>
</zk>
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
1 follower

RSS

Stats

Asked: 2013-07-03 01:13:13 +0800

Seen: 18 times

Last updated: Jul 16 '13

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