ICEfaces
  1. ICEfaces
  2. ICE-6880

Auction Monitor runs out of colors to use for chat names

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.1-Beta, 3.0
    • Component/s: Sample Apps
    • Labels:
      None
    • Environment:
      Tomcat 7
    • Affects:
      Sample App./Tutorial

      Description

      The compat auctionMonitor demo uses a preset list of colors for usernames in the chat. Each time a user joins the chat a new color is selected for them and removed from the list. The problem is the colors are not reliably added back into the list, so eventually it becomes empty. At this point a new user will be unable to join the chat as the random color chooser will throw an exception as such:

      May 17, 2011 11:18:23 AM com.sun.faces.context.AjaxExceptionHandlerImpl log
      SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=chat:join_chat_button, Message=/auctionMonitor.xhtml @260,89 actionListener="#{UserBean.enterConversation}": java.lang.IllegalArgumentException: n must be positive
      May 17, 2011 11:18:23 AM com.sun.faces.context.AjaxExceptionHandlerImpl log
      SEVERE: /auctionMonitor.xhtml @260,89 actionListener="#{UserBean.enterConversation}": java.lang.IllegalArgumentException: n must be positive
      javax.faces.event.AbortProcessingException: /auctionMonitor.xhtml @260,89 actionListener="#{UserBean.enterConversation}": java.lang.IllegalArgumentException: n must be positive
          at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
          at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
          at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
          at javax.faces.component.UICommand.broadcast(UICommand.java:300)
          at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
          at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
          at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
          at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalArgumentException: n must be positive
          at java.util.Random.nextInt(Random.java:250)
          at com.icesoft.applications.faces.auctionMonitor.ChatState.generateColorCode(ChatState.java:161)
          at com.icesoft.applications.faces.auctionMonitor.ChatState.addUserChild(ChatState.java:93)
          at com.icesoft.applications.faces.auctionMonitor.beans.UserBean.enterConversation(UserBean.java:314)
          at sun.reflect.GeneratedMethodAccessor105827.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
          at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
          at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
          at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
          ... 25 more

        Activity

        Carlo Guglielmin created issue -
        Carlo Guglielmin made changes -
        Field Original Value New Value
        Assignee Carlo Guglielmin [ carlo.guglielmin ]
        Carlo Guglielmin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Affects [Sample App./Tutorial]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 2.1-Beta [ 10291 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Carlo Guglielmin
            Reporter:
            Carlo Guglielmin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: