Merge changes from topic "reiwa_o_cts" into oreo-cts-dev
am: b90a406ee3
Change-Id: Ifbdc49ecd23236f54aadb80701e48c13536166b9
diff --git a/libart/src/main/java/java/lang/AndroidHardcodedSystemProperties.java b/libart/src/main/java/java/lang/AndroidHardcodedSystemProperties.java
index 5a84c8e..87c3096 100644
--- a/libart/src/main/java/java/lang/AndroidHardcodedSystemProperties.java
+++ b/libart/src/main/java/java/lang/AndroidHardcodedSystemProperties.java
@@ -87,7 +87,7 @@
// Hardcode MessagePattern apostrophe mode to be default. b/27265238
{ "android.icu.text.MessagePattern.ApostropheMode", null },
- // Hardcode "sun.io.useCanonCaches" to use the default (on). b/28174137
+ // Hardcode "sun.io.useCanonCaches" to use the default (off). b/28174137, b/62301183
{ "sun.io.useCanonCaches", null },
{ "sun.io.useCanonPrefixCache", null },
@@ -111,4 +111,3 @@
{ "java.util.logging.manager", null },
};
}
-
diff --git a/luni/src/test/java/libcore/io/OsTest.java b/luni/src/test/java/libcore/io/OsTest.java
index caa8b26..f4d7ddb 100644
--- a/luni/src/test/java/libcore/io/OsTest.java
+++ b/luni/src/test/java/libcore/io/OsTest.java
@@ -629,16 +629,14 @@
}
// ENOTSUP, Extended attributes are not supported by the filesystem, or are disabled.
- // Since kernel version 4.9 (or some other version after 4.4), *xattr() methods
- // may set errno to EACCESS instead. This behavior change is likely related to
- // https://patchwork.kernel.org/patch/9294421/ which reimplemented getxattr, setxattr,
- // and removexattr on top of generic handlers.
+ final boolean root = (Libcore.os.getuid() == 0);
final String path = "/proc/self/stat";
try {
Libcore.os.setxattr(path, NAME_TEST, VALUE_CAKE, OsConstants.XATTR_CREATE);
fail();
} catch (ErrnoException e) {
- assertTrue("Unexpected errno: " + e.errno, e.errno == ENOTSUP || e.errno == EACCES);
+ // setxattr(2) requires root permission for writing to this file, will get EACCES otherwise.
+ assertEquals(root ? ENOTSUP : EACCES, e.errno);
}
try {
Libcore.os.getxattr(path, NAME_TEST);
@@ -656,7 +654,7 @@
Libcore.os.removexattr(path, NAME_TEST);
fail();
} catch (ErrnoException e) {
- assertTrue("Unexpected errno: " + e.errno, e.errno == ENOTSUP || e.errno == EACCES);
+ assertEquals(ENOTSUP, e.errno);
}
}
diff --git a/luni/src/test/java/libcore/java/io/FileTest.java b/luni/src/test/java/libcore/java/io/FileTest.java
index 9226e02..3705f2b 100644
--- a/luni/src/test/java/libcore/java/io/FileTest.java
+++ b/luni/src/test/java/libcore/java/io/FileTest.java
@@ -393,4 +393,25 @@
fail();
} catch (InvalidPathException expected) {}
}
+
+ // http://b/62301183
+ public void test_canonicalCachesAreOff() throws Exception {
+ File tempDir = createTemporaryDirectory();
+ File f1 = new File(tempDir, "testCannonCachesOff1");
+ f1.createNewFile();
+ File f2 = new File(tempDir, "testCannonCachesOff2");
+ f2.createNewFile();
+ File symlinkFile = new File(tempDir, "symlink");
+
+ // Create a symlink from symlink to f1 and populate canonical path cache
+ assertEquals(0, Runtime.getRuntime().exec("ln -s " + f1.getAbsolutePath() + " " + symlinkFile.getAbsolutePath()).waitFor());
+ assertEquals(symlinkFile.getCanonicalPath(), f1.getCanonicalPath());
+
+ // Remove it and replace it with a symlink to f2 (using java File/Files would flush caches).
+ assertEquals(0, Runtime.getRuntime().exec("rm " + symlinkFile.getAbsolutePath()).waitFor());
+ assertEquals(0, Runtime.getRuntime().exec("ln -s " + f2.getAbsolutePath() + " " + symlinkFile.getAbsolutePath()).waitFor());
+
+ // Did we cache canonical path results? hope not!
+ assertEquals(symlinkFile.getCanonicalPath(), f2.getCanonicalPath());
+ }
}
diff --git a/luni/src/test/java/libcore/java/net/URLTest.java b/luni/src/test/java/libcore/java/net/URLTest.java
index 231e09c..58bd8cc 100644
--- a/luni/src/test/java/libcore/java/net/URLTest.java
+++ b/luni/src/test/java/libcore/java/net/URLTest.java
@@ -409,6 +409,26 @@
assertEquals("http://host/a/c", url.toString()); // RI doesn't canonicalize
}
+ public void testPathContainsBackslash() throws Exception {
+ URL url = new URL("http://host\\path@foo");
+ assertEquals("\\path@foo", url.getPath());
+ assertEquals("host", url.getHost());
+ }
+
+ public void testQueryContainsForwardSlash() throws Exception {
+ URL url = new URL("http://host?query/foo");
+ assertEquals("", url.getPath());
+ assertEquals("host", url.getHost());
+ assertEquals("query/foo", url.getQuery());
+ }
+
+ public void testFragmentContainsForwardSlash() throws Exception {
+ URL url = new URL("http://host#fragment/foo");
+ assertEquals("", url.getPath());
+ assertEquals("host", url.getHost());
+ assertEquals("fragment/foo", url.getRef());
+ }
+
public void testRelativePathAndFragment() throws Exception {
URL base = new URL("http://host/file");
assertEquals("http://host/another#fragment", new URL(base, "another#fragment").toString());
diff --git a/luni/src/test/java/libcore/java/time/chrono/JapaneseChronologyTest.java b/luni/src/test/java/libcore/java/time/chrono/JapaneseChronologyTest.java
index 1f36b2c..3c1f0cf 100644
--- a/luni/src/test/java/libcore/java/time/chrono/JapaneseChronologyTest.java
+++ b/luni/src/test/java/libcore/java/time/chrono/JapaneseChronologyTest.java
@@ -16,8 +16,6 @@
package libcore.java.time.chrono;
import org.junit.Test;
-import android.icu.util.JapaneseCalendar;
-import java.util.List;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
@@ -25,7 +23,6 @@
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.chrono.ChronoZonedDateTime;
-import java.time.chrono.Era;
import java.time.chrono.JapaneseChronology;
import java.time.chrono.JapaneseDate;
import java.time.chrono.JapaneseEra;
@@ -113,14 +110,4 @@
assertEquals(true, date.isSupported(ChronoField.YEAR));
assertEquals(true, date.isSupported(ChronoField.YEAR_OF_ERA));
}
-
- @Test
- public void test_eras_isLatestEraConsistency() {
- List<Era> japaneseEras = JapaneseChronology.INSTANCE.eras();
- boolean isHeiseiLatestInJavaTime =
- japaneseEras.get(japaneseEras.size()-1).getValue() <= JapaneseEra.HEISEI.getValue();
- boolean isHeiseiLatestInIcu = JapaneseCalendar.CURRENT_ERA == JapaneseCalendar.HEISEI;
- assertEquals("java.time and ICU4J are not consistent in the latest japanese era",
- isHeiseiLatestInJavaTime, isHeiseiLatestInIcu);
- }
}
diff --git a/ojluni/src/main/java/java/io/FileSystem.java b/ojluni/src/main/java/java/io/FileSystem.java
index 4b0260d..86d8fff 100644
--- a/ojluni/src/main/java/java/io/FileSystem.java
+++ b/ojluni/src/main/java/java/io/FileSystem.java
@@ -226,8 +226,11 @@
// Flags for enabling/disabling performance optimizations for file
// name canonicalization
- static boolean useCanonCaches = true;
- static boolean useCanonPrefixCache = true;
+ // Android-changed: Disabled caches for security reasons (b/62301183)
+ //static boolean useCanonCaches = true;
+ //static boolean useCanonPrefixCache = true;
+ static boolean useCanonCaches = false;
+ static boolean useCanonPrefixCache = false;
private static boolean getBooleanProperty(String prop, boolean defaultVal) {
String val = System.getProperty(prop);
diff --git a/ojluni/src/main/java/java/lang/SecurityManager.java b/ojluni/src/main/java/java/lang/SecurityManager.java
index 64f2d53..0cf702e 100644
--- a/ojluni/src/main/java/java/lang/SecurityManager.java
+++ b/ojluni/src/main/java/java/lang/SecurityManager.java
@@ -32,6 +32,12 @@
/**
* Legacy security code; do not use.
+ *
+ * <p>Security managers do <i>not</i> provide a secure environment for
+ * executing untrusted code and are unsupported on Android. Untrusted code
+ * cannot be safely isolated within a single VM on Android. Application
+ * developers can assume that there's no SecurityManager installed,
+ * i.e. {@link java.lang.System#getSecurityManager()} will return null.
*/
public
class SecurityManager {
diff --git a/ojluni/src/main/java/java/net/URLStreamHandler.java b/ojluni/src/main/java/java/net/URLStreamHandler.java
index eac8a78..ad25dfc 100644
--- a/ojluni/src/main/java/java/net/URLStreamHandler.java
+++ b/ojluni/src/main/java/java/net/URLStreamHandler.java
@@ -167,12 +167,25 @@
if (!isUNCName && (start <= limit - 2) && (spec.charAt(start) == '/') &&
(spec.charAt(start + 1) == '/')) {
start += 2;
+ // BEGIN Android-changed: Check for all hostname termination chars. http://b/110955991
+ /*
i = spec.indexOf('/', start);
if (i < 0 || i > limit) {
i = spec.indexOf('?', start);
if (i < 0 || i > limit)
i = limit;
}
+ */
+ LOOP: for (i = start; i < limit; i++) {
+ switch (spec.charAt(i)) {
+ case '/': // Start of path
+ case '\\': // Start of path - see https://url.spec.whatwg.org/#host-state
+ case '?': // Start of query
+ case '#': // Start of fragment
+ break LOOP;
+ }
+ }
+ // END Android-changed: Check for all hostname termination chars. http://b/110955991
host = authority = spec.substring(start, i);
@@ -266,7 +279,9 @@
// Parse the file path if any
if (start < limit) {
- if (spec.charAt(start) == '/') {
+ // Android-changed: Check for all hostname termination chars. http://b/110955991
+ // if (spec.charAt(start) == '/') {
+ if (spec.charAt(start) == '/' || spec.charAt(start) == '\\') {
path = spec.substring(start, limit);
} else if (path != null && path.length() > 0) {
isRelPath = true;
diff --git a/ojluni/src/main/java/java/util/Locale.java b/ojluni/src/main/java/java/util/Locale.java
index 9073504..9d9f3e4 100644
--- a/ojluni/src/main/java/java/util/Locale.java
+++ b/ojluni/src/main/java/java/util/Locale.java
@@ -516,7 +516,7 @@
* <td><a href="http://site.icu-project.org/download/56">ICU 56.1</a></td>
* <td><a href="http://cldr.unicode.org/index/downloads/cldr-28">CLDR 28</a></td>
* <td><a href="http://www.unicode.org/versions/Unicode8.0.0/">Unicode 8.0</a></td></tr>
- * <tr><td>Android O</td>
+ * <tr><td>Android 8.0 (Oreo)</td>
* <td><a href="http://site.icu-project.org/download/58">ICU 58.2</a></td>
* <td><a href="http://cldr.unicode.org/index/downloads/cldr-30">CLDR 30.0.3</a></td>
* <td><a href="http://www.unicode.org/versions/Unicode9.0.0/">Unicode 9.0</a></td></tr>
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
index 394d6d5..2bc1f4c 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -111,24 +111,6 @@
*/
@Test
public class TCKJapaneseChronology {
-
- // Android-added: Add a static field to indicate if the device supports the new Japanese era.
- /**
- * Indicates if the device support newer Japenese Era than Heisei. Old Android releases can
- * optionally support new Japanese Era, e.g. Reiwa, and Android test suites, e.g. CTS, can use
- * this flag to alter the expected result. This flag can be placed in other classes, but
- * TCKJapaneseChronology is picked arbitrarily.
- */
- public static final boolean IS_HEISEI_LATEST;
- static {
- List<Era> japaneseEras = JapaneseChronology.INSTANCE.eras();
- IS_HEISEI_LATEST =
- japaneseEras.get(japaneseEras.size()-1).getValue() <= JapaneseEra.HEISEI.getValue();
- }
-
-
- // Year differences from Gregorian years.
- private static final int YDIFF_REIWA = 2018;
private static final int YDIFF_HEISEI = 1988;
private static final int YDIFF_MEIJI = 1867;
private static final int YDIFF_SHOWA = 1925;
@@ -191,10 +173,6 @@
@DataProvider(name="createByEra")
Object[][] data_createByEra() {
return new Object[][] {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- IS_HEISEI_LATEST
- ? new Object[] {JapaneseEra.HEISEI, 2020 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(2020, 2, 29)}
- : new Object[] {JapaneseEra.of(3), 2020 - YDIFF_REIWA, 2, 29, 60, LocalDate.of(2020, 2, 29)}, // NEWERA
{JapaneseEra.HEISEI, 1996 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(1996, 2, 29)},
{JapaneseEra.HEISEI, 2000 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(2000, 2, 29)},
{JapaneseEra.MEIJI, 1874 - YDIFF_MEIJI, 2, 28, 59, LocalDate.of(1874, 2, 28)},
@@ -387,16 +365,8 @@
@DataProvider(name="prolepticYear")
Object[][] data_prolepticYear() {
return new Object[][] {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- IS_HEISEI_LATEST
- ? new Object[] {2, JapaneseEra.HEISEI, 1, 1 + YDIFF_HEISEI, false}
- : new Object[] {3, JapaneseEra.of(3), 1, 1 + YDIFF_REIWA, false},
- IS_HEISEI_LATEST
- ? new Object[] {2, JapaneseEra.HEISEI, 102, 102 + YDIFF_HEISEI, false}
- : new Object[] {3, JapaneseEra.of(3), 102, 102 + YDIFF_REIWA, true},
-
{2, JapaneseEra.HEISEI, 1, 1 + YDIFF_HEISEI, false},
- {2, JapaneseEra.HEISEI, 4, 4 + YDIFF_HEISEI, true},
+ {2, JapaneseEra.HEISEI, 100, 100 + YDIFF_HEISEI, true},
{-1, JapaneseEra.MEIJI, 9, 9 + YDIFF_MEIJI, true},
{-1, JapaneseEra.MEIJI, 10, 10 + YDIFF_MEIJI, false},
@@ -573,16 +543,6 @@
//-----------------------------------------------------------------------
@DataProvider(name="japaneseEras")
Object[][] data_japanseseEras() {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- if (!IS_HEISEI_LATEST) {
- return new Object[][] {
- { JapaneseEra.MEIJI, -1, "Meiji"},
- { JapaneseEra.TAISHO, 0, "Taisho"},
- { JapaneseEra.SHOWA, 1, "Showa"},
- { JapaneseEra.HEISEI, 2, "Heisei"},
- { JapaneseEra.of(3), 3, "Reiwa"},
- };
- }
return new Object[][] {
{ JapaneseEra.MEIJI, -1, "Meiji"},
{ JapaneseEra.TAISHO, 0, "Taisho"},
@@ -602,7 +562,7 @@
@Test
public void test_Japanese_badEras() {
- int badEras[] = {-1000, -998, -997, -2, 4, 5, 1000};
+ int badEras[] = {-1000, -998, -997, -2, 3, 4, 1000};
for (int badEra : badEras) {
try {
Era era = JapaneseChronology.INSTANCE.eraOf(badEra);
@@ -723,10 +683,6 @@
{JapaneseChronology.INSTANCE.date(1989, 1, 7), "Japanese Showa 64-01-07"},
{JapaneseChronology.INSTANCE.date(1989, 1, 8), "Japanese Heisei 1-01-08"},
{JapaneseChronology.INSTANCE.date(2012, 12, 6), "Japanese Heisei 24-12-06"},
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- IS_HEISEI_LATEST
- ? new Object[] {JapaneseChronology.INSTANCE.date(2020, 1, 6), "Japanese Heisei 32-01-06"}
- : new Object[] {JapaneseChronology.INSTANCE.date(2020, 1, 6), "Japanese Reiwa 2-01-06"},
};
}
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java
index 815517c..de83e1d 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,6 @@
import static java.time.temporal.ChronoField.ERA;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import static tck.java.time.chrono.TCKJapaneseChronology.IS_HEISEI_LATEST;
import java.time.chrono.Era;
import java.time.chrono.JapaneseChronology;
@@ -77,16 +76,6 @@
@DataProvider(name = "JapaneseEras")
Object[][] data_of_eras() {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- if (!IS_HEISEI_LATEST) {
- return new Object[][] {
- {JapaneseEra.of(3), "Reiwa", 3},
- {JapaneseEra.HEISEI, "Heisei", 2},
- {JapaneseEra.SHOWA, "Showa", 1},
- {JapaneseEra.TAISHO, "Taisho", 0},
- {JapaneseEra.MEIJI, "Meiji", -1},
- };
- }
return new Object[][] {
{JapaneseEra.HEISEI, "Heisei", 2},
{JapaneseEra.SHOWA, "Showa", 1},
diff --git a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java
index c1a3f72..67a10c0 100644
--- a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java
+++ b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java
@@ -942,9 +942,6 @@
assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0));
}
- // Removal of test for CTS that is dependent on IANA rules data version. Fails >= 2017c
- // http://b/68878031
- /*
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() {
// transition occurred at 1879-07-04T00:00+12:33:04
ZoneRules test = pacificApia();
@@ -962,7 +959,6 @@
ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia"));
assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0));
}
- */
//-------------------------------------------------------------------------
@Test(expectedExceptions=UnsupportedOperationException.class)
diff --git a/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java b/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java
index 337a8db..3fbf853 100644
--- a/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java
+++ b/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,12 @@
import java.time.*;
import java.time.chrono.*;
import java.time.temporal.*;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static tck.java.time.chrono.TCKJapaneseChronology.IS_HEISEI_LATEST;
/**
* Tests for the Japanese chronology
@@ -48,8 +45,7 @@
@DataProvider(name="transitions")
Object[][] transitionData() {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- List<Object[]> data = Arrays.asList(new Object[][] {
+ return new Object[][] {
// Japanese era, yearOfEra, month, dayOfMonth, gregorianYear
{ JapaneseEra.MEIJI, 6, 1, 1, 1873 },
// Meiji-Taisho transition isn't accurate. 1912-07-30 is the last day of Meiji
@@ -62,20 +58,12 @@
{ JapaneseEra.SHOWA, 1, 12, 25, 1926 },
{ JapaneseEra.SHOWA, 64, 1, 7, 1989 },
{ JapaneseEra.HEISEI, 1, 1, 8, 1989 },
- });
- if (IS_HEISEI_LATEST) {
- data.addAll(Arrays.asList(new Object[][] {
- { JapaneseEra.HEISEI, 31, 4, 30, 2019 },
- { JapaneseEra.of(3), 1, 5, 1, 2019 },
- }));
- }
- return data.toArray(new Object[data.size()][]);
+ };
}
@DataProvider(name="day_year_data")
Object[][] dayYearData() {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- List<Object[]> data = Arrays.asList(new Object[][] {
+ return new Object[][] {
// Japanese era, yearOfEra, dayOfYear, month, dayOfMonth
{ JapaneseEra.MEIJI, 45, 211, 7, 29 },
{ JapaneseEra.TAISHO, 1, 1, 7, 30 },
@@ -86,25 +74,15 @@
{ JapaneseEra.SHOWA, 64, 7, 1, 7 },
{ JapaneseEra.HEISEI, 1, 1, 1, 8 },
{ JapaneseEra.HEISEI, 2, 8, 1, 8 },
- });
- if (IS_HEISEI_LATEST) {
- data.addAll(Arrays.asList(new Object[][] {
- { JapaneseEra.HEISEI, 31, 120, 4, 30 },
- { JapaneseEra.of(3), 1, 1, 5, 1 },
- }));
- }
- return data.toArray(new Object[data.size()][]);
+ };
}
@DataProvider(name="range_data")
Object[][] rangeData() {
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- int maxEra = IS_HEISEI_LATEST ? 2 : 3;
- int yearOfLatestEra = IS_HEISEI_LATEST ? 1989 : 2019;
return new Object[][] {
// field, minSmallest, minLargest, maxSmallest, maxLargest
- { ChronoField.ERA, -1, -1, maxEra, maxEra},
- { ChronoField.YEAR_OF_ERA, 1, 1, 15, 999999999-yearOfLatestEra}, // depends on the current era
+ { ChronoField.ERA, -1, -1, 2, 2},
+ { ChronoField.YEAR_OF_ERA, 1, 1, 15, 999999999-1989 }, // depends on the current era
{ ChronoField.DAY_OF_YEAR, 1, 1, 7, 366},
{ ChronoField.YEAR, 1873, 1873, 999999999, 999999999},
};
@@ -127,9 +105,7 @@
{ JapaneseEra.SHOWA, 65, 1, 1 },
{ JapaneseEra.HEISEI, 1, 1, 7 },
{ JapaneseEra.HEISEI, 1, 2, 29 },
- { JapaneseEra.HEISEI, 31, 5, 1 },
- { JapaneseEra.of(3), 1, 4, 30 },
- { JapaneseEra.of(3), Year.MAX_VALUE, 12, 31 },
+ { JapaneseEra.HEISEI, Year.MAX_VALUE, 12, 31 },
};
}
@@ -148,10 +124,7 @@
{ JapaneseEra.SHOWA, 65 },
{ JapaneseEra.HEISEI, -1 },
{ JapaneseEra.HEISEI, 0 },
- { JapaneseEra.HEISEI, 32 },
- { JapaneseEra.of(3), -1 },
- { JapaneseEra.of(3), 0 },
- { JapaneseEra.of(3), Year.MAX_VALUE },
+ { JapaneseEra.HEISEI, Year.MAX_VALUE },
};
}
@@ -168,22 +141,6 @@
{ JapaneseEra.SHOWA, 64, 8 },
{ JapaneseEra.HEISEI, 1, 360 },
{ JapaneseEra.HEISEI, 2, 366 },
- { JapaneseEra.HEISEI, 31, 121 },
- { JapaneseEra.of(3), 1, 246 },
- { JapaneseEra.of(3), 2, 367 },
- };
- }
-
- @DataProvider
- Object[][] eraNameData() {
- return new Object[][] {
- // Japanese era, name, exception
- { "Meiji", JapaneseEra.MEIJI, null },
- { "Taisho", JapaneseEra.TAISHO, null },
- { "Showa", JapaneseEra.SHOWA, null },
- { "Heisei", JapaneseEra.HEISEI, null },
- { "Reiwa", JapaneseEra.of(3), null },
- { "NewEra", null, IllegalArgumentException.class},
};
}
@@ -235,13 +192,4 @@
JapaneseDate date = JAPANESE.dateYearDay(era, yearOfEra, dayOfYear);
System.out.printf("No DateTimeException with era=%s, year=%d, dayOfYear=%d%n", era, yearOfEra, dayOfYear);
}
-
- @Test(dataProvider="eraNameData")
- public void test_eraName(String eraName, JapaneseEra era, Class expectedEx) {
- try {
- assertEquals(JapaneseEra.valueOf(eraName), era);
- } catch (Exception ex) {
- assertTrue(expectedEx.isInstance(ex));
- }
- }
}
diff --git a/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java b/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
index e2f2b77..ab61c71 100644
--- a/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
+++ b/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,6 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import static tck.java.time.chrono.TCKJapaneseChronology.IS_HEISEI_LATEST;
import java.time.DateTimeException;
import java.time.DayOfWeek;
@@ -73,7 +72,6 @@
/**
* Tests for the Umm alQura chronology and data.
* Note: The dates used for testing are just a sample of calendar data.
- * @bug 8067800
*/
@Test
public class TestUmmAlQuraChronology {
@@ -550,7 +548,6 @@
assertFalse(HijrahChronology.INSTANCE.isLeapYear(y), "Out of range leap year");
}
-
// Date samples to convert HijrahDate to LocalDate and vice versa
@DataProvider(name="samples")
Object[][] data_samples() {
@@ -776,11 +773,8 @@
{HijrahDate.of(1350,5,15), "Japanese Showa 6-09-28"},
{HijrahDate.of(1434,5,1), "Japanese Heisei 25-03-13"},
{HijrahDate.of(1436,1,1), "Japanese Heisei 26-10-25"},
- {HijrahDate.of(1440,8,25), "Japanese Heisei 31-04-30"},
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- {HijrahDate.of(1440,8,26), IS_HEISEI_LATEST ? "Japanese Heisei 31-05-01" : "Japanese Reiwa 1-05-01"},
- {HijrahDate.of(1500,6,12), IS_HEISEI_LATEST ? "Japanese Heisei 89-05-05" : "Japanese Reiwa 59-05-05"},
- {HijrahDate.of(1550,3,11), IS_HEISEI_LATEST ? "Japanese Heisei 137-08-11" : "Japanese Reiwa 107-08-11"},
+ {HijrahDate.of(1500,6,12), "Japanese Heisei 89-05-05"},
+ {HijrahDate.of(1550,3,11), "Japanese Heisei 137-08-11"},
};
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java b/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java
index df74377..6609f2c 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -20,17 +20,9 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-/*
- *
- * @test
- * @bug 8206120
- */
-
package test.java.time.format;
import static org.testng.Assert.assertEquals;
-import static tck.java.time.chrono.TCKJapaneseChronology.IS_HEISEI_LATEST;
import java.time.LocalDate;
import java.time.chrono.ChronoLocalDate;
@@ -45,7 +37,6 @@
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
import java.time.format.FormatStyle;
-import java.time.format.ResolverStyle;
import java.time.format.TextStyle;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQueries;
@@ -143,19 +134,6 @@
};
}
- @DataProvider(name="lenient_eraYear")
- Object[][] lenientEraYear() {
- return new Object[][] {
- // Chronology, lenient era/year, strict era/year
- { JAPANESE, "Meiji 123", "Heisei 2" },
- // Android-changed: Eras names have been changed in CLDR data.
- // { JAPANESE, "Showa 65", "Heisei 2" }
- { JAPANESE, "Shōwa 65", "Heisei 2" },
- // Android-changed: Old Android releases can optionally support the new Japanese era.
- { JAPANESE, "Heisei 32", IS_HEISEI_LATEST ? "Heisei 32" : "Reiwa 2" },
- };
- }
-
@Test(dataProvider="format_data")
public void test_formatLocalizedDate(Chronology chrono, Locale formatLocale, Locale numberingLocale,
ChronoLocalDate date, String expected) {
@@ -194,15 +172,4 @@
Chronology cal = ta.query(TemporalQueries.chronology());
assertEquals(cal, chrono);
}
-
- @Test(dataProvider="lenient_eraYear")
- public void test_lenientEraYear(Chronology chrono, String lenient, String strict) {
- String mdStr = "-01-01";
- DateTimeFormatter dtf = new DateTimeFormatterBuilder()
- .appendPattern("GGGG y-M-d")
- .toFormatter()
- .withChronology(chrono);
- DateTimeFormatter dtfLenient = dtf.withResolverStyle(ResolverStyle.LENIENT);
- assertEquals(LocalDate.parse(lenient+mdStr, dtfLenient), LocalDate.parse(strict+mdStr, dtf));
- }
}