pjfanning opened a new pull request, #1558:
URL: https://github.com/apache/poi/pull/1558

   Part of #1556 (group C), follow-up to #1557.
   
   These asserts checked arguments of public or protected methods, so they only 
ran with `-ea`.
   
   | Method | Before, without `-ea` | Now |
   |---|---|---|
   | `XSSFSheet.removeMergedRegion(int)` | with one merged region, it was 
removed whatever the index. With more, XmlBeans threw 
`IndexOutOfBoundsException` | `IllegalArgumentException` for an index outside 
the regions, with the message HSSF's `MergedCellsTable` uses. A sheet without 
merged regions still ignores the call |
   | `XSLFSlide.setNotes` | did nothing | `UnsupportedOperationException`, like 
the other `@NotImplemented` setters in `XSLFSlide` |
   | `TextSpecInfoAtom.setParentSize` | wrote runs of length 0 or below | 
`IllegalArgumentException` |
   | `EscherColorRef(byte[], int, int)` | read any length other than 6 as 4 | 
`IllegalArgumentException` |
   | `SprmUtils.addSprm` | NPE for a variable length sprm without `varParam` | 
`IllegalArgumentException` |
   | `HSLFSlideShowEncrypted.addEncryptionRecord` | NPE further down | 
`Objects.requireNonNull` |
   
   HSSF ignores an index past the last merged region in `removeMergedRegion` 
and throws `IllegalArgumentException` only for a negative one. I didn't change 
HSSF. The `Sheet` javadoc doesn't specify either behaviour, and XSSF already 
threw for most out-of-range indexes.
   
   `XSLFSlide.setNotes` now throws where it silently did nothing before. 
Nothing in POI calls it.
   
   New tests, which each fail without the change: 
`TestXSSFSheet.removeMergedRegionOutOfRange`, 
`TestXSLFSlide.setNotesIsNotSupported`, 
`TestTextSpecInfoAtom.testSetParentSizeNotPositive`, 
`TestHSLFSlideShowEncrypted.addEncryptionRecordNeedsAtom`, `TestSprmUtils`, 
`TestEscherColorRef`. These plus `TestHSSFSheet` and `TestSXSSFSheet` 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]

Reply via email to