Problem with Calendar if the field is null

UI Components for JSF
Post Reply
aleajax
Posts: 10
Joined: 28 Feb 2010, 11:17

04 Mar 2010, 00:32

After the major problem with this component was resolved (thanks) now i see another big problem.
If the field date of calendar is null i obtain these errors:
java.lang.ArrayIndexOutOfBoundsException: 2
at org.primefaces.component.calendar.CalendarRenderer.getPageDate(CalendarRenderer.java:308)
at org.primefaces.component.calendar.CalendarRenderer.encodeScript(CalendarRenderer.java:78)
at org.primefaces.component.calendar.CalendarRenderer.encodeEnd(CalendarRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
I put everthing but probably are sufficient only the first 3 lines.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Mar 2010, 14:55

When does this error happen exactly?

aleajax
Posts: 10
Joined: 28 Feb 2010, 11:17

04 Mar 2010, 17:29

Everytime there is nothing on the field date.
I use postgresql as database.

The check that i put on my JSF:
<h:outputLabel id="data_scadenza1" value="#{libriController.selected.data_scadenza==null}"/>
as output said:
true

However,after see the error code on:
return tokens[0].trim() + "/" + tokens[2].trim();
i make same experiments.

public class CalendarRenderer extends CoreRenderer {
String getPageDate(String date, Calendar calendar) {
...

Before:

String[] tokens = selectedDate.split("/");
return tokens[0].trim() + "/" + tokens[2].trim();
After this change on the code:

if (!date.trim().equals("")) {
String[] tokens = selectedDate.split("/");
return tokens[0].trim() + "/" + tokens[2].trim();
} else
return null;
the problem seem gone away.

I think was a bug, if you could give a look at my solutions even using different database ...

For example i return null but i don't known if is most appropriate return something other things.

This was a quickly change because i want use this component ...

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Mar 2010, 17:59

It seems like a bug yes, can you please create a ticket in our issue tracker with your description or just a link to this post so we can quickly fix this and make it available for a nightly snapshot build.

aleajax
Posts: 10
Joined: 28 Feb 2010, 11:17

04 Mar 2010, 18:29

I put the ticket 574

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Mar 2010, 18:32

Great, thanks for your effort.

This will be fixed this week after replication of the issue.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

10 Mar 2010, 23:16

Can you please try with latest snapshot as I can't replicate the issue now after enhancements to calendar.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 53 guests