click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parth Joshi (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLK-374) Class java.lang.ClassCastException on a Select List with OptionGroup
Date Tue, 31 Jul 2012 08:36:36 GMT

    [ https://issues.apache.org/jira/browse/CLK-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425616#comment-13425616
] 

Parth Joshi commented on CLK-374:
---------------------------------

I am still getting the error in 2.3 release 


                
> Class java.lang.ClassCastException on a Select List with OptionGroup
> --------------------------------------------------------------------
>
>                 Key: CLK-374
>                 URL: https://issues.apache.org/jira/browse/CLK-374
>             Project: Click
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.4.1
>         Environment: Linux Apache mySQL Java
>            Reporter: Christophe FOIRET
>            Assignee: Bob Schellink
>             Fix For: 1.5 M3
>
>
> Hi, 
> This error appears when i use in a form a Select List with Option Group 
> It appears not at the first time, but at the second time
> Exception 
> Class java.lang.ClassCastException 
> Message net.sf.click.control.OptionGroup 
> 731:                  if (getValue().length() == 0) {
> 732:                      setErrorMessage("select-error");
> 733:  
> 734:                  } else {
> 735:                      if (getOptionList().isEmpty()) {
> 736:                          String msg = "Mandatory Select field " + getName()
> 737:                          + " has no options to validate the request against";
> 738:                          throw new RuntimeException(msg);
> 739:                      }
> 740:  
> 741:                      Option firstOption = (Option) getOptionList().get(0);
> 742:  
> 743:                      if (firstOption.getValue().equals(getValue())) {
> 744:                          setErrorMessage("select-error");
> 745:                      }
> 746:                  }
> 747:              }
> 748:          }
> 749:      }
> 750:  
> 751:      // ------------------------------------------------------ Protected Methods
>  
> java.lang.ClassCastException: net.sf.click.control.OptionGroup
> 	at net.sf.click.control.Select.validate(Select.java:741)
> 	at net.sf.click.control.Field.onProcess(Field.java:853)
> 	at net.sf.click.control.FieldSet.onProcess(FieldSet.java:536)
> 	at net.sf.click.control.Form.onProcess(Form.java:1718)
> 	at net.sf.click.ClickServlet.processPage(ClickServlet.java:555)
> 	at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:356)
> 	at net.sf.click.ClickServlet.doPost(ClickServlet.java:306)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
> 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
> 	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
> 	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
> 	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
> 	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> 	at java.lang.Thread.run(Unknown Source)
> Here is my source code :
> List localOptions = new ArrayList();
> Select localSelect        = new Select("local.numLocal","Lieu de travail");
> List<Local> listCollege = new LocalDAO().findByCommuneAndType(communeSelect.getValue(),"Collège");
> List<Local> listSSD  = new LocalDAO().findByCommuneAndType(communeSelect.getValue(),"SSD");
> List<Local> listPMI  = new LocalDAO().findByCommuneAndType(communeSelect.getValue(),"PMI");
> List<Local> listCDDS = new LocalDAO().findByCommuneAndType(communeSelect.getValue(),"CDDS");
> List<Local> listCGVO = new LocalDAO().findByCommuneAndType(communeSelect.getValue(),"CGVO");
>             if (!listCollege.isEmpty()) {
>             	OptionGroup college = new OptionGroup("Collège");
>             	for (Iterator iter = listCollege.iterator(); iter.hasNext();) {
>             		Local element = (Local) iter.next();
>             		college.add(new Option(element.getNumLocal(),element.getLibLocal()));
>             	}
>             	localOptions.add(college);
>             }
>             if (!listSSD.isEmpty()) {
>             	OptionGroup ssd = new OptionGroup("SSD");
>             	for (Iterator iter = listSSD.iterator(); iter.hasNext();) {
>             		Local element = (Local) iter.next();
>             		ssd.add(new Option(element.getNumLocal(),element.getLibLocal()));
>             	}
>             	localOptions.add(ssd);
>             }
>             if (!listPMI.isEmpty()) {
>             	OptionGroup pmi = new OptionGroup("PMI");
>             	for (Iterator iter = listPMI.iterator(); iter.hasNext();) {
>             		Local element = (Local) iter.next();
>             		pmi.add(new Option(element.getNumLocal(),element.getLibLocal()));
>             	}
>             	localOptions.add(pmi);
>             }
>             if (!listCDDS.isEmpty()) {
>             	OptionGroup cdds = new OptionGroup("CDDS");
>             	for (Iterator iter = listCDDS.iterator(); iter.hasNext();) {
>             		Local element = (Local) iter.next();
>             		cdds.add(new Option(element.getNumLocal(),element.getLibLocal()));
>             	}
>             	localOptions.add(cdds);
>             }
>             if (!listCGVO.isEmpty()) {
>                 OptionGroup cgvo = new OptionGroup("CGVO");
>                 for (Iterator iter = listCGVO.iterator(); iter.hasNext();) {
>     				Local element = (Local) iter.next();
>     	            cgvo.add(new Option(element.getNumLocal(),element.getLibLocal()));
>     			}
>                 localOptions.add(cgvo);
>             }
>             localSelect.setOptionList(localOptions);
>     		localSelect.setRequired(true);
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message