From e849428855a769c0e7813819ef79403b2d442ffd Mon Sep 17 00:00:00 2001 From: Christian Geisert Date: Mon, 10 Feb 2003 03:07:12 +0000 Subject: [PATCH] Fixed error when JAI is not available git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195934 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/image/FopImageFactory.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/org/apache/fop/image/FopImageFactory.java b/src/org/apache/fop/image/FopImageFactory.java index e82451efc..2ac177ae7 100644 --- a/src/org/apache/fop/image/FopImageFactory.java +++ b/src/org/apache/fop/image/FopImageFactory.java @@ -11,6 +11,7 @@ package org.apache.fop.image; import org.apache.fop.image.analyser.ImageReaderFactory; import org.apache.fop.image.analyser.ImageReader; import org.apache.fop.configuration.Configuration; +import org.apache.fop.messaging.MessageHandler; // Java import java.io.IOException; @@ -169,7 +170,7 @@ public class FopImageFactory { try { imgClassName = "org.apache.fop.image.TiffImage"; Class.forName(imgClassName); - } catch (Exception ex) { + } catch (Throwable t) { imgClassName = getGenericImageClassName(); } } else if ("image/svg+xml".equals(imgMimeType)) { @@ -233,9 +234,11 @@ public class FopImageFactory { if (m_genericImageClassName == null) { try { + //this will throw a NoClassDefFoundError if JAI is not installed Class.forName("org.apache.fop.image.JAIImage"); m_genericImageClassName = "org.apache.fop.image.JAIImage"; - } catch (Exception ex) { + } catch (Throwable t) { + MessageHandler.logln("Failed to load JAI, using Jimi instead"); /* on any exception assume Jai is not present and use Jimi instead */ m_genericImageClassName = "org.apache.fop.image.JimiImage"; } -- 2.39.5