diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TTimeZone.java b/classlib/src/main/java/org/teavm/classlib/java/util/TTimeZone.java index 0200eac3a..ca8eff4db 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TTimeZone.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TTimeZone.java @@ -152,8 +152,10 @@ public abstract class TTimeZone implements Serializable, Cloneable { */ public static TTimeZone getDefault() { if (defaultTz == null) { - defaultTz = new TIANATimeZone(DateTimeZoneProvider.detectTimezone()); - if (defaultTz == null) { + DateTimeZone innerTz = DateTimeZoneProvider.detectTimezone(); + if (innerTz != null) { + defaultTz = new TIANATimeZone(innerTz); + } else { defaultTz = TTimeZone.getTimeZone("UTC"); } } diff --git a/classlib/src/main/resources/org/teavm/classlib/impl/unicode/cldr-json.zip b/classlib/src/main/resources/org/teavm/classlib/impl/unicode/cldr-json.zip index 9e71b079c..3849d182f 100644 Binary files a/classlib/src/main/resources/org/teavm/classlib/impl/unicode/cldr-json.zip and b/classlib/src/main/resources/org/teavm/classlib/impl/unicode/cldr-json.zip differ diff --git a/tests/src/test/java/org/teavm/classlib/java/text/NumberFormatTest.java b/tests/src/test/java/org/teavm/classlib/java/text/NumberFormatTest.java index fa4120e3b..297010ecd 100644 --- a/tests/src/test/java/org/teavm/classlib/java/text/NumberFormatTest.java +++ b/tests/src/test/java/org/teavm/classlib/java/text/NumberFormatTest.java @@ -24,6 +24,7 @@ public class NumberFormatTest { } @Test + @SkipJVM public void formatsCurrency() { NumberFormat format = NumberFormat.getCurrencyInstance(new Locale("en", "US")); format.setCurrency(Currency.getInstance("RUB")); @@ -31,7 +32,7 @@ public class NumberFormatTest { format = NumberFormat.getCurrencyInstance(new Locale("ru", "RU")); format.setCurrency(Currency.getInstance("RUB")); - assertEquals("123 456,79 руб.", format.format(123456.789123).replace('\u00A0', ' ')); + assertEquals("123 456,79 \u20BD", format.format(123456.789123).replace('\u00A0', ' ')); } @Test diff --git a/tests/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java b/tests/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java index 3ae6d8191..56e5d9a06 100644 --- a/tests/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java +++ b/tests/src/test/java/org/teavm/classlib/java/text/SimpleDateFormatTest.java @@ -21,6 +21,7 @@ import java.text.SimpleDateFormat; import java.util.*; import org.junit.Test; import org.junit.runner.RunWith; +import org.teavm.junit.SkipJVM; import org.teavm.junit.TeaVMTestRunner; @RunWith(TeaVMTestRunner.class) @@ -30,8 +31,9 @@ public class SimpleDateFormatTest { } @Test + @SkipJVM public void firstDayOfWeekMatches() { - assertEquals(Calendar.SUNDAY, new GregorianCalendar(Locale.ENGLISH).getFirstDayOfWeek()); + assertEquals(Calendar.MONDAY, new GregorianCalendar(Locale.ENGLISH).getFirstDayOfWeek()); assertEquals(1, new GregorianCalendar(Locale.ENGLISH).getMinimalDaysInFirstWeek()); } @@ -62,22 +64,26 @@ public class SimpleDateFormatTest { } @Test + @SkipJVM public void weekInYearHandled() throws ParseException { long day = 24 * 3600 * 1000; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss www", Locale.ENGLISH); assertEquals("2014-06-24 09:33:49 026", format.format(getDateWithZoneOffset(1403602429504L))); assertEquals("2014-06-28 09:33:49 026", format.format(getDateWithZoneOffset(1403602429504L + day * 4))); - assertEquals("2014-06-29 09:33:49 027", format.format(getDateWithZoneOffset(1403602429504L + day * 5))); + assertEquals("2014-06-29 09:33:49 026", format.format(getDateWithZoneOffset(1403602429504L + day * 5))); + assertEquals("2014-06-30 09:33:49 027", format.format(getDateWithZoneOffset(1403602429504L + day * 6))); assertEquals(1403602429000L, getTimeWithoutZoneOffset(format.parse("2014-06-24 09:33:49 026"))); assertEquals(1403602429000L + day * 4, getTimeWithoutZoneOffset(format.parse("2014-06-28 09:33:49 026"))); - assertEquals(1403602429000L + day * 5, getTimeWithoutZoneOffset(format.parse("2014-06-29 09:33:49 027"))); + assertEquals(1403602429000L + day * 5, getTimeWithoutZoneOffset(format.parse("2014-06-29 09:33:49 026"))); + assertEquals(1403602429000L + day * 6, getTimeWithoutZoneOffset(format.parse("2014-06-30 09:33:49 027"))); } @Test + @SkipJVM public void weekInMonthHandled() throws ParseException { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss WW", Locale.ENGLISH); - assertEquals("2014-06-24 09:33:49 04", format.format(getDateWithZoneOffset(1403602429504L))); - assertEquals(1403602429000L, getTimeWithoutZoneOffset(format.parse("2014-06-24 09:33:49 04"))); + assertEquals("2014-06-24 09:33:49 05", format.format(getDateWithZoneOffset(1403602429504L))); + assertEquals(1403602429000L, getTimeWithoutZoneOffset(format.parse("2014-06-24 09:33:49 05"))); } @Test diff --git a/tests/src/test/java/org/teavm/classlib/java/util/CurrencyTest.java b/tests/src/test/java/org/teavm/classlib/java/util/CurrencyTest.java index 17223a7f2..027d00923 100644 --- a/tests/src/test/java/org/teavm/classlib/java/util/CurrencyTest.java +++ b/tests/src/test/java/org/teavm/classlib/java/util/CurrencyTest.java @@ -78,7 +78,7 @@ public class CurrencyTest { currency = Currency.getInstance("RUB"); assertEquals("RUB", currency.getSymbol(english)); - assertEquals("руб.", currency.getSymbol(russian)); + assertEquals("\u20BD", currency.getSymbol(russian)); } @Test(expected = IllegalArgumentException.class)