Fix zone.tab parsing.

Not every zone.tab line has a comment.

Bug: 9327819

(cherry picked from commit b2181542090a8ff8801331e6ad8f9afcb62da8b3)

Change-Id: I36d48321e91ed18d1434bda8c33a395349bf5608
diff --git a/luni/src/main/java/libcore/icu/TimeZoneNames.java b/luni/src/main/java/libcore/icu/TimeZoneNames.java
index 65ada89..2db0381 100644
--- a/luni/src/main/java/libcore/icu/TimeZoneNames.java
+++ b/luni/src/main/java/libcore/icu/TimeZoneNames.java
@@ -153,6 +153,9 @@
             if (line.startsWith(countryCode)) {
                 int olsonIdStart = line.indexOf('\t', 4) + 1;
                 int olsonIdEnd = line.indexOf('\t', olsonIdStart);
+                if (olsonIdEnd == -1) {
+                    olsonIdEnd = line.length(); // Not all zone.tab lines have a comment.
+                }
                 ids.add(line.substring(olsonIdStart, olsonIdEnd));
             }
         }
diff --git a/luni/src/test/java/libcore/icu/TimeZoneNamesTest.java b/luni/src/test/java/libcore/icu/TimeZoneNamesTest.java
index da8e035..c2f8312 100644
--- a/luni/src/test/java/libcore/icu/TimeZoneNamesTest.java
+++ b/luni/src/test/java/libcore/icu/TimeZoneNamesTest.java
@@ -47,4 +47,16 @@
     }
     return -1;
   }
+
+  public void testBug9327819() throws Exception {
+    // Check one specific example of a zone.tab line without a comment thoroughly.
+    String[] ids = TimeZoneNames.forLocale(Locale.KOREA);
+    assertEquals("Asia/Seoul", ids[0]);
+    assertEquals(1, ids.length);
+
+    // Now check we can parse all countries' lines.
+    for (Locale l : Locale.getAvailableLocales()) {
+      assertTrue(TimeZoneNames.forLocale(l) != null);
+    }
+  }
 }