Bug 62733 - [PATCH] XSLFBackground setFill() can corrupt the document
Summary: [PATCH] XSLFBackground setFill() can corrupt the document
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 4.0.0-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2018-09-18 12:46 UTC by Mate Borcsok
Modified: 2018-09-18 16:56 UTC (History)
0 users

patch setFill function of XSLFBackground (953 bytes, text/plain)
2018-09-18 12:46 UTC, Mate Borcsok
testcase src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFBackground.java (5.41 KB, text/x-csrc)
2018-09-18 15:41 UTC, Mate Borcsok

Note You need to log in before you can comment on or make changes to this bug.
Description Mate Borcsok 2018-09-18 12:46:04 UTC
Created attachment 36152 [details]
patch setFill function of XSLFBackground

The current setFill implementation only cares about noFill and solidFill attributes.
If the presentation already contains e.g. a gradFill and you call setFill(null), it results in a background containing both a noFill and a gradFill, which is an invalid document and cannot be opened by PPT.

See my patch which would fix that bug.
Comment 1 PJ Fanning 2018-09-18 13:21:17 UTC
Comment on attachment 36152 [details]
patch setFill function of XSLFBackground

Looks sensible enough to me. Could you add a test case though?
Comment 2 Mate Borcsok 2018-09-18 15:41:24 UTC
Created attachment 36154 [details]
testcase src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFBackground.java

I added a new test suite with 4 test cases which covers the common use-cases, using some existing test pptx files from the repo.
Comment 3 PJ Fanning 2018-09-18 16:56:28 UTC
changes applied using https://svn.apache.org/viewvc?view=revision&revision=1841240