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

pottlinger pushed a commit to branch try_with_resource
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya.git


The following commit(s) were added to refs/heads/try_with_resource by this push:
     new 007371e  Simplify code, fix warnings.
007371e is described below

commit 007371e976e055e0e98cb313471f3b78a4100c5c
Author: Hugo Hirsch <[email protected]>
AuthorDate: Wed May 1 22:30:45 2019 +0200

    Simplify code, fix warnings.
---
 .../java/org/apache/tamaya/core/internal/OSGIServiceLoader.java    | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java
 
b/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java
index 90af2c2..f52a4e6 100644
--- 
a/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java
+++ 
b/code/core/src/main/java/org/apache/tamaya/core/internal/OSGIServiceLoader.java
@@ -49,9 +49,9 @@ public class OSGIServiceLoader implements BundleListener {
     private static final Logger LOG = 
Logger.getLogger(OSGIServiceLoader.class.getName());
     private static final String META_INF_SERVICES = "META-INF/services/";
 
-    private BundleContext context;
+    private final BundleContext context;
 
-    private final Set<Bundle> resourceBundles = 
Collections.synchronizedSet(new HashSet<Bundle>());
+    private final Set<Bundle> resourceBundles = 
Collections.synchronizedSet(new HashSet<>());
 
     public OSGIServiceLoader(BundleContext context) {
         this.context = Objects.requireNonNull(context);
@@ -76,11 +76,10 @@ public class OSGIServiceLoader implements BundleListener {
     @Override
     public void bundleChanged(BundleEvent bundleEvent) {
         // Parse and createObject metadata when installed
+        Bundle bundle = bundleEvent.getBundle();
         if (bundleEvent.getType() == BundleEvent.STARTED) {
-            Bundle bundle = bundleEvent.getBundle();
             checkAndLoadBundle(bundle);
         } else if (bundleEvent.getType() == BundleEvent.STOPPED) {
-            Bundle bundle = bundleEvent.getBundle();
             checkAndUnloadBundle(bundle);
         }
     }

Reply via email to