Jump to content
Changes to the Jaspersoft community edition download ×

DateTime DataType InputControl - problem or bug


steve.whitson

Recommended Posts

Hi,

 

I have experienced some trouble with a Text field being populated with a Date/Time DataType input control. I am converting the passed in parameter (text date/time string) to a Timestamp in a sibling parameter with the following formula in the Default Value Expression.

 

Code:

new java.sql.Timestamp(((new SimpleDateFormat("EEE MMM dd HH:mm:«»ss zzz yyyy"«»)).parse($P{From})).getTime())

 

 

The Date/Time DataType InputControl fields/parameters (prompted for) are 'From' and 'To'. The fromTimestamp parameter is produced using this formula. The same thing occurs with the toTimestamp parameter. These fromTimestamp and toTimestamp parameters are not prompted for.

 

When I log the queries, the log shows that the date/time is correct most of the time. Once in a while the time changes to be -6 hours (the time zone offset for here).

 

I just reproduced the problem. Here's from the log:

 

First try:

09:04:34,201 DEBUG JRJdbcQueryExecuter,http-8080-Processor24:206 - Parameter #1 (toTimestamp of type java.sql.Timestamp): 2008-01-07 00:00:00.0

09:04:34,203 DEBUG JRJdbcQueryExecuter,http-8080-Processor24:206 - Parameter #2 (fromTimestamp of type java.sql.Timestamp): 2007-12-31 00:00:00.0

 

Second try:

09:04:50,118 DEBUG JRJdbcQueryExecuter,http-8080-Processor25:206 - Parameter #1 (toTimestamp of type java.sql.Timestamp): 2008-01-06 18:00:00.0

09:04:50,119 DEBUG JRJdbcQueryExecuter,http-8080-Processor25:206 - Parameter #2 (fromTimestamp of type java.sql.Timestamp): 2007-12-30 18:00:00.0

 

I didn't change my input parameters (passed into 'From' and 'To'). This was done using the JasperServer interface (v2.1.0). I did nothing more than press the 'Report Options' button, and re-submit the same info.

 

12 successive submissions following this did not reproduce the problem. Then on the next submission, there it was again.

 

Is there a bug? Am I don't something wrong?

 

Thanks much,

-Steve

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Do you have any JasperServer data source (not necessarily used by the report that you are currently executing) that specifies a timezone? If so, could you examine the logs to see whether there is a correlation between the occurrence of the issue and one or several specific threads (the thread is the http-8080-ProcessorXY part of the log message)?

 

Regards,

Lucian

Link to comment
Share on other sites

I have two data sources. One is for a mysql database, and the other for db2 (db2 is what this report uses). Neither db system sets any timezone, the default timezone of the OS is used in both cases (local timezone, CST6DST). I'm not sure if this answers your question. I have not done anything special with regard to specifying a timezone with either of these two JDBC datasource configurations in jasperserver.

 

Thanks much,

-Steve

Link to comment
Share on other sites

We've recently fixed a bug that was occurring when data source timezones were used. However, if you haven't specified any timezone for the data sources, it cannot be the same issue.

 

I'm afraid I couldn't tell what else could cause such a behaviuor without reproducing it.

 

Regards,

Lucian

Link to comment
Share on other sites

I've been unable to reproduce the problem since my linux box rebooted yesterday. Also couldn't reproduce it on the target user's system today. Odd how easily it reproduced before the reboot.

 

Just for noting, the system it occurred on:

java se 1.5.0_08

tomcat 5.5.20

jasperserver 2.1.0

centos 4.6, kernel 2.6.9-55

 

If/when I reproduce the problem I'll file a ticket.

 

Thanks again for your help!

-Steve

Post edited by: steve.whitson, at: 2008/02/07 18:39

Link to comment
Share on other sites

The problem has re-occurred. Now, I am able to reproduce the problem fairly easily. First I restart tomcat, then run the report that uses Date/Time, and the time is fine. Next, I run a copy of the report which takes Date inputs instead of Date/Time... and that's when the problem will definitely occur. Now, I run the first report again, and problem is still present there too.

 

I did file this as a bug.

 

Odd set of circumstances. Thanks much for you help,

-Steve

Link to comment
Share on other sites

  • 1 year later...

I'm having a similar problem that may be related to the default time zone issue.  It seems to be tied to JasperServer evaluating input date parameters "according to the default time zone" as it says in the user manual.

My master report sets a default date in mm-dd-yyyy format which is passed through to several subreports.  This runs fine in the iReports environment.  However, when I run it from JasperServer and echo the parameters in the subreport, the date parameter in the subreports has been reduced by one day.

It looks like I can kludge around this by: 

1) Change my date parameter from java.util.date to java.sql.Timestamp and

2) Set the time portion of the Timestamp to 23:59.

What I would prefer would be some way to see and set the default time zone within JasperServer, or within the schedule setup.

Link to comment
Share on other sites

Further info:

By displaying my date parameter in master and subreports, I established the date parm was being set back by 6 hours. I'm at CST, so that gives me a clue what time zone the JasperServer is set to. So now I preset the time portion of my date/time parm to "06:00:00" and it winds up at the desired "00:00:00." Still a kludge, but functional.

Link to comment
Share on other sites

  • 4 weeks later...

lenonpat
Wrote:

My master report sets a default date in mm-dd-yyyy format which is passed through to several subreports.  This runs fine in the iReports environment.  However, when I run it from JasperServer and echo the parameters in the subreport, the date parameter in the subreports has been reduced by one day.

Did you reset the datasource timezone in JasperServer?  If so, do you have a simple test case to reproduce this?

Regards,

Lucian

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...