]> source.dussan.org Git - poi.git/commitdiff
[bug-66335] apply rest of fix
authorPJ Fanning <fanningpj@apache.org>
Fri, 4 Nov 2022 09:13:05 +0000 (09:13 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 4 Nov 2022 09:13:05 +0000 (09:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1905062 13f79535-47bb-0310-9956-ffa450edef68

poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/PropertiesChunk.java
poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java

index 809411bfb2f096e53415ff16f09d6c1b57ac3728..cdc146d98066907016ee8ea6f682235f8bc8a7c5 100644 (file)
@@ -255,7 +255,7 @@ public abstract class PropertiesChunk extends Chunk {
                 // to another chunk which holds the data itself
                 boolean isPointer = false;
                 int length = type.getLength();
-                if (!type.isFixedLength()) {
+                if (type.isPointer()) {
                     isPointer = true;
                     length = 8;
                 }
@@ -380,7 +380,7 @@ public abstract class PropertiesChunk extends Chunk {
             LittleEndian.putUInt(value.getFlags(), out); // readable + writable
 
             MAPIType type = getTypeMapping(value.getActualType());
-            if (type.isFixedLength()) {
+            if (type.isFixedLength() && !type.isPointer()) {
                 // page 11, point 2.1.2
                 writeFixedLengthValueHeader(out, property, type, value);
             } else {
index 21f95be629bb9d3bfd9107c9a2e3fb99400286b3..71c680743104129627e39b5d2727555639355817 100644 (file)
@@ -12,8 +12,7 @@ public class TestFileRead {
     void bug66335() throws IOException {
         try (MAPIMessage mapiMessage = new MAPIMessage(
                 POIDataSamples.getHSMFInstance().getFile("bug66335.msg"))) {
-            // 25 is not the right number of properties but it is what the existing code finds
-            assertEquals(25, mapiMessage.getMainChunks().getProperties().size());
+            assertEquals(151, mapiMessage.getMainChunks().getProperties().size());
         }
     }
 }