From a751880c1129378be7d1691ba4a2058bb8e7a423 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Tue, 26 Sep 2017 12:33:08 +0000 Subject: [PATCH] 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 --- src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 70d947ee5..01324e571 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -271,13 +271,9 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss } public static String getWorkbookDirEntryName(DirectoryNode directory) { - - for (String wbName : WORKBOOK_DIR_ENTRY_NAMES) { - try { - directory.getEntry(wbName); + for(String wbName : WORKBOOK_DIR_ENTRY_NAMES) { + if(directory.hasEntry(wbName)) { return wbName; - } catch (FileNotFoundException e) { - // continue - to try other options } }