netplex/json-smart-v2

TestDateConvert failures with UTC timezone

ebourg opened this issue · 2 comments

Hi,

I noticed that TestDateConvert has failures if the local timezone is set to UTC. The tests work fine with a timezone set to Europe/Paris.

Running net.minidev.asm.TestDateConvert
can not parse:lundi 23 janvier 2012 13 h 42 UTC - DateFormat.0
java.lang.NumberFormatException: For input string: "UTC"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:580)
        at java.lang.Integer.parseInt(Integer.java:615)
        at net.minidev.asm.ConvertDate.addHour(ConvertDate.java:264)
        at net.minidev.asm.ConvertDate.getDDMMYYYY(ConvertDate.java:229)
        at net.minidev.asm.ConvertDate.convertToDate(ConvertDate.java:139)
        at net.minidev.asm.TestDateConvert.fullTestDate(TestDateConvert.java:75)
        at net.minidev.asm.TestDateConvert.testDateLocalized(TestDateConvert.java:62)
        at net.minidev.asm.TestDateConvert.testDateFRANCE(TestDateConvert.java:43)

can not parse:Montag, 23. Januar 2012 13:42 Uhr UTC - DateFormat.0
java.lang.NumberFormatException: For input string: "UTC"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:580)
        at java.lang.Integer.parseInt(Integer.java:615)
        at net.minidev.asm.ConvertDate.addHour(ConvertDate.java:264)
        at net.minidev.asm.ConvertDate.getDDMMYYYY(ConvertDate.java:229)
        at net.minidev.asm.ConvertDate.convertToDate(ConvertDate.java:139)
        at net.minidev.asm.TestDateConvert.fullTestDate(TestDateConvert.java:75)
        at net.minidev.asm.TestDateConvert.testDateLocalized(TestDateConvert.java:62)
        at net.minidev.asm.TestDateConvert.testDateGERMANY(TestDateConvert.java:51)

testDateCANADA(net.minidev.asm.TestDateConvert)  Time elapsed: 0.007 sec  <<< FAILURE!
junit.framework.ComparisonFailure: expected:<23/01/2012 [13]:42:59> but was:<23/01/2012 [01]:42:59>
        at net.minidev.asm.TestDateConvert.fullTestDate(TestDateConvert.java:83)
        at net.minidev.asm.TestDateConvert.testDateLocalized(TestDateConvert.java:62)
        at net.minidev.asm.TestDateConvert.testDateCANADA(TestDateConvert.java:47)

fixed.

after a new update. All java time zone are properly supported.