You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/10/23 11:54:37 UTC
svn commit: r1401228 -
/sling/trunk/bundles/jcr/jackrabbit-base/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java
Author: cziegeler
Date: Tue Oct 23 09:54:37 2012
New Revision: 1401228
URL: http://svn.apache.org/viewvc?rev=1401228&view=rev
Log:
SLING-2624 : Improving Jackrabbit integration with OSGi Service Registry. Minor cosmetics
Modified:
sling/trunk/bundles/jcr/jackrabbit-base/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java
Modified: sling/trunk/bundles/jcr/jackrabbit-base/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-base/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java?rev=1401228&r1=1401227&r2=1401228&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-base/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java (original)
+++ sling/trunk/bundles/jcr/jackrabbit-base/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java Tue Oct 23 09:54:37 2012
@@ -21,6 +21,7 @@ package org.apache.sling.jcr.jackrabbit.
import java.io.IOException;
import java.io.InputStream;
+import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -92,7 +93,7 @@ public class OsgiBeanFactory implements
this.tracker = new ServiceTracker(bundleContext, filter, this);
}
- public void initialize(InputSource configSource) throws IOException, ConfigurationException {
+ public void initialize(final InputSource configSource) throws ConfigurationException {
determineDependencies(configSource);
createClassNameMappings();
tracker.open();
@@ -192,19 +193,26 @@ public class OsgiBeanFactory implements
}
}
- private void determineDependencies(InputSource source) throws ConfigurationException, IOException {
- Properties p = new Properties();
+ private void determineDependencies(final InputSource source) throws ConfigurationException {
+ final Properties p = new Properties();
p.putAll(System.getProperties());
p.setProperty(RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE, "/fake/path");
- RepositoryConfigurationParser parser = new RepositoryConfigurationParser(p);
+
+ final RepositoryConfigurationParser parser = new RepositoryConfigurationParser(p);
parser.setConfigVisitor(new DepFinderBeanConfigVisitor());
try {
parser.parseRepositoryConfig(source);
} finally {
- InputStream is = source.getByteStream();
+ // close source
+ final InputStream is = source.getByteStream();
if (is != null) {
- is.close();
+ try { is.close(); } catch (final IOException ignore) {}
+ } else {
+ final Reader r = source.getCharacterStream();
+ if ( r != null ) {
+ try { r.close(); } catch (final IOException ignore) {}
+ }
}
}