From 03f4fbe2a0937c01063993a9e765baf8a0e6216e Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Sun, 15 Sep 2013 02:53:54 +0000 Subject: [PATCH] fix poi detection code for ole handling git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@802 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../healthmarketscience/jackcess/impl/CompoundOleUtil.java | 6 ++++++ .../java/com/healthmarketscience/jackcess/impl/OleUtil.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java index bcf3255..602db41 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/CompoundOleUtil.java @@ -55,6 +55,12 @@ public class CompoundOleUtil implements OleUtil.CompoundPackageFactory private static final String ENTRY_SEPARATOR = "/"; private static final String CONTENTS_ENTRY = "CONTENTS"; + static { + // force a poi class to be loaded to ensure that when this class is + // loaded, we know that the poi classes are available + NPOIFSFileSystem.class.getName(); + } + public CompoundOleUtil() { } diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java index 4471da5..4cef254 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/OleUtil.java @@ -92,7 +92,7 @@ public class OleUtil compoundFactory = (CompoundPackageFactory) Class.forName("com.healthmarketscience.jackcess.impl.CompoundOleUtil") .newInstance(); - } catch(Exception e) { + } catch(Throwable t) { // must not have poi, will load compound ole data as "other" } COMPOUND_FACTORY = compoundFactory; -- 2.39.5