Author: fanningpj
Date: Thu Jan 25 10:03:29 2024
New Revision: 1915397

URL: http://svn.apache.org/viewvc?rev=1915397&view=rev
Log:
[github-578] allow any non-fatal exception when setting up fonts to indicate 
that the fonts are probably not installed. This closes #578

Modified:
    poi/trunk/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java

Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java?rev=1915397&r1=1915396&r2=1915397&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java Thu Jan 
25 10:03:29 2024
@@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.RichT
 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;
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to