Author: fanningpj
Date: Fri Nov  4 08:33:38 2022
New Revision: 1905061

URL: http://svn.apache.org/viewvc?rev=1905061&view=rev
Log:
[bug-66335] add test case for issue and add some of the code from purported fix

Added:
    
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java   
(with props)
    poi/trunk/test-data/hsmf/bug66335.msg   (with props)
Modified:
    
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Types.java

Modified: 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Types.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Types.java?rev=1905061&r1=1905060&r2=1905061&view=diff
==============================================================================
--- 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Types.java 
(original)
+++ 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/Types.java 
Fri Nov  4 08:33:38 2022
@@ -81,6 +81,20 @@ public final class Types {
     /** A string, from Outlook 3.0 onwards. Normally unicode */
     public static final MAPIType UNICODE_STRING = new MAPIType(0x001F, 
"Unicode String", -1);
 
+    /** MultiValued Properties */
+    public static final MAPIType MV_SHORT = new MAPIType(0x1002, "MV Short", 
-1);
+    public static final MAPIType MV_LONG = new MAPIType(0x1003, "MV Long", -1);
+    public static final MAPIType MV_FLOAT = new MAPIType(0x1004, "MV Float", 
-1);
+    public static final MAPIType MV_DOUBLE = new MAPIType(0x1005, "MV Double", 
-1);
+    public static final MAPIType MV_CURRENCY = new MAPIType(0x1006, "MV 
Currency", -1);
+    public static final MAPIType MV_APP_TIME = new MAPIType(0x1007, "MV 
Application Time", -1);
+    public static final MAPIType MV_LONG_LONG = new MAPIType(0x1014, "MV Long 
Long", -1);
+    public static final MAPIType MV_TIME = new MAPIType(0x1040, "MV Time", -1);
+    public static final MAPIType MV_CLS_ID = new MAPIType(0x1048, "MV CLS ID 
GUID", -1);
+    public static final MAPIType MV_BINARY = new MAPIType(0x1102, "MV Binary", 
-1);
+    public static final MAPIType MV_ASCII_STRING = new MAPIType(0x101E, "MV 
ASCII String", -1);
+    public static final MAPIType MV_UNICODE_STRING = new MAPIType(0x101F, "MV 
Unicode String", -1);
+
     /** MultiValued - Value part contains multiple values */
     public static final int MULTIVALUED_FLAG = 0x1000;
 
@@ -124,6 +138,14 @@ public final class Types {
             return ((length != -1) && (length <= 8)) || (id == 
Types.CLS_ID.id);
         }
 
+        /**
+         * @return whether the type is a pointer
+         * @since POI 5.2.4
+         */
+        public boolean isPointer() {
+            return (length == -1) || (length > 8);
+        }
+
         public int getId() {
             return id;
         }

Added: 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java?rev=1905061&view=auto
==============================================================================
--- 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java 
(added)
+++ 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java 
Fri Nov  4 08:33:38 2022
@@ -0,0 +1,19 @@
+package org.apache.poi.hsmf;
+
+import org.apache.poi.POIDataSamples;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TestFileRead {
+    @Test
+    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());
+        }
+    }
+}

Propchange: 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileRead.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: poi/trunk/test-data/hsmf/bug66335.msg
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/hsmf/bug66335.msg?rev=1905061&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/hsmf/bug66335.msg
------------------------------------------------------------------------------
    svn:mime-type = application/vnd.ms-outlook



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to