https://bz.apache.org/bugzilla/show_bug.cgi?id=68778

            Bug ID: 68778
           Summary: POI 3.5.4 "Fontconfig head is null, check your fonts
                    or fonts configuration"
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: SXSSF
          Assignee: dev@poi.apache.org
          Reporter: de.felix.koe...@gmail.com
  Target Milestone: ---

We are running a Quarkus application with Docker, and the base image is an UBI8
(`FROM docker-redhat.sopdock/ubi8/openjdk-21-runtime:1.18`). We are currently 
using `org.apache.poi:poi-ooxml:5.2.3` with `SXSSFSheet`s. We are *not* using
`sheet.trackAllColumnsForAutoSizing()` because that requires Fonts to be
installed, which we don't have inside our Docker image.

However, after updating to 5.2.5, we get the error `Fontconfig head is null,
check your fonts or fonts configuration` regardless. I believe this might have
been caused by [this
change](https://github.com/apache/poi/commit/43551babf1cf628aa184a2f9445412815781dc9e)
in 5.2.4:

```diff
diff --git
a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
index 44caba42178..d454fc10829 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
@@ -63,8 +63,8 @@ protected SXSSFSheet(SXSSFWorkbook workbook, XSSFSheet
xSheet, int randomAccessW
         setRandomAccessWindowSize(randomAccessWindowSize);
         try {
             _autoSizeColumnTracker = new AutoSizeColumnTracker(this);
-        } catch (Throwable t) {
-            LOG.atWarn().log("Failed to create AutoSizeColumnTracker, possibly
due to fonts not being installed in your OS", t);
+        } catch (UnsatisfiedLinkError | InternalError e) {
+            LOG.atWarn().log("Failed to create AutoSizeColumnTracker, possibly
due to fonts not being installed in your OS", e);
         }
     }

@@ -96,8 +96,8 @@ public SXSSFSheet(SXSSFWorkbook workbook, XSSFSheet xSheet)
throws IOException {
         setRandomAccessWindowSize(_workbook.getRandomAccessWindowSize());
         try {
             _autoSizeColumnTracker = new AutoSizeColumnTracker(this);
-        } catch (Throwable t) {
-            LOG.atWarn().log("Failed to create AutoSizeColumnTracker, possibly
due to fonts not being installed in your OS", t);
+        } catch (UnsatisfiedLinkError | InternalError e) {
+            LOG.atWarn().log("Failed to create AutoSizeColumnTracker, possibly
due to fonts not being installed in your OS", e);
         }
     }

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 d55e3634d52..130169999c4 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
@@ -300,12 +300,12 @@ public static int getDefaultCharWidth(final Workbook wb)
{
         try {
             TextLayout layout = new TextLayout(str.getIterator(),
fontRenderContext);
             return (int) layout.getAdvance();
-        } catch (Throwable t) {
+        } catch (UnsatisfiedLinkError | NoClassDefFoundError | InternalError
e) {
             if (ignoreMissingFontSystem) {
                 return DEFAULT_CHAR_WIDTH;
             }

-            throw t;
+            throw e;
         }
     }

```

Where previously all Throwables were caught, and now only `UnsatisfiedLinkError
| NoClassDefFoundError | InternalError` do. The "Fontconfig head is null"-error
is a RuntimeException: `throw new RuntimeException(fontconfigErrorMessage);`

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to