git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893860 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_2_0
@@ -73,7 +73,7 @@ public class HSSFEventFactory { | |||
} | |||
// If in doubt, go for the default | |||
if (name == null) { | |||
name = WORKBOOK_DIR_ENTRY_NAMES[0]; | |||
name = WORKBOOK_DIR_ENTRY_NAMES.get(0); | |||
} | |||
try (InputStream in = dir.createDocumentInputStream(name)) { |
@@ -152,7 +152,7 @@ public class OldExcelExtractor implements POITextExtractor { | |||
book = (DocumentNode)directory.getEntry(OLD_WORKBOOK_DIR_ENTRY_NAME); | |||
} catch (FileNotFoundException | IllegalArgumentException e) { | |||
// some files have "Workbook" instead | |||
book = (DocumentNode)directory.getEntry(WORKBOOK_DIR_ENTRY_NAMES[0]); | |||
book = (DocumentNode)directory.getEntry(WORKBOOK_DIR_ENTRY_NAMES.get(0)); | |||
} | |||
if (book == null) { |
@@ -20,10 +20,7 @@ package org.apache.poi.hssf.model; | |||
import static org.apache.logging.log4j.util.Unbox.box; | |||
import java.security.AccessControlException; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.*; | |||
import java.util.Map.Entry; | |||
import org.apache.logging.log4j.LogManager; | |||
@@ -92,12 +89,15 @@ public final class InternalWorkbook { | |||
* "Workbook". However, some weird XLS generators use "WORKBOOK" | |||
* or "BOOK". | |||
*/ | |||
public static final String[] WORKBOOK_DIR_ENTRY_NAMES = { | |||
"Workbook", // as per BIFF8 spec | |||
"WORKBOOK", // Typically from third party programs | |||
"BOOK", // Typically odd Crystal Reports exports | |||
"WorkBook", // Another third party program special | |||
}; | |||
public static final List<String> WORKBOOK_DIR_ENTRY_NAMES = Collections.unmodifiableList( | |||
Arrays.asList( | |||
"Workbook", // as per BIFF8 spec | |||
"WORKBOOK", // Typically from third party programs | |||
"BOOK", // Typically odd Crystal Reports exports | |||
"WorkBook" // Another third party program special | |||
) | |||
); | |||
/** | |||
* Name of older (pre-Excel 97) Workbook streams, which | |||
* aren't supported by HSSFWorkbook, only by |
@@ -1376,7 +1376,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { | |||
// Don't write out the old Workbook, we'll be doing our new one | |||
// If the file had an "incorrect" name for the workbook stream, | |||
// don't write the old one as we'll use the correct name shortly | |||
excepts.addAll(Arrays.asList(WORKBOOK_DIR_ENTRY_NAMES)); | |||
excepts.addAll(WORKBOOK_DIR_ENTRY_NAMES); | |||
// summary information has been already written via writeProperties and might go in a | |||
// different stream, if the file is cryptoapi encrypted |