Results 1 to 5 of 5
  1. #1
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default TimeZone problems in win xp

    Hello every one.
    I have the task which should set the default time zone in the select form. For this aim I use SimpleTimeZone class and write simple test to check my code. It is below
    Java Code:
        
    @Test
        public void defaultTimeZone() {
            String def = SimpleTimeZone.getDefault().getID();
            boolean has = false;
            for (String id : SimpleTimeZone.getAvailableIDs()) {
                System.out.println(id);
                if (id.equals(def)) {
                    has = true;
                    break;
                }
            }
            System.out.println(has);
            Assert.assertTrue(has);
        }
    It works perfectly on win 7 and ubuntu, but falls on win xp. I know that win xp is not supported more but I still have some customers who use it.
    Thanks.
    Skype: petrarsentev
    http://TrackStudio.com

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,987
    Rep Power
    9

    Default Re: TimeZone problems in win xp

    What does it do on Windows XP? How does it fail exactly? What do you expect this code to do? What does it do instead?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default Re: TimeZone problems in win xp

    Quote Originally Posted by KevinWorkman View Post
    What does it do on Windows XP? How does it fail exactly? What do you expect this code to do? What does it do instead?
    Logically. It gets the default timezone id and it should be in array of available timezone but it does not. This behaviour replaces on win xp.
    Skype: petrarsentev
    http://TrackStudio.com

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,090
    Rep Power
    6

    Default Re: TimeZone problems in win xp

    Quote Originally Posted by Petr View Post
    it should be in array of available timezone
    I don't read anything in the API documentation that backs that up; that is your assumption, right? What I read is that the API documentation is quite vague about this "default timezone". I quote:

    "Gets the default TimeZone for this host. The source of the default TimeZone may vary with implementation."

    In any case you know that this behavior can happen, so to properly support WindowsXP systems you would have to cope with it by NOT assuming the ID of the default timezone is in the list of available timezone IDs.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: TimeZone problems in win xp

    This sounds like a Java bug. Try updating/upgrading Java to the latest available. Also try ICU4J (ICU - International Components for Unicode) - it has the same SimpleTimeZone and TimeZone methods, but in the com.ibm.icu.util package.

    This issue also appears to be related to the one described at Java and incorrect timezone on Windows XP | Daniel Ferbers Technical Tavern.

Similar Threads

  1. timezone problem in JRE 1.6.0_22
    By sponarun in forum New To Java
    Replies: 0
    Last Post: 07-06-2011, 03:02 PM
  2. Timezone issues with SG timezone on Windows 2003
    By denyr in forum New To Java
    Replies: 2
    Last Post: 06-24-2011, 10:31 AM
  3. TimeZone confusion
    By justc1 in forum Advanced Java
    Replies: 1
    Last Post: 06-22-2011, 07:31 AM
  4. Timezone in java
    By deeparanbhor in forum New To Java
    Replies: 0
    Last Post: 05-28-2009, 01:12 PM
  5. Regarding olson timezone database
    By navneet.tech2009@gmail.co in forum New To Java
    Replies: 0
    Last Post: 09-23-2008, 12:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •