mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
Bug 69315: HSMF: At least continue processing properties after multivalued properties
Currently processing stops at multivalued properties. This at least continues processing, so other properties are processed properly. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4f21f5280a
commit
c1f52674fd
@ -209,6 +209,12 @@ public abstract class PropertiesChunk extends Chunk {
|
||||
int id = LittleEndian.readUShort(value);
|
||||
long flags = LittleEndian.readUInt(value);
|
||||
|
||||
boolean multivalued = false;
|
||||
if ((typeID & Types.MULTIVALUED_FLAG) != 0) {
|
||||
typeID -= Types.MULTIVALUED_FLAG;
|
||||
multivalued = true;
|
||||
}
|
||||
|
||||
// Turn the Type and ID into helper objects
|
||||
MAPIType type = Types.getById(typeID);
|
||||
MAPIProperty prop = MAPIProperty.get(id);
|
||||
@ -255,7 +261,7 @@ public abstract class PropertiesChunk extends Chunk {
|
||||
// to another chunk which holds the data itself
|
||||
boolean isPointer = false;
|
||||
int length = type.getLength();
|
||||
if (type.isPointer()) {
|
||||
if (type.isPointer() || multivalued) {
|
||||
isPointer = true;
|
||||
length = 8;
|
||||
}
|
||||
|
||||
@ -19,13 +19,20 @@ package org.apache.poi.hsmf;
|
||||
|
||||
import static org.apache.poi.POITestCase.assertContains;
|
||||
import static org.apache.poi.POITestCase.assertStartsWith;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
|
||||
import org.apache.poi.hsmf.datatypes.Chunks;
|
||||
import org.apache.poi.hsmf.datatypes.DirectoryChunk;
|
||||
import org.apache.poi.hsmf.datatypes.MAPIProperty;
|
||||
import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
@ -273,4 +280,33 @@ public final class TestBasics {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBug69315() throws Exception {
|
||||
POIDataSamples testData = POIDataSamples.getPOIFSInstance();
|
||||
try (MAPIMessage mapi = new MAPIMessage(testData.openResourceAsStream("MailSentPropertyMultiple.msg"))) {
|
||||
assertNotNull(mapi.getAttachmentFiles());
|
||||
assertNotNull(mapi.getDisplayBCC());
|
||||
assertNotNull(mapi.getMessageDate());
|
||||
|
||||
Chunks chunks = mapi.getMainChunks();
|
||||
assertNotNull(chunks);
|
||||
assertNotNull(chunks.getRawProperties());
|
||||
assertNotNull(chunks.getRawProperties().get(MAPIProperty.CLIENT_SUBMIT_TIME));
|
||||
|
||||
AttachmentChunks[] attachments = mapi.getAttachmentFiles();
|
||||
for (AttachmentChunks attachment : attachments) {
|
||||
DirectoryChunk chunkDirectory = attachment.getAttachmentDirectory();
|
||||
if (chunkDirectory != null) {
|
||||
MAPIMessage attachmentMSG = chunkDirectory.getAsEmbeddedMessage();
|
||||
assertNotNull(attachmentMSG);
|
||||
String body = attachmentMSG.getTextBody();
|
||||
assertNotNull(body);
|
||||
}
|
||||
}
|
||||
|
||||
assertNull(mapi.getSummaryInformation());
|
||||
assertNull(mapi.getDocumentSummaryInformation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
test-data/poifs/MailSentPropertyMultiple.msg
Normal file
BIN
test-data/poifs/MailSentPropertyMultiple.msg
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user