summaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-10-03 21:52:15 +0000
committerPJ Fanning <fanningpj@apache.org>2021-10-03 21:52:15 +0000
commitd3fd99a0b5f09eac495d9ce56a28739dac1855dc (patch)
tree604fdfcbc078fa7e34a69b44676c441e2923db14 /poi
parent9f7085a281871ec65e638c2ac497f5981e40823c (diff)
downloadpoi-d3fd99a0b5f09eac495d9ce56a28739dac1855dc.tar.gz
poi-d3fd99a0b5f09eac495d9ce56a28739dac1855dc.zip
make array into immutable collection (spotbugs issue)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893860 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/eventusermodel/HSSFEventFactory.java2
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java2
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java20
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java2
4 files changed, 13 insertions, 13 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/eventusermodel/HSSFEventFactory.java b/poi/src/main/java/org/apache/poi/hssf/eventusermodel/HSSFEventFactory.java
index bf4d737ab1..dafa88c1cd 100644
--- a/poi/src/main/java/org/apache/poi/hssf/eventusermodel/HSSFEventFactory.java
+++ b/poi/src/main/java/org/apache/poi/hssf/eventusermodel/HSSFEventFactory.java
@@ -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)) {
diff --git a/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java b/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
index 2c1c384fb6..4bca11d9d5 100644
--- a/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
+++ b/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
@@ -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) {
diff --git a/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
index cff4822a09..82a3838414 100644
--- a/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
+++ b/poi/src/main/java/org/apache/poi/hssf/model/InternalWorkbook.java
@@ -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
diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
index 548e8c0279..65297e5405 100644
--- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
+++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
@@ -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