From 87a764956c280960f6117eee1bfb351d94c3a23b Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sun, 17 Oct 2021 20:44:36 +0000 Subject: sonar fixes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894331 13f79535-47bb-0310-9956-ffa450edef68 --- .../ole2/OLE2ScratchpadExtractorFactory.java | 32 +++++++++-------- .../poi/hslf/usermodel/HSLFSlideShowFactory.java | 4 +++ .../java/org/apache/poi/hwpf/dev/HWPFLister.java | 42 ++-------------------- .../apache/poi/hwpf/extractor/Word6Extractor.java | 7 ++-- .../apache/poi/hwpf/extractor/WordExtractor.java | 5 +-- .../poi/hwpf/model/FileInformationBlock.java | 19 +++++----- .../java/org/apache/poi/hwpf/model/ListLevel.java | 3 +- .../apache/poi/hwpf/model/StyleDescription.java | 15 ++++---- .../poi/hwpf/model/types/LFOAbstractType.java | 39 +++++++++----------- 9 files changed, 64 insertions(+), 102 deletions(-) (limited to 'poi-scratchpad') diff --git a/poi-scratchpad/src/main/java/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java b/poi-scratchpad/src/main/java/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java index 70da34747b..3c4ab886f4 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java @@ -60,6 +60,21 @@ import org.apache.poi.sl.usermodel.SlideShowFactory; public class OLE2ScratchpadExtractorFactory implements ExtractorProvider { private static final Logger LOG = LogManager.getLogger(OLE2ScratchpadExtractorFactory.class); + private static final String[] OUTLOOK_ENTRY_NAMES = { + // message bodies, saved as plain text (PtypString) + // The first short (0x1000, 0x0047, 0x0037) refer to the Property ID (see [MS-OXPROPS].pdf) + // the second short (0x001e, 0x001f, 0x0102) refer to the type of data stored in this entry + // https://msdn.microsoft.com/endatatypes.Ex-us/library/cc433490(v=exchg.80).aspx + // @see org.apache.poi.hsmf.Types.MAPIType + "__substg1.0_1000001E", //PidTagBody ASCII + "__substg1.0_1000001F", //PidTagBody Unicode + "__substg1.0_0047001E", //PidTagMessageSubmissionId ASCII + "__substg1.0_0047001F", //PidTagMessageSubmissionId Unicode + "__substg1.0_0037001E", //PidTagSubject ASCII + "__substg1.0_0037001F", //PidTagSubject Unicode + }; + + @Override public boolean accepts(FileMagic fm) { return FileMagic.OLE2 == fm; @@ -87,6 +102,8 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider { * * @throws IOException when the format specific extraction fails because of invalid entires */ + @SuppressWarnings("java:S2093") + @Override public POITextExtractor create(DirectoryNode poifsDir, String password) throws IOException { final String oldPW = Biff8EncryptionKey.getCurrentUserPassword(); try { @@ -112,20 +129,7 @@ public class OLE2ScratchpadExtractorFactory implements ExtractorProvider { return new PublisherTextExtractor(poifsDir); } - final String[] outlookEntryNames = new String[]{ - // message bodies, saved as plain text (PtypString) - // The first short (0x1000, 0x0047, 0x0037) refer to the Property ID (see [MS-OXPROPS].pdf) - // the second short (0x001e, 0x001f, 0x0102) refer to the type of data stored in this entry - // https://msdn.microsoft.com/endatatypes.Ex-us/library/cc433490(v=exchg.80).aspx - // @see org.apache.poi.hsmf.Types.MAPIType - "__substg1.0_1000001E", //PidTagBody ASCII - "__substg1.0_1000001F", //PidTagBody Unicode - "__substg1.0_0047001E", //PidTagMessageSubmissionId ASCII - "__substg1.0_0047001F", //PidTagMessageSubmissionId Unicode - "__substg1.0_0037001E", //PidTagSubject ASCII - "__substg1.0_0037001F", //PidTagSubject Unicode - }; - for (String entryName : outlookEntryNames) { + for (String entryName : OUTLOOK_ENTRY_NAMES) { if (poifsDir.hasEntry(entryName)) { return new OutlookTextExtractor(poifsDir); } diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java index 936eae064e..47f515b0a7 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowFactory.java @@ -47,6 +47,7 @@ public class HSLFSlideShowFactory implements SlideShowProvider