cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <agalla...@agssa.net>
Subject [JXTemplate] - null Date Object throw java.lang.IllegalArgumentException
Date Tue, 03 Feb 2004 06:18:20 GMT
Hi:

I am trying to show some Dates fields retrieved from a DB. This fields can
be NULL (a user still does not fill the field). I wrote the following code
to present the field:

<td><jx:formatDate value="${item.pac_fecha_ini}" pattern="MMM/yyyy"/></td>

The problem is when the @value is null, then it throws the below
exception. I clearly understand the cause of the Exception.

But is this OK? Need I check the values before using the <jx:formatDate>?
or we can change the <jx:formatDate> to check for null and return a empty
String in case it does not exist?

WDYT?

Best Regards,

Antonio Gallardo

Original Exception: java.lang.IllegalArgumentException: Cannot format
given Object as a Date
at java.text.DateFormat.format(DateFormat.java:279)
at java.text.Format.format(Format.java:133)
at
org.apache.cocoon.generation.JXTemplateGenerator$StartFormatDate.format(JXTemplateGenerator.java:2176)
at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:3600)
at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:3346)
at
org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTemplateGenerator.java:2922)
at
org.apache.cocoon.generation.JXTemplateGenerator.generate(JXTemplateGenerator.java:2913)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:558)
at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:196)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:502)
at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:155)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:165)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:107)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:162)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:107)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:136)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:371)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor.handleCocoonRedirect(TreeProcessor.java:416)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor.access$000(TreeProcessor.java:101)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor$TreeProcessorRedirector.cocoonRedirect(TreeProcessor.java:577)
at
org.apache.cocoon.environment.ForwardRedirector.redirect(ForwardRedirector.java:93)
at
org.apache.cocoon.components.flow.AbstractInterpreter.forwardTo(AbstractInterpreter.java:275)
at
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.forwardTo(FOM_JavaScriptInterpreter.java:823)
at
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.forwardTo(FOM_Cocoon.java:1514)
at
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_sendPage(FOM_Cocoon.java:306)
at inv6.invoke()





Mime
View raw message