diff options
author | Kelly Campbell <kellyc@apache.org> | 2001-06-21 18:05:09 +0000 |
---|---|---|
committer | Kelly Campbell <kellyc@apache.org> | 2001-06-21 18:05:09 +0000 |
commit | 9fc23914f0a30287df26f3ee5cd40a9255c3a7b5 (patch) | |
tree | ed26e8434d48cafd36fc645fadd9ea0f008995e3 /src/org/apache/fop/apps | |
parent | 9a439a087103ce1059c14a60c7b7c016071983a2 (diff) | |
download | xmlgraphics-fop-9fc23914f0a30287df26f3ee5cd40a9255c3a7b5.tar.gz xmlgraphics-fop-9fc23914f0a30287df26f3ee5cd40a9255c3a7b5.zip |
Added patch for loading config via Thread ContextClassLoader
PR: 2255
Obtained from:
Submitted by: Davanum Srinivas
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/apps')
-rw-r--r-- | src/org/apache/fop/apps/Options.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/org/apache/fop/apps/Options.java b/src/org/apache/fop/apps/Options.java index 6ed8322fe..db54cc413 100644 --- a/src/org/apache/fop/apps/Options.java +++ b/src/org/apache/fop/apps/Options.java @@ -116,10 +116,23 @@ public class Options { throws FOPException { String file = "config.xml"; + InputStream configfile = null; + + // Try to use Context Class Loader to load the properties file. + try { + java.lang.reflect.Method getCCL = + Thread.class.getMethod("getContextClassLoader", new Class[0]); + if (getCCL != null) { + ClassLoader contextClassLoader = + (ClassLoader) getCCL.invoke(Thread.currentThread(), new Object[0]); + configfile = contextClassLoader.getResourceAsStream("conf/" + file); + } + } + catch (Exception e) {} // the entry /conf/config.xml refers to a directory conf which is a sibling of org - InputStream configfile = - ConfigurationReader.class.getResourceAsStream("/conf/"+ + if(configfile == null) + ConfigurationReader.class.getResourceAsStream("/conf/"+ file); if (configfile == null) { throw new FOPException("can't find default configuration file"); |