Bug 65260: Fix how we ignore errors when fonts are not installed

The implementation via bug 66230 was not fully working due to the
caught exception.
Also add this to the 2nd constructor as well.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2022-12-26 16:15:44 +00:00
parent 7ba2f0fffa
commit 3ef2c45101
2 changed files with 7 additions and 4 deletions

View File

@ -62,7 +62,11 @@ public class SXSSFSheet implements Sheet, OoxmlSheetExtensions {
_sh = xSheet;
calculateLeftAndRightMostColumns(xSheet);
setRandomAccessWindowSize(randomAccessWindowSize);
_autoSizeColumnTracker = new AutoSizeColumnTracker(this);
try {
_autoSizeColumnTracker = new AutoSizeColumnTracker(this);
} catch (InternalError e) {
LOG.atWarn().log("Failed to create AutoSizeColumnTracker, possibly due to fonts not being installed in your OS", e);
}
}
private void calculateLeftAndRightMostColumns(XSSFSheet xssfSheet) {
@ -93,7 +97,7 @@ public class SXSSFSheet implements Sheet, OoxmlSheetExtensions {
setRandomAccessWindowSize(_workbook.getRandomAccessWindowSize());
try {
_autoSizeColumnTracker = new AutoSizeColumnTracker(this);
} catch (Exception e) {
} catch (InternalError e) {
LOG.atWarn().log("Failed to create AutoSizeColumnTracker, possibly due to fonts not being installed in your OS", e);
}
}

View File

@ -43,11 +43,10 @@ import org.junit.jupiter.api.Test;
/**
* Tests the auto-sizing behaviour of {@link SXSSFSheet} when not all
* rows fit into the memory window size etc.
*
* <p>
* see Bug #57450 which reported the original misbehaviour
*/
class TestAutoSizeColumnTracker {
private SXSSFSheet sheet;
private SXSSFWorkbook workbook;
private AutoSizeColumnTracker tracker;