Bug 51716

Summary: Incorrect assert in SXSSFSheet#getSXSSFSheet(XSSFSheet)
Product: POI Reporter: Mark Harris <mark.harris>
Component: SXSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Removes an assert from SXSSFWorkbook.java

Description Mark Harris 2011-08-24 10:42:34 UTC
Created attachment 27430 [details]
Removes an assert from SXSSFWorkbook.java

Workbook#getSheet(String) explicitly states that it should return null if workbook does not contain a sheet with the name given.

In 3.8-beta3 and the trunk, SXSSFWorkbooks implementation of getSheet(String) calls getSXSSFSheet(XSFFSheet), which contains an assert (:68 in 3.8-beta3) that the result of a Map lookup on the string isn't null.

This makes getSheet(String) no good for an existence check on a named sheet if the JVM has been run with -ea.

I've attached a patch that removes the assert from the current trunk.
Comment 1 Yegor Kozlov 2011-10-04 12:36:51 UTC
Applied in r1178769

Thanks,
Yegor