Bug 51948

Summary: Data written to parts not readable
Product: POI Reporter: Bernd Fuhrmann <bernd.fuhrmann>
Component: XWPFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: test case

Description Bernd Fuhrmann 2011-10-04 09:32:25 UTC
Created attachment 27683 [details]
test case

In the attached test case I'm reading a file with a comments part and the try to change the comments part via commentspart.getOutputStream().

This leads to the execution of PackagePart.getOutputStream(), which will try to convert a read-only part to a writable part (MemoryPackagePart). 

The problem is, that this will have no influence on the parts I get via doc.getRelations(). So when I later try to read the comments part, it will serve me the old data, originally read from the file and not what I have written to it. It will however write the correct data.

I know there are workarounds, but still I'd like to file this as a bug.

IMHO, it's necessary to get rid of the strange conversion done in PackagePart.getOutputStream(). That really is weird. But that's just my opinion then. Any ideas? Or am I expecting the wrong thing from POI framework or misusing the API?

I was using 3.8-beta4