From: James Ahlborn Date: Sun, 15 Sep 2013 02:53:54 +0000 (+0000) Subject: fix poi detection code for ole handling X-Git-Tag: jackcess-2.0.1~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=03f4fbe2a0937c01063993a9e765baf8a0e6216e;p=jackcess.git 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 --- 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;