pjfanning opened a new pull request, #1553: URL: https://github.com/apache/poi/pull/1553
Follow-up to #1543. `XSLFSheet.removeShape` on a picture removes the image part once no other shape on the sheet uses it, but `XMLSlideShow._pictures` kept the entry. This was already the case before #1543, which fixed the same problem only inside `removeSlide`. Adding the same bytes again then went wrong: ```java XSLFPictureShape ps = slide.createPicture(ppt.addPicture(data, PictureType.PNG)); slide.removeShape(ps); slide.createPicture(ppt.addPicture(data, PictureType.PNG)); // returns the removed entry ``` `findPictureData` returned the stale entry, so the new shape linked to a part that wasn't in the written file. After reading the file back, `getPictureData()` on the shape returns null. `getPictureData()` now drops entries whose part is no longer in the package. `findPictureData` and `addPicture` both go through it, so this covers every removal path, and the separate check #1543 added to `removeSlide` is no longer needed. Added `TestXSLFPictureShape.testAddPictureAfterRemoveShape`, which fails on trunk. `TestXSLFPictureShape` and `TestXSLFSlideShow`, including #1543's `testRemoveSlideUpdatesPictureData`, pass on JDK 17. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
