You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:21:26 UTC

[sling-org-apache-sling-jcr-jackrabbit-base] 02/07: SLING-2624 : Improving Jackrabbit integration with OSGi Service Registry. Minor cosmetics

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-jackrabbit-base.git

commit 32607ef31624a19465c3ef7f6ae7a58b2ea488ea
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Oct 23 09:54:37 2012 +0000

    SLING-2624 : Improving Jackrabbit integration with OSGi Service Registry. Minor cosmetics
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1401228 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/jackrabbit/base/config/OsgiBeanFactory.java  | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java b/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java
index f55cd45..3ec4e08 100644
--- a/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java
+++ b/src/main/java/org/apache/sling/jcr/jackrabbit/base/config/OsgiBeanFactory.java
@@ -21,6 +21,7 @@ package org.apache.sling.jcr.jackrabbit.base.config;
 
 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 BeanFactory, ServiceTrackerCustomizer {
         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 BeanFactory, ServiceTrackerCustomizer {
         }
     }
 
-    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) {}
+                }
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.