[ICU-9810] A couple of fixes in ICU TZU. Supported new Trac page using <dir> tags for listing sub-directories. Supported ICU's manifest including Implementation-Version in the main section. This version will be published as 1.5.0.

X-SVN-Rev: 33018
diff --git a/tzdata/tzu/build.xml b/tzdata/tzu/build.xml
index bfd4b83..a34b4db 100644
--- a/tzdata/tzu/build.xml
+++ b/tzdata/tzu/build.xml
@@ -1,11 +1,11 @@
 <!--
 *******************************************************************************
-* Copyright (C) 2009-2010, International Business Machines Corporation and    *
+* Copyright (C) 2009-2013, International Business Machines Corporation and    *
 * others. All Rights Reserved.                                                *
 *******************************************************************************
 -->
 <project name="tzu" default="build" basedir=".">
-    <property name="tzdata.ver" value="2010f"/>
+    <property name="tzdata.ver" value="2012j"/>
 
     <property name="tzu.jar.file" value="icutzu.jar"/>
     <property name="tzu.src.zip.file" value="icutzu-src.zip"/>
diff --git a/tzdata/tzu/icu-tzres.zip b/tzdata/tzu/icu-tzres.zip
index 4ae1d27..f08914c 100644
--- a/tzdata/tzu/icu-tzres.zip
+++ b/tzdata/tzu/icu-tzres.zip
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:f3cab6c01ed985eb1ca755f81821a7f5f63557d46b84f249b2c29d2b48db7dfd
-size 537983
+oid sha256:e3ca2401dc91a2737c4cac10b3d684db7877b7956a311d77673db0d6cf658bf1
+size 571747
diff --git a/tzdata/tzu/readme.html b/tzdata/tzu/readme.html
index 9954319..2ae96a7 100644
--- a/tzdata/tzu/readme.html
+++ b/tzdata/tzu/readme.html
@@ -3,13 +3,13 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <!--
 *******************************************************************************
-* Copyright (C) 2000-2010, International Business Machines Corporation and    *
+* Copyright (C) 2000-2013, International Business Machines Corporation and    *
 * others. All Rights Reserved.                                                *
 *******************************************************************************
 -->
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <meta name="COPYRIGHT" content="Copyright (c) 2007-2010 IBM Corporation and others. All Rights Reserved.">
+    <meta name="COPYRIGHT" content="Copyright (c) 2007-2013 IBM Corporation and others. All Rights Reserved.">
     <meta name="keywords" content="ICUTZU, ICU4J Time Zone Update Utility" />
 
     <title>ICU4J Time Zone Update Utility (ICUTZU)</title>
@@ -19,7 +19,7 @@
 
   <body>
 
-    <h2>ICU4J Time Zone Update Utility (ICUTZU) 1.4.0</h2>
+    <h2>ICU4J Time Zone Update Utility (ICUTZU) 1.5.0</h2>
 
 
     <h3>Contents</h3>
@@ -42,9 +42,9 @@
     <!-- any changes to the introduction should also be done in /repos/icuproj/trunk/htdocs/download/icutzu.html -->
 
     <p>ICU4J Time Zone Update Utility (ICUTZU) is a utility that supplies ICU4J jar files with the latest time zone information and daylight savings time changeover dates.</p>
-    <p>The time zone data is stored in zoneinfo.res(before ICU 4.4) or zoneinfo64.res files which are generated by the ICU team using the Olson Time Zone Database (<a href="http://www.twinsun.com/tz/tz-link.htm">http://www.twinsun.com/tz/tz-link.htm</a>). Every version of the time zone data corresponds directly to a version of the Olson database. For example "2010a" refers to the first refresh of the Olson database in 2010.</p>
+    <p>The time zone data is stored in zoneinfo.res(before ICU 4.4) or zoneinfo64.res files which are generated by the ICU team using the Time Zone Database (<a href="http://www.iana.org/time-zones">http://www.iana.org/time-zones</a>). Every version of the time zone data corresponds directly to a version of the database. For example "2010a" refers to the first refresh of the database in 2010.</p>
     <p>ICUTZU works by searching the file system for ICU4J jar files containing old time zone data, checking online for the newest time zone data and updating the ICU4J jar files accordingly. The user can choose to update from a copy of the time zone data that comes bundled with ICUTZU or from an online copy on the ICU servers.</p>
-	<p>The time zone data includes zoneinfo.res/zoneinfo64.res and other resources.  The tool requires the following directory structre for the data used when the system is disconnected from the internet.</p>
+	<p>The time zone data includes zoneinfo.res/zoneinfo64.res and other resources.  The tool requires the following directory structure for the data used when the system is disconnected from the internet.</p>
 	
 	<ul>
 	<li>&lt;path&gt;/res/36/be/*.res - 3.6 or older</li>
diff --git a/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUFile.java b/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUFile.java
index 7d5dd48..391c354 100644
--- a/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUFile.java
+++ b/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUFile.java
@@ -1,6 +1,6 @@
 /*
  * ******************************************************************************
- * Copyright (C) 2007-2010, International Business Machines Corporation and others.
+ * Copyright (C) 2007-2013, International Business Machines Corporation and others.
  * All Rights Reserved.
  * ******************************************************************************
  */
@@ -811,13 +811,21 @@
             Manifest manifest = jar.getManifest();
             icuVersion = ICU_VERSION_UNKNOWN;
             if (manifest != null) {
-                Iterator<Attributes> iter = manifest.getEntries().values().iterator();
-                while (iter.hasNext()) {
-                    Attributes attr = iter.next();
-                    String ver = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
-                    if (ver != null) {
-                        icuVersion = ver;
-                        break;
+                // try main attributes first
+                Attributes attrs = manifest.getMainAttributes();
+                String ver = attrs.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+                if (ver != null) {
+                    icuVersion = ver;
+                } else {
+                    // try per-entry attributes
+                    Iterator<Attributes> iter = manifest.getEntries().values().iterator();
+                    while (iter.hasNext()) {
+                        Attributes attr = iter.next();
+                        ver = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+                        if (ver != null) {
+                            icuVersion = ver;
+                            break;
+                        }
                     }
                 }
             }
diff --git a/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUTZUMain.java b/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUTZUMain.java
index 73e1773..4aaa917 100644
--- a/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUTZUMain.java
+++ b/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/ICUTZUMain.java
@@ -1,6 +1,6 @@
 /*
  * ******************************************************************************
- * Copyright (C) 2007-2010, International Business Machines Corporation and others.
+ * Copyright (C) 2007-2013, International Business Machines Corporation and others.
  * All Rights Reserved.
  * ******************************************************************************
  */
@@ -15,7 +15,7 @@
  */
 public class ICUTZUMain {
 
-    private static final String TZU_VER = "1.4.0";
+    private static final String TZU_VER = "1.5.0";
 
     /**
      * Argument number for the backup directory.
diff --git a/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/SourceModel.java b/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/SourceModel.java
index 4992875..55345de 100644
--- a/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/SourceModel.java
+++ b/tzdata/tzu/src/com/ibm/icu/dev/tool/tzu/SourceModel.java
@@ -1,6 +1,6 @@
 /*
  * ******************************************************************************
- * Copyright (C) 2007-2010, International Business Machines Corporation and others.
+ * Copyright (C) 2007-2013, International Business Machines Corporation and others.
  * All Rights Reserved.
  * ******************************************************************************
  */
@@ -72,6 +72,11 @@
     public static File tzresLocalDir = null;
 
     /**
+     * The tz database version pattern
+     */
+    private static final String TZ_VERSION_PATTERN = "\\d{4}[a-z]";
+
+    /**
      * The current logger.
      */
     private Logger logger;
@@ -151,8 +156,16 @@
                 }
 
                 public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, int pos) {
-                    if (tag == HTML.Tag.LI)
+                    if (tag == HTML.Tag.DIR) {
+                        // Current Trac version uses <dir> for sub directories
+                        String name = attr.getAttribute(HTML.Attribute.NAME).toString();
+                        if (name != null && name.matches(TZ_VERSION_PATTERN)) {
+                            addVersion(name);
+                        }
+                    } else if (tag == HTML.Tag.LI) {
+                        // Older Trac version uses <li> for sub directories
                         listItem = true;
+                    }
                 }
 
                 public void handleText(char[] data, int pos) {
@@ -160,24 +173,28 @@
                         String str = new String(data);
                         if (str.charAt(str.length() - 1) == '/')
                             str = str.substring(0, str.length() - 1);
-                        if (!"..".equals(str))
-                            try {
-                                // add the new item to the map
-                                urlMap.put(str, new URL(TZ_BASE_URLSTRING + "/" + str));
+                        if (str.matches(TZ_VERSION_PATTERN))
+                            addVersion(str);
+                    }
+                }
 
-                                // update the selected item and fire off an
-                                // event
-                                selected = urlMap.lastKey();
-                                int index = 0;
-                                for (Iterator<String> iter = urlMap.keySet().iterator(); iter.hasNext();) {
-                                    if (iter.next().equals(str))
-                                        index++;
-                                }
-                                fireIntervalAdded(this, index, index);
-                            } catch (MalformedURLException ex) {
-                                logger.errorln("Internal program error.");
-                                ex.printStackTrace();
-                            }
+                private void addVersion(String tzver) {
+                    try {
+                        // add the new item to the map
+                        urlMap.put(tzver, new URL(TZ_BASE_URLSTRING + "/" + tzver));
+
+                        // update the selected item and fire off an
+                        // event
+                        selected = urlMap.lastKey();
+                        int index = 0;
+                        for (Iterator<String> iter = urlMap.keySet().iterator(); iter.hasNext();) {
+                            if (iter.next().equals(tzver))
+                                index++;
+                        }
+                        fireIntervalAdded(this, index, index);
+                    } catch (MalformedURLException ex) {
+                        logger.errorln("Internal program error.");
+                        ex.printStackTrace();
                     }
                 }
             };