diff options
author | PJ Fanning <fanningpj@apache.org> | 2024-01-25 10:03:29 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2024-01-25 10:03:29 +0000 |
commit | 274a7e24f372cb15ed78cf097522fd32794fafd9 (patch) | |
tree | a08fae3f076ff93c85fac3e1c4b6754b1641b187 /poi | |
parent | 7b7f10e657cb2ff976452b95bbaec6e208aba06e (diff) | |
download | poi-274a7e24f372cb15ed78cf097522fd32794fafd9.tar.gz poi-274a7e24f372cb15ed78cf097522fd32794fafd9.zip |
[github-578] allow any non-fatal exception when setting up fonts to indicate that the fonts are probably not installed. This closes #578
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915397 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r-- | poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java b/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java index 57ee821c5d..6d7bc7f8e0 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java @@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.util.ExceptionUtil; import org.apache.poi.util.Internal; @@ -351,12 +352,13 @@ public class SheetUtil { try { TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext); return layout.getAdvance(); - } catch (UnsatisfiedLinkError | NoClassDefFoundError | InternalError e) { - if (ignoreMissingFontSystem) { + } catch (Throwable t) { + // fatal exceptions will always be rethrown + if (!ExceptionUtil.isFatal(t) && ignoreMissingFontSystem) { return DEFAULT_CHAR_WIDTH; } - throw e; + throw t; } } |