Bug 62733

Summary: [PATCH] XSLFBackground setFill() can corrupt the document
Product: POI Reporter: Mate Borcsok <bmateusz>
Component: XSLFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 4.0.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: patch setFill function of XSLFBackground
testcase src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFBackground.java

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