CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 Cannot format given Object as a Date

Print topic Send  topic

Author Message
stefka

Posts: 2
Posted: 10/18/2006, 3:44 AM

Hi,

I made a web application with jsp/mysql using CCS 3.0.4.12

One of the data fiels is a Date. The default db date pattern is yyyy-MM-dd HH:mm:ss
I'm using dd/MM/yyyy in order to present/edit my dates.

At my _maint.jsp page everything works fine.

At my _list.jsp, when I search using the Date, I take this error (see below).

After some debugging I found that the problem occurs at the com.codecharge.db.RawCommand, at line 449

value = format.format( value );

I printed out the "value" before this line and it was correct with the right format.
Moreover, I did many tries with different formats, but I always take the same error.

Any idea?

Thanks,
Stefka

java.lang.IllegalArgumentException: Cannot format given Object as a Date
java.text.DateFormat.format(Unknown Source)
java.text.Format.format(Unknown Source)
com.codecharge.db.RawCommand.prepareCommand(RawCommand.java:449)
com.codecharge.db.RawCommand.count(RawCommand.java:229)
com.codecharge.GridProcessor.select(GridProcessor.java:238)
com.codecharge.GridProcessor.process(GridProcessor.java:65)
com.codecharge.PageProcessor.process(PageProcessor.java:28)
com.codecharge.PageController.process(PageController.java:166)
org.apache.jsp.packages_005flist_jsp._jspService(packages_005flist_jsp.java:386)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
View profile  Send private message
LH_13

Posts: 30
Posted: 10/18/2006, 5:31 AM

Here

value = format.format( value );

value is an object.
It can heppen if value before formatting is not Date.
This value, primordially, takes from parameter.

1. Perhaps you chage this parameter in one of events... I.E. BeforeBuild<SomeCommand> or BeforeExecute<SomeCommand>. And it become String or somthis other, but not Date.

2. Or may by this parameter takes from DB as string (if you use Varchar or somthig else different from TimeDate) and not parsing....

I advice you determine class of Object value and place of his last modification.
_________________
Sorry my english!
View profile  Send private message
stefka

Posts: 2
Posted: 10/18/2006, 7:53 AM

Hi LH_13,

I printed out the value before this format() function and it was correct (with the correct format).

I dont have anything on BeforeExecute or BeforeBuild event and the parameter comes from the URL, not the DB because this is the value I want to search, not to edit.

Besides, I can insert/edit the field at tha _maint.jsp page without any problem. I'm using the same format and the Date is stored into the db without any problem. I also can see the stored date values.

The strange is that the format() function expects an Object whereas the value is an param.getObjectValue() ->String

Thanks,
Stefka
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.