make array into immutable collection (spotbugs issue)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-10-03 21:58:42 +00:00
parent d3fd99a0b5
commit 41a48d80bc
3 changed files with 24 additions and 12 deletions

View File

@ -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[]{
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) {

View File

@ -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;

View File

@ -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,
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;