You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2015/10/16 15:04:05 UTC

[jira] [Commented] (WICKET-6003) ClientProperties.getTimeZone() is not correctly calculated from client's time zone offset

    [ https://issues.apache.org/jira/browse/WICKET-6003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14960641#comment-14960641 ] 

Sven Meier commented on WICKET-6003:
------------------------------------

The javadoc is wrong, getUtcOffset() returns the offset in hours.

> In my case, it returns "120"

Strange. Please take a look at wicket-browser-info.js - here the offset is divided by 60.



> ClientProperties.getTimeZone() is not correctly calculated from client's time zone offset
> -----------------------------------------------------------------------------------------
>
>                 Key: WICKET-6003
>                 URL: https://issues.apache.org/jira/browse/WICKET-6003
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.5.0
>         Environment: Java 8, Tomcat 8
>            Reporter: Josef Bodnár
>            Priority: Minor
>
> Hello, my first issue here, so I apologize for any false alarms.
> In org.apache.wicket.protocol.http.ClientProperties.getTimeZone() a timeZone is calculated from getUtcOffset() method.
> The getUtcOffset() method in javadoc specifies, that the returned offset is in minutes. In my case, it returns "120" which corresponds to 2hrs shift from UTC (CET).
> The getTimeZone() then calculates the timeZone in two ways, based on the offset containing a dot.
> The "else" branch applies in my case since the offset does not contains a dot.
> There the timeZone is calculated on this line:
> timeZone = TimeZone.getTimeZone("GMT" + ((offset > 0) ? "+" : "-") + utc);
> In my case it creates: "GMT+120".
> Which creates a following timeZone object:
> sun.util.calendar.ZoneInfo[id="GMT+01:20",offset=4800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
> This is obviously wrong, since it should be GMT+2:00, offset=7200000.
> I think the code in both cases of the "if" block does not correspond to the contract of getUtcOffset().
> I checked later versions of wicket for fix, but did not find any change in versions 6.20 and 7.
> Is this observation correct?
> Thank you for a great framework.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)