summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-10-03 21:58:42 +0000
committerPJ Fanning <fanningpj@apache.org>2021-10-03 21:58:42 +0000
commit41a48d80bcc78c43b042468708baefa7e6c9b6b7 (patch)
tree5f62ffc926808a74bb48dc58b2b5074c68d7e265
parentd3fd99a0b5f09eac495d9ce56a28739dac1855dc (diff)
downloadpoi-41a48d80bcc78c43b042468708baefa7e6c9b6b7.tar.gz
poi-41a48d80bcc78c43b042468708baefa7e6c9b6b7.zip
make array into immutable collection (spotbugs issue)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893861 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLExtractorFactory.java15
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/extractor/XSSFBEventBasedExcelExtractor.java6
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java15
3 files changed, 24 insertions, 12 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLExtractorFactory.java b/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLExtractorFactory.java
index 8cad08609d..124a2818ed 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLExtractorFactory.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/ooxml/extractor/POIXMLExtractorFactory.java
@@ -21,6 +21,9 @@ import static org.apache.poi.extractor.ExtractorFactory.OOXML_PACKAGE;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import org.apache.poi.extractor.ExtractorFactory;
import org.apache.poi.extractor.ExtractorProvider;
@@ -65,11 +68,13 @@ public final class POIXMLExtractorFactory implements ExtractorProvider {
private static final String VISIO_DOCUMENT_REL = PackageRelationshipTypes.VISIO_CORE_DOCUMENT;
private static final String STRICT_DOCUMENT_REL = PackageRelationshipTypes.STRICT_CORE_DOCUMENT;
- private static final XSLFRelation[] SUPPORTED_XSLF_TYPES = new XSLFRelation[]{
- XSLFRelation.MAIN, XSLFRelation.MACRO, XSLFRelation.MACRO_TEMPLATE,
- XSLFRelation.PRESENTATIONML, XSLFRelation.PRESENTATIONML_TEMPLATE,
- XSLFRelation.PRESENTATION_MACRO
- };
+ private static final List<XSLFRelation> SUPPORTED_XSLF_TYPES = Collections.unmodifiableList(
+ Arrays.asList(
+ XSLFRelation.MAIN, XSLFRelation.MACRO, XSLFRelation.MACRO_TEMPLATE,
+ XSLFRelation.PRESENTATIONML, XSLFRelation.PRESENTATIONML_TEMPLATE,
+ XSLFRelation.PRESENTATION_MACRO
+ )
+ );
@Override
public boolean accepts(FileMagic fm) {
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/extractor/XSSFBEventBasedExcelExtractor.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/extractor/XSSFBEventBasedExcelExtractor.java
index 817ed64a1e..a4c56db4cd 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/extractor/XSSFBEventBasedExcelExtractor.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/extractor/XSSFBEventBasedExcelExtractor.java
@@ -18,6 +18,8 @@ package org.apache.poi.xssf.extractor;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -46,9 +48,9 @@ public class XSSFBEventBasedExcelExtractor extends XSSFEventBasedExcelExtractor
private static final Logger LOGGER = LogManager.getLogger(XSSFBEventBasedExcelExtractor.class);
- public static final XSSFRelation[] SUPPORTED_TYPES = new XSSFRelation[]{
+ public static final List<XSSFRelation> SUPPORTED_TYPES = Collections.singletonList(
XSSFRelation.XLSB_BINARY_WORKBOOK
- };
+ );
private boolean handleHyperlinksInCells;
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
index 578d6f2828..0673aee02d 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
@@ -17,6 +17,8 @@
package org.apache.poi.xwpf.extractor;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
@@ -43,11 +45,14 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
* Helper class to extract text from an OOXML Word file
*/
public class XWPFWordExtractor implements POIXMLTextExtractor {
- public static final XWPFRelation[] SUPPORTED_TYPES = {
- XWPFRelation.DOCUMENT, XWPFRelation.TEMPLATE,
- XWPFRelation.MACRO_DOCUMENT,
- XWPFRelation.MACRO_TEMPLATE_DOCUMENT
- };
+ public static final List<XWPFRelation> SUPPORTED_TYPES = Collections.unmodifiableList(
+ Arrays.asList(
+ XWPFRelation.DOCUMENT,
+ XWPFRelation.TEMPLATE,
+ XWPFRelation.MACRO_DOCUMENT,
+ XWPFRelation.MACRO_TEMPLATE_DOCUMENT
+ )
+ );
private final XWPFDocument document;
private boolean fetchHyperlinks;