Bug 65436

Summary: Wrong behavior observed when modifiying a custom property in an MS Word 2003 .doc file (Using POI 4.0.1) after the same custom property was earlier modified using POI 3.15
Product: POI Reporter: pankajs <pankajs>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED INFORMATIONPROVIDED    
Severity: major    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: This contains the code referred in this bug and the attached video

Description pankajs 2021-07-06 10:09:57 UTC
Created attachment 37946 [details]
This contains the code referred in this bug and the attached video

Steps to reproduce
-------------------

1. Create an MS Word 2003 .doc file and name it as test.doc. 
2. In the test.doc file create a text custom property "r_version_label". Give it a value 0.2
3. Using POI 3.15 library modify this custom property and give it a value of 0.3 (Java program attached "Test_POI_315.java" inside test-poi.zip)
	- Modify the dependency in the pom.xml to use poi 3.15 library
4. Using POI 4.0.1 library modify the custom property again and give it a value 0.4 (Java program attached "Test_POI_401.java" inside test-poi.zip)
	- Modify the dependency in the pom.xml to use poi 4.0.1 library
5. Then open the file and view its custom property value.

Expected Result 
- The custom property value should be 0.4 

Actual Result
- The custom property value is 0.


Attachments
1. test-poi.zip (contains pom.xml to switch between poi 3.15 and 4.0.1, one java program to use for each version. Two programs created as there is an API difference between the two versions)
2. Screen-recording demonstrating the same behavior.
Comment 1 pankajs 2021-07-06 10:18:32 UTC
I am unable to upload the video file since it is crossing the file size limitation, so I have uploaded it on YouTube. 

https://www.youtube.com/watch?v=GuwhZ-ApFbE&t=40s
Comment 2 PJ Fanning 2021-07-06 10:32:39 UTC
We don't support POI 3.15 any more - can you try this with POI 5.0.0?
Comment 3 pankajs 2021-07-06 11:00:55 UTC
Thanks for replying. I will surely try this with 5.0.0 (in place of 4.0.1). 

But the issue is that we have millions of documents whose custom properties were modified with apache poi 3.15 and now after upgrading the poi to 4.0.1 all those documents have started mis-behaving. 

Please suggest a way out.
Comment 4 pankajs 2021-07-06 11:06:01 UTC
Tested with POI 5.0.0. Same behavior is observed.
Comment 5 pankajs 2021-07-22 08:45:04 UTC
Hi, 
Could some one please help with this issue. Please provide me some suggestions or pointers as a work around to this issue. 

Thanks,
Pankaj
Comment 6 PJ Fanning 2021-07-22 12:40:40 UTC
Have you tried the example - https://github.com/apache/poi/blob/trunk/poi-examples/src/main/java/org/apache/poi/examples/hpsf/ModifyDocumentSummaryInformation.java ?

I just tried this with POI 5.0.0 and it works as expected.
Comment 7 PJ Fanning 2021-07-22 12:40:54 UTC
Have you tried the example - https://github.com/apache/poi/blob/trunk/poi-examples/src/main/java/org/apache/poi/examples/hpsf/ModifyDocumentSummaryInformation.java ?

I just tried this with POI 5.0.0 and it works as expected.
Comment 8 pankajs 2021-12-01 07:15:44 UTC
Hi PJ Fanning,
Thanks for looking into this. 

1. I have seen the code that you are refferring to and it is exactly how I am also tyring to edit a custom property.
2. The issue is very much reproducible with POI 5.0.0
3. If you can share me an email Id. I can send you my Maven project using which you can do the below steps. 

4. Steps to reproduce
     a. Create a new .doc (Word 97-2003 Document (*.doc))
     b. Save it
     c. Create a custom property 'r_version_label' and give value 0.1
     d. Use the standalone java program using POI 3.15 and set the value of the custom property 'r_version_label' to 0.3. 
     e. Open the word file and check the value of custom property. It will be showing correctly as 0.3
     f. Then use the standalone java program using POI 5.0.0 and set the value of the custom property 'r_version_label' to 0.5. 
     g. Open the word file and check the value of the custom property. It will be showing WRONG value as 0. 


Thanks in Advance
Pankaj
Comment 9 PJ Fanning 2021-12-01 11:08:24 UTC
I don't see how you can't put the maven project in github or as an attachment to this project. HPSF is not part of the library that I look at so you'll probably be relying on someone else to look at this.

I lose interest when people have use cases that require testing with ancient unsupported versions of POI like 3.15.