ICU-11918 Fixed an eclipse warning in icu4j-build-tools.

X-SVN-Rev: 37980
This commit is contained in:
Yoshito Umaoka 2015-09-22 01:05:51 +00:00
parent bd78494175
commit 6097a70d4b

View File

@ -1,6 +1,6 @@
/** /**
******************************************************************************* *******************************************************************************
* Copyright (C) 2004-2014, International Business Machines Corporation and * * Copyright (C) 2004-2015, International Business Machines Corporation and *
* others. All Rights Reserved. * * others. All Rights Reserved. *
******************************************************************************* *******************************************************************************
*/ */
@ -65,10 +65,11 @@ public final class APIData {
public static APIData read(File file, boolean internal) { public static APIData read(File file, boolean internal) {
String fileName = file.getName(); String fileName = file.getName();
ZipFile zf = null;
try { try {
InputStream is; InputStream is;
if (fileName.endsWith(".zip")) { if (fileName.endsWith(".zip")) {
ZipFile zf = new ZipFile(file); zf = new ZipFile(file);
Enumeration entryEnum = zf.entries(); Enumeration entryEnum = zf.entries();
if (entryEnum.hasMoreElements()) { if (entryEnum.hasMoreElements()) {
ZipEntry entry = (ZipEntry)entryEnum.nextElement(); ZipEntry entry = (ZipEntry)entryEnum.nextElement();
@ -85,11 +86,20 @@ public final class APIData {
} }
InputStreamReader isr = new InputStreamReader(is); InputStreamReader isr = new InputStreamReader(is);
return read(new BufferedReader(isr), internal); return read(new BufferedReader(isr), internal);
} } catch (IOException e) {
catch (IOException e) {
RuntimeException re = new RuntimeException("error getting info stream: " + fileName); RuntimeException re = new RuntimeException("error getting info stream: " + fileName);
re.initCause(e); re.initCause(e);
throw re; throw re;
} finally {
if (zf != null) {
try {
zf.close();
} catch (IOException e) {
RuntimeException re = new RuntimeException("failed to close the zip file: " + fileName);
re.initCause(e);
throw re;
}
}
} }
} }