Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tzdb handling #789

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/main/java/org/joda/time/tz/ZoneInfoCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,13 @@ public void parseDataFile(BufferedReader in, boolean backward) throws IOExceptio
// links in "backward" are deprecated names
// links in other files should be kept
// special case a few to try to repair terrible damage to tzdb
if (backward || alias.equals("US/Pacific-New") || alias.startsWith("Etc/") || alias.equals("GMT")) {
if (alias.equals("WET") || alias.equals("CET") || alias.equals("EET")) {
iGoodLinks.add(real);
iGoodLinks.add(alias);
} else if (alias.equals("MET")) {
iBackLinks.add("CET"); // map MET -> CET (not Europe/Brussels)
iBackLinks.add(alias);
} else if (backward || alias.equals("US/Pacific-New") || alias.startsWith("Etc/") || alias.equals("GMT")) {
iBackLinks.add(real);
iBackLinks.add(alias);
} else {
Expand Down Expand Up @@ -962,7 +968,9 @@ public void addRecurring(DateTimeZoneBuilder builder, int standardMillis, String

// if negative SAVE values, then patch standard millis and name format
if (negativeSave < 0) {
System.out.println("Fixed negative save values for rule '" + iRules.get(0).iName + "'");
if (ZoneInfoLogger.verbose()) {
System.out.println("Fixed negative save values for rule '" + iRules.get(0).iName + "'");
}
standardMillis += negativeSave;
int slashPos = nameFormat.indexOf("/");
if (slashPos > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import java.util.Locale;
import java.util.Map;

import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.joda.time.DateTime;
import org.joda.time.DateTimeFieldType;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDateTime;

import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* This class is a Junit unit test for DateTimeFormatterBuilder.
*
Expand Down Expand Up @@ -547,24 +547,24 @@ public void test_printParseZoneEtcGMT10_suffix() {
assertEquals(dt, f.parseDateTime("2007-03-04 12:30 Etc/GMT+10]"));
}

public void test_printParseZoneMET() {
public void test_printParseZoneCET() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:mm ZZZ");
DateTimeFormatter f = bld.toFormatter();

DateTime dt = new DateTime(2007, 3, 4, 12, 30, 0, DateTimeZone.forID("MET"));
assertEquals("2007-03-04 12:30 MET", f.print(dt));
assertEquals(dt, f.parseDateTime("2007-03-04 12:30 MET"));
DateTime dt = new DateTime(2007, 3, 4, 12, 30, 0, DateTimeZone.forID("CET"));
assertEquals("2007-03-04 12:30 CET", f.print(dt));
assertEquals(dt, f.parseDateTime("2007-03-04 12:30 CET"));
}

public void test_printParseZoneMET_suffix() {
public void test_printParseZoneCET_suffix() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:mm ZZZ").appendLiteral(']');
DateTimeFormatter f = bld.toFormatter();

DateTime dt = new DateTime(2007, 3, 4, 12, 30, 0, DateTimeZone.forID("MET"));
assertEquals("2007-03-04 12:30 MET]", f.print(dt));
assertEquals(dt, f.parseDateTime("2007-03-04 12:30 MET]"));
DateTime dt = new DateTime(2007, 3, 4, 12, 30, 0, DateTimeZone.forID("CET"));
assertEquals("2007-03-04 12:30 CET]", f.print(dt));
assertEquals(dt, f.parseDateTime("2007-03-04 12:30 CET]"));
}

public void test_printParseZoneBahiaBanderas() {
Expand Down