提交 68ca0692 编写于 作者: S sherman

8008161: Regression: j.u.TimeZone.getAvailableIDs(rawOffset) returns non-sorted list

Summary: to return a sorted list
Reviewed-by: lancea, naoto
上级 58d33699
......@@ -92,7 +92,13 @@ public final class ZoneInfoFile {
ids.add(id);
}
}
return ids.toArray(new String[ids.size()]);
// It appears the "zi" implementation returns the
// sorted list, though the specification does not
// specify it. Keep the same behavior for better
// compatibility.
String[] list = ids.toArray(new String[ids.size()]);
Arrays.sort(list);
return list;
}
public static ZoneInfo getZoneInfo(String zoneId) {
......
......@@ -23,7 +23,7 @@
/*
*@test
*@bug 8007572
*@bug 8007572 8008161
*@summary Test whether the TimeZone generated from JSR310 tzdb is the same
*as the one from the tz data from javazic
*/
......@@ -156,6 +156,24 @@ public class TestZoneInfo310 {
sun.util.calendar.ZoneInfoFile.getVersion(), ver);
throw new RuntimeException("Version test failed");
}
// test getAvailableIDs(raw);
zids_new = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
//Arrays.sort(zids_new);
zids_old = ZoneInfoOld.getAvailableIDs(-8 * 60 * 60 * 1000);
if (!Arrays.equals(zids_new, zids_old)) {
System.out.println("------------------------");
System.out.println("NEW.getAvailableIDs(-8:00)");
for (String zid : zids_new) {
System.out.println(zid);
}
System.out.println("------------------------");
System.out.println("OLD.getAvailableIDs(-8:00)");
for (String zid : zids_old) {
System.out.println(zid);
}
throw new RuntimeException(" FAILED: availableIds(offset) don't match");
}
}
private static void delete(File f) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册