edge case (avoid short overflow)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-01-28 20:44:26 +00:00
parent 1cf4094e2d
commit cde87ab3c6

View File

@ -1706,9 +1706,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
index = Math.toIntExact(col.getMax());
}
worksheet.setColsArray(0, ctCols);
if (maxLevelCol > getSheetFormatPrOutlineLevelCol()) {
increaseSheetFormatPrOutlineLevelColIfNecessary((short) maxLevelCol);
}
increaseSheetFormatPrOutlineLevelColIfNecessary((short) Math.min(Short.MAX_VALUE, maxLevelCol));
}
/**
@ -1743,9 +1741,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
maxOutlineLevel = Math.max(maxOutlineLevel, newOutlineLevel);
ctrow.setOutlineLevel((short) newOutlineLevel);
}
if (maxOutlineLevel >= 0) {
increaseSheetFormatPrOutlineLevelRowIfNecessary((short) maxOutlineLevel);
}
increaseSheetFormatPrOutlineLevelRowIfNecessary((short) Math.min(Short.MAX_VALUE, maxOutlineLevel));
}
private short getMaxOutlineLevelRows(){