Bug 62551 - 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.
Summary: The function setSheetname() in the BoundSheetRecord class does not have check...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.17-FINAL
Hardware: PC Mac OS X 10.1
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-18 08:37 UTC by Sharwan
Modified: 2018-07-18 08:37 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.