You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Attila Király (JIRA)" <ji...@apache.org> on 2011/01/02 16:38:45 UTC

[jira] Created: (WICKET-3301) SimpleDateFormat-s should be created with Locale defined in constructor

SimpleDateFormat-s should be created with Locale defined in constructor
-----------------------------------------------------------------------

                 Key: WICKET-3301
                 URL: https://issues.apache.org/jira/browse/WICKET-3301
             Project: Wicket
          Issue Type: Bug
          Components: wicket, wicket-datetime
    Affects Versions: 1.5-M3
            Reporter: Attila Király


The wicket-core junit test o.a.w.util.time.TimeTest.test() fails on computers where the default locale strings for "Am/pm marker" is not am/pm. The reason for this is that wicket uses SimpleDateFormat(String pattern) constructor instead of SimpleDateFormat(String pattern, Locale locale) in a lot of places and so the system default locale is used.

I think for consistent results wicket should always specify a locale and not depend on the system default.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-3301) SimpleDateFormat-s should be created with Locale defined in constructor

Posted by "Attila Király (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Attila Király updated WICKET-3301:
----------------------------------

    Attachment: WICKET-3301.patch

Attaching patch that fixes some of the creations of SimpleDateFormat-s.

Fixed in:
o.a.w.extensions.yui.calendar.AbstractCalendar: deleted the instances. They were not used and as SimpleDateFormat is not thread safe having it in public static final variables was not good anyway.

o.a.w.util.time.AbstractTime and o.a.w.util.time.Time: these classes are using SimpleDateFormat in a static way (static variable or method) so I added Locale.ENGLISH to the constructors.

With the patch all tests pass including o.a.w.util.time.TimeTest.test().

What the patch does not fix but I think should be done (but it needs decision on the wicket team side):
o.a.w.validation.validator.DateValidator.MaximumValidator.variablesMap(IValidatable<Date>)
o.a.w.validation.validator.DateValidator.MinimumValidator.variablesMap(IValidatable<Date>)
o.a.w.validation.validator.DateValidator.RangeValidator.variablesMap(IValidatable<Date>)
o.a.w.extensions.yui.calendar.DatePicker.configure(Map<String, Object>, IHeaderResponse, Map<String, Object>)
o.a.w.devutils.inspector.LiveSessionsPage
o.a.w.devutils.inspector.RequestsPage

These are not static usages and because of this maybe they should use the client.


> SimpleDateFormat-s should be created with Locale defined in constructor
> -----------------------------------------------------------------------
>
>                 Key: WICKET-3301
>                 URL: https://issues.apache.org/jira/browse/WICKET-3301
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket, wicket-datetime
>    Affects Versions: 1.5-M3
>            Reporter: Attila Király
>         Attachments: WICKET-3301.patch
>
>
> The wicket-core junit test o.a.w.util.time.TimeTest.test() fails on computers where the default locale strings for "Am/pm marker" is not am/pm. The reason for this is that wicket uses SimpleDateFormat(String pattern) constructor instead of SimpleDateFormat(String pattern, Locale locale) in a lot of places and so the system default locale is used.
> I think for consistent results wicket should always specify a locale and not depend on the system default.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-3301) SimpleDateFormat-s should be created with Locale defined in constructor

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3301.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5-M4
         Assignee: Igor Vaynberg

> SimpleDateFormat-s should be created with Locale defined in constructor
> -----------------------------------------------------------------------
>
>                 Key: WICKET-3301
>                 URL: https://issues.apache.org/jira/browse/WICKET-3301
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket, wicket-datetime
>    Affects Versions: 1.5-M3
>            Reporter: Attila Király
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-M4
>
>         Attachments: WICKET-3301.patch
>
>
> The wicket-core junit test o.a.w.util.time.TimeTest.test() fails on computers where the default locale strings for "Am/pm marker" is not am/pm. The reason for this is that wicket uses SimpleDateFormat(String pattern) constructor instead of SimpleDateFormat(String pattern, Locale locale) in a lot of places and so the system default locale is used.
> I think for consistent results wicket should always specify a locale and not depend on the system default.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WICKET-3301) SimpleDateFormat-s should be created with Locale defined in constructor

Posted by "Attila Király (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12976529#action_12976529 ] 

Attila Király edited comment on WICKET-3301 at 1/2/11 10:52 AM:
----------------------------------------------------------------

Attaching patch that fixes some of the creations of SimpleDateFormat-s.

Fixed in:
o.a.w.extensions.yui.calendar.AbstractCalendar: deleted the instances. They were not used and as SimpleDateFormat is not thread safe having it in public static final variables was not good anyway.

o.a.w.util.time.AbstractTime and o.a.w.util.time.Time: these classes are using SimpleDateFormat in a static way (static variable or method) so I added Locale.ENGLISH to the constructors.

With the patch all tests pass including o.a.w.util.time.TimeTest.test().

What the patch does not fix but I think should be done (but it needs decision on the wicket team side):
o.a.w.validation.validator.DateValidator.MaximumValidator.variablesMap(IValidatable<Date>)
o.a.w.validation.validator.DateValidator.MinimumValidator.variablesMap(IValidatable<Date>)
o.a.w.validation.validator.DateValidator.RangeValidator.variablesMap(IValidatable<Date>)
o.a.w.extensions.yui.calendar.DatePicker.configure(Map<String, Object>, IHeaderResponse, Map<String, Object>)
o.a.w.devutils.inspector.LiveSessionsPage
o.a.w.devutils.inspector.RequestsPage

These are not static usages and because of this maybe they should use the client locale.


      was (Author: akiraly):
    Attaching patch that fixes some of the creations of SimpleDateFormat-s.

Fixed in:
o.a.w.extensions.yui.calendar.AbstractCalendar: deleted the instances. They were not used and as SimpleDateFormat is not thread safe having it in public static final variables was not good anyway.

o.a.w.util.time.AbstractTime and o.a.w.util.time.Time: these classes are using SimpleDateFormat in a static way (static variable or method) so I added Locale.ENGLISH to the constructors.

With the patch all tests pass including o.a.w.util.time.TimeTest.test().

What the patch does not fix but I think should be done (but it needs decision on the wicket team side):
o.a.w.validation.validator.DateValidator.MaximumValidator.variablesMap(IValidatable<Date>)
o.a.w.validation.validator.DateValidator.MinimumValidator.variablesMap(IValidatable<Date>)
o.a.w.validation.validator.DateValidator.RangeValidator.variablesMap(IValidatable<Date>)
o.a.w.extensions.yui.calendar.DatePicker.configure(Map<String, Object>, IHeaderResponse, Map<String, Object>)
o.a.w.devutils.inspector.LiveSessionsPage
o.a.w.devutils.inspector.RequestsPage

These are not static usages and because of this maybe they should use the client.

  
> SimpleDateFormat-s should be created with Locale defined in constructor
> -----------------------------------------------------------------------
>
>                 Key: WICKET-3301
>                 URL: https://issues.apache.org/jira/browse/WICKET-3301
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket, wicket-datetime
>    Affects Versions: 1.5-M3
>            Reporter: Attila Király
>         Attachments: WICKET-3301.patch
>
>
> The wicket-core junit test o.a.w.util.time.TimeTest.test() fails on computers where the default locale strings for "Am/pm marker" is not am/pm. The reason for this is that wicket uses SimpleDateFormat(String pattern) constructor instead of SimpleDateFormat(String pattern, Locale locale) in a lot of places and so the system default locale is used.
> I think for consistent results wicket should always specify a locale and not depend on the system default.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.