Replace "getEntry() plus catch" by "hasEntry()" in HSSFWorkbook

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1809738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-09-26 12:33:08 +00:00
parent 991fba37a2
commit a751880c11

View File

@ -271,13 +271,9 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
} }
public static String getWorkbookDirEntryName(DirectoryNode directory) { public static String getWorkbookDirEntryName(DirectoryNode directory) {
for(String wbName : WORKBOOK_DIR_ENTRY_NAMES) {
for (String wbName : WORKBOOK_DIR_ENTRY_NAMES) { if(directory.hasEntry(wbName)) {
try {
directory.getEntry(wbName);
return wbName; return wbName;
} catch (FileNotFoundException e) {
// continue - to try other options
} }
} }