pjfanning commented on code in PR #967:
URL: https://github.com/apache/poi/pull/967#discussion_r2607831479
##########
poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java:
##########
@@ -1061,11 +1061,30 @@ public HSSFSheet getSheetAt(int index) {
* If there are multiple matches, the first sheet from the list
* of sheets is returned.
*
+ * <p>
+ * Note that Excel limits sheet names to 31 characters. If you try to
look up
+ * a sheet by a name longer than that, a warning will be logged, since
+ * such a sheet cannot exist in Excel and the lookup will likely
return {@code null}.
+ * </p>
+ *
* @param name of the sheet
* @return HSSFSheet with the name provided or {@code null} if it does not
exist
*/
@Override
public HSSFSheet getSheet(String name) {
+
+ if (name == null || name.isEmpty()) {
+ return null;
+ }
+
+ if(name.length() > MAX_SENSITIVE_SHEET_NAME_LEN) {
+ LOGGER.atWarn().log(
Review Comment:
we won't accept a HSSF only change - the same change will need to go into
XSSF
--
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]