Bug 51948 - Data written to parts not readable
Summary: Data written to parts not readable
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 3.8-dev
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 09:32 UTC by Bernd Fuhrmann
Modified: 2011-10-04 09:32 UTC (History)
0 users



Attachments
test case (12.93 KB, application/zip)
2011-10-04 09:32 UTC, Bernd Fuhrmann
Details

Note You need to log in before you can comment on or make changes to this bug.
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