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

Getting IllegalStateException: can only add one element

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.2
    • 8.5.1.2
    • None
      • Java 1.8
      • ZK 8.5.1.2 EE
      • Hibernate 4.2.1
      • Spring 3.2.8.RELEASE
    • ZK 8.5.2 S2
    • None

      Hi everybody,

      I'm getting an exception when I attempt to save a Date field
      using the component datebox with conditional binding:

      <datebox value="@load(vm.startDate) @save(vm.startDate, before='save')" />

      Debugging the code, when it's comparing a java.sql.Timestamp object and a java.util.Date object then it throws the Exception.

      ----------

      Jun 05, 2018 5:44:04 PM org.zkoss.zk.ui.impl.UiEngineImpl handleError
      SEVERE:
      java.lang.IllegalStateException: can only add one element
      at org.zkoss.zkmax.bind.impl.SingleObjectSet.add(SingleObjectSet.java:43)
      at org.zkoss.zkmax.bind.impl.AllocUtilEx.addLinkedHashSet(AnnotateBinderEx.java:131)
      at org.zkoss.zkmax.bind.impl.TrackerImplEx.addBeanMap(TrackerImplEx.java:126)
      at org.zkoss.bind.tracker.impl.TrackerImpl.tieValue(TrackerImpl.java:343)
      at org.zkoss.bind.xel.zel.BindELResolver.tieValue(BindELResolver.java:285)
      at org.zkoss.zkmax.bind.impl.BindELResolverEx.tieValue(BindELResolverEx.java:143)
      at org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:154)
      at org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:188)
      at org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
      at org.zkoss.zkmax.bind.impl.ValueExpressionImplEx.getValue(ValueExpressionImplEx.java:52)
      at org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:41)
      at org.zkoss.zkmax.bind.impl.BindEvaluatorXImplEx$LazyBindXelExpression.evaluate(BindEvaluatorXImplEx.java:124)
      at org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:46)
      at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
      at org.zkoss.bind.impl.BinderImpl.doPropertyChange0(BinderImpl.java:460)
      at org.zkoss.bind.impl.BinderImpl.doPropertyChange(BinderImpl.java:435)
      at org.zkoss.bind.impl.BinderImpl.access$300(BinderImpl.java:132)
      at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:394)
      at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:168)
      at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3168)
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3138)
      at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3080)
      at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
      at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1846)
      at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1618)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1321)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:487)
      at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:495)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      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.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
      at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      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:154)
      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:199)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
      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:106)
      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:343)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      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:219)
      at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:110)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:748)

      ----------

      Hibernate Domain Model:

      @Temporal(TemporalType.TIMESTAMP)
      @Column(name = "startDate", length = 19, nullable = false)
      public Date getStartDate()

      { return this.startDate; }

      public void setStartDate(Date startDt)

      { this.startDate= startDate; }

      ----------

            CharlesQiu CharlesQiu
            sarco sarco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 4 hours Remaining Estimate - 4 hours
                4h
                Logged:
                Time Spent - 4 hours Remaining Estimate - 4 hours
                4h