]> source.dussan.org Git - poi.git/commitdiff
[github-578] allow any non-fatal exception when setting up fonts to indicate that...
authorPJ Fanning <fanningpj@apache.org>
Thu, 25 Jan 2024 10:03:29 +0000 (10:03 +0000)
committerPJ Fanning <fanningpj@apache.org>
Thu, 25 Jan 2024 10:03:29 +0000 (10:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915397 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java

index 57ee821c5d27937c7a840feb4e7ca071d6a7efba..6d7bc7f8e05ee90743345b5fad9d0908ee40793d 100644 (file)
@@ -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;
         }
     }