[exo-jcr-commits] exo-jcr SVN: r1609 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jan 28 09:43:46 EST 2010
Author: nzamosenchuk
Date: 2010-01-28 09:43:45 -0500 (Thu, 28 Jan 2010)
New Revision: 1609
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java
Log:
EXOJCR-439: Configuration manager is used at first, if fails, then ClassLoader and FileinputStream.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java 2010-01-28 14:13:25 UTC (rev 1608)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java 2010-01-28 14:43:45 UTC (rev 1609)
@@ -131,10 +131,24 @@
*/
public InputStream fillTemplate(String filename, Map<String, String> parameters) throws IOException
{
+ InputStream inputStream = null;
+ // try to get using configuration manager
+ try
+ {
+ inputStream = cfm.getInputStream(filename);
+ }
+ catch (Exception e)
+ {
+ // will try to use another resolve mechanism
+ }
+
// try to get resource by class loader
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- InputStream inputStream = cl == null ? null : cl.getResourceAsStream(filename);
-
+ if (inputStream == null)
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ inputStream = cl == null ? null : cl.getResourceAsStream(filename);
+ }
+
// check system class loader
if (inputStream == null)
{
@@ -150,22 +164,9 @@
}
catch (IOException e)
{
- // we'll try to get it through configuration manager also
+ // Still can't resolve
}
}
-
- // try to get using configuration manager
- if (inputStream == null)
- {
- try
- {
- inputStream = cfm.getInputStream(filename);
- }
- catch (Exception e)
- {
- // Stream still remains to be null, exception will be thrown below
- }
- }
// inputStream still remains null, so file was not opened
if (inputStream == null)
{
More information about the exo-jcr-commits
mailing list