[jboss-jira] [JBoss JIRA] (AS7-5774) EJB calendar timer Sunday calculation problem in certain locales
Cheng Fang (JIRA)
jira-events at lists.jboss.org
Wed Oct 17 17:16:01 EDT 2012
[ https://issues.jboss.org/browse/AS7-5774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cheng Fang updated AS7-5774:
----------------------------
Description:
My ejb class contains this timeout method:
{code:java}
@Schedule(dayOfWeek="Sun", persistent=false)
private void sunday(Timer t) {
}
{code}
When calling this timer.getNextTimeout(), it returned the Sunday after next Sunday (expecting next Sunday) when running on certain locales (it_IT, es_PE, etc). It works as expected on other locales like en_US.
I added -Duser.language=it -Duser.country=IT to JAVA_OPTS when starting standalone server to use that locale.
Seems to be a JDK bug. There could be some differences how dates are calculated in different locales, but shouldn't be that big like skip one Sunday. Today is Wed.
One workaround is "to use locale.English when instantiating GregorianCalendar in the following classes." I tried it on 7.2 with it_IT, and got the expected Sunday.
{noformat}
ejb3/src/main/java/org/jboss/as/ejb3/timerservice/schedule/CalendarBasedTimeout.java
ejb3/src/main/java/org/jboss/as/ejb3/timerservice/schedule/util/CalendarUtil.java
ejb3/src/main/java/org/jboss/as/ejb3/timerservice/task/CalendarTimerTask.java
{noformat}
was:
My ejb class contains this timeout method:
{code:java}
@Schedule(dayOfWeek="Sun", persistent=false)
private void sunday(Timer t) {
}
{code}
When calling this timer.getNextTimeout(), it returned the Sunday after next Sunday (expecting next Sunday) when running on certain locales (it_IT, es_PE, etc). It works as expected on other locales like en_US.
I added -Duser.language=it -Duser.country=IT to JAVA_OPTS when starting standalone server to use that locale.
Seems to be a JDK bug. There could be some differences how dates are calculated in different locales, but shouldn't be that big like skip one Sunday. Today is Wed.
One workaround is "to use locale.English when instantiating GregorianCalendar." I tried it on 7.2 with it_IT, and got the expected Sunday.
> EJB calendar timer Sunday calculation problem in certain locales
> ----------------------------------------------------------------
>
> Key: AS7-5774
> URL: https://issues.jboss.org/browse/AS7-5774
> Project: Application Server 7
> Issue Type: Bug
> Components: EJB
> Affects Versions: 7.1.3.Final (EAP), 7.2.0.Alpha1
> Environment: JDK 6 & 7
> Reporter: Cheng Fang
> Assignee: jaikiran pai
>
> My ejb class contains this timeout method:
> {code:java}
> @Schedule(dayOfWeek="Sun", persistent=false)
> private void sunday(Timer t) {
> }
> {code}
> When calling this timer.getNextTimeout(), it returned the Sunday after next Sunday (expecting next Sunday) when running on certain locales (it_IT, es_PE, etc). It works as expected on other locales like en_US.
> I added -Duser.language=it -Duser.country=IT to JAVA_OPTS when starting standalone server to use that locale.
> Seems to be a JDK bug. There could be some differences how dates are calculated in different locales, but shouldn't be that big like skip one Sunday. Today is Wed.
> One workaround is "to use locale.English when instantiating GregorianCalendar in the following classes." I tried it on 7.2 with it_IT, and got the expected Sunday.
> {noformat}
> ejb3/src/main/java/org/jboss/as/ejb3/timerservice/schedule/CalendarBasedTimeout.java
> ejb3/src/main/java/org/jboss/as/ejb3/timerservice/schedule/util/CalendarUtil.java
> ejb3/src/main/java/org/jboss/as/ejb3/timerservice/task/CalendarTimerTask.java
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list