Bug 50572 - Write to outputstream clears PackagePart
Summary: Write to outputstream clears PackagePart
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.7-FINAL
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-11 15:27 UTC by christian.maerzinger
Modified: 2011-01-19 07:53 UTC (History)
0 users



Attachments
Code with Unit Test (14.92 KB, application/octet-stream)
2011-01-11 15:55 UTC, christian.maerzinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description christian.maerzinger 2011-01-11 15:27:09 UTC
If you write something to the outputstream of a packagepart the packagepart will be cleaned. all charakters are gone.

Enclosed my code and a JUNIT test.
Comment 1 christian.maerzinger 2011-01-11 15:55:32 UTC
Created attachment 26478 [details]
Code with Unit Test
Comment 2 Yegor Kozlov 2011-01-19 07:53:55 UTC
You must close the outputstream of a packagepart, otherwise the data isn't written in the underlying zip package.

Add mpOut.close() after you've written the data and  you will be good:

OutputStream mpOut = commentOriginal.getOutputStream();
mpOut.write(strCommentAfterManipulation.getBytes(), 0,
					strCommentAfterManipulation.length());
mpOut.close(); 

Yegor