Bug 62551

Summary: The function setSheetname() in the BoundSheetRecord class does not have check on length of sheet name, it throws java.lang.IllegalArgumentException if sheet name is more than 31.
Product: POI Reporter: Sharwan <srvnforensoft>
Component: HSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 3.17-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   

Description Sharwan 2018-07-18 08:37:26 UTC
The function setSheetname() in the BoundSheetRecord class does not have check on length of sheetname, it throws  java.lang.IllegalArgumentException if sheet name is more than 31.

Test case:-
BoundSheetRecord record = new   BoundSheetRecord("12345678902234567890323456789011");

Someone has tried to fix the bug for the function setSheetname() in the XSSFWorkbook class but we can do the same for the BoundSheetRecord class.
like:-

if(sheetname.length() > 31) {
            sheetname = sheetname.substring(0, 31);
        }

Just put the above code before calling the validateSheetName(sheetName) in the setSheetname() function of the BoundSheetRecord class.