System.out.println("Writing zoneinfo files");
for (int i=0; i<iZones.size(); i++) {
Zone zone = iZones.get(i);
DateTimeZoneBuilder builder = new DateTimeZoneBuilder();
zone.addToBuilder(builder, iRuleSets);
final DateTimeZone original = builder.toDateTimeZone(zone.iName, true);
DateTimeZone tz = original;
if (test(tz.getID(), tz)) {
map.put(tz.getID(), tz);
if (outputDir != null) {
if (ZoneInfoCompiler.verbose()) {
System.out.println("Writing " + tz.getID());
}
File file = new File(outputDir, tz.getID());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
OutputStream out = new FileOutputStream(file);
try {
builder.writeTo(zone.iName, out);
} finally {
out.close();
}
// Test if it can be read back.
InputStream in = new FileInputStream(file);
DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID());
in.close();
if (!original.equals(tz2)) {
System.out.println("*e* Error in " + tz.getID() +
": Didn't read properly from file");
}
}
}
}
for (int pass=0; pass<2; pass++) {
for (int i=0; i<iLinks.size(); i += 2) {
String id = iLinks.get(i);
String alias = iLinks.get(i + 1);
DateTimeZone tz = map.get(id);
if (tz == null) {
if (pass > 0) {
System.out.println("Cannot find time zone '" + id +
"' to link alias '" + alias + "' to");
}