tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [10/23] incubator-tamaya-sandbox git commit: Fixed further issues from quality gates.
Date Sun, 25 Sep 2016 21:35:50 GMT
Fixed further issues from quality gates.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/8c370a7f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/8c370a7f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/8c370a7f

Branch: refs/heads/master
Commit: 8c370a7fa1db404de0179eb4a8db9f291cb2e99d
Parents: 8def21e
Author: anatole <anatole@apache.org>
Authored: Sun Jan 10 02:14:41 2016 +0100
Committer: anatole <anatole@apache.org>
Committed: Sun Jan 10 02:14:41 2016 +0100

----------------------------------------------------------------------
 .../AbstractClassloaderAwareItemLoader.java          |  4 ++--
 .../clsupport/CLAwareConfigurationContext.java       |  2 +-
 .../apache/tamaya/clsupport/ServiceContainer.java    | 15 +++++----------
 3 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/8c370a7f/src/main/java/org/apache/tamaya/clsupport/AbstractClassloaderAwareItemLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/clsupport/AbstractClassloaderAwareItemLoader.java
b/src/main/java/org/apache/tamaya/clsupport/AbstractClassloaderAwareItemLoader.java
index 775d778..0145d1f 100644
--- a/src/main/java/org/apache/tamaya/clsupport/AbstractClassloaderAwareItemLoader.java
+++ b/src/main/java/org/apache/tamaya/clsupport/AbstractClassloaderAwareItemLoader.java
@@ -49,7 +49,7 @@ public abstract class AbstractClassloaderAwareItemLoader<T> {
     /**
      * The items managed, related to their classloader.
      */
-    private Map<String, T> items = new ConcurrentHashMap<>();
+    private final Map<String, T> items = new ConcurrentHashMap<>();
 
     /**
      * Creates a new instance, using the current Thread context classloader, or - if null
- the classloader that
@@ -115,7 +115,7 @@ public abstract class AbstractClassloaderAwareItemLoader<T> {
      * Creates a new item for being stored linked with the given lassloader.
      *
      * @param classLoader the classloader, not null.
-     * @return
+     * @return the new item loaded.
      */
     protected abstract T createItem(ClassLoader classLoader);
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/8c370a7f/src/main/java/org/apache/tamaya/clsupport/CLAwareConfigurationContext.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/clsupport/CLAwareConfigurationContext.java b/src/main/java/org/apache/tamaya/clsupport/CLAwareConfigurationContext.java
index 47b78b2..94e5fb5 100644
--- a/src/main/java/org/apache/tamaya/clsupport/CLAwareConfigurationContext.java
+++ b/src/main/java/org/apache/tamaya/clsupport/CLAwareConfigurationContext.java
@@ -41,7 +41,7 @@ public class CLAwareConfigurationContext implements ConfigurationContext
{
     /** The logger used. */
     private final static Logger LOG = Logger.getLogger(CLAwareConfigurationContext.class.getName());
 
-    private ContextManager contextManager = new ContextManager();
+    private final ContextManager contextManager = new ContextManager();
 
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/8c370a7f/src/main/java/org/apache/tamaya/clsupport/ServiceContainer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/clsupport/ServiceContainer.java b/src/main/java/org/apache/tamaya/clsupport/ServiceContainer.java
index 1eea749..23e73c0 100644
--- a/src/main/java/org/apache/tamaya/clsupport/ServiceContainer.java
+++ b/src/main/java/org/apache/tamaya/clsupport/ServiceContainer.java
@@ -39,7 +39,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- * Created by Anatole on 08.09.2015.
+ * Classloader managed ServiceContainer.
  */
 class ServiceContainer {
 
@@ -50,7 +50,7 @@ class ServiceContainer {
     // The access control context taken when the ServiceLoader is created
     private final AccessControlContext acc;
 
-    private WeakReference<ClassLoader> classLoaderRef;
+    private final WeakReference<ClassLoader> classLoaderRef;
 
     /**
      * List current services loaded using this classloader, per class.
@@ -82,7 +82,7 @@ class ServiceContainer {
 
     public <T> void loadServices(Class<?> type,
                                  Collection<ServiceContainer> preceedingContainers)
{
-        Map<String, Object> services = (Map<String, Object>) this.servicesLoaded.get(type);
+        Map<String, Object> services = this.servicesLoaded.get(type);
         if (services == null) {
             services = new LinkedHashMap<>();
             this.servicesLoaded.put(type, services);
@@ -100,7 +100,6 @@ class ServiceContainer {
                 for (ServiceContainer cont : preceedingContainers) {
                     if (cont.containsService(type, s)) {
                         LOG.finest("Ignoring duplicate service: " + s);
-                        continue;
                     }
                 }
                 LOG.info("Loading component: " + s);
@@ -133,10 +132,7 @@ class ServiceContainer {
 
     private boolean containsService(Class<?> type, String serviceClassName) {
         Map<String, Object> services = servicesLoaded.get(type);
-        if (services == null) {
-            return false;
-        }
-        return services.containsKey(serviceClassName);
+        return services != null && services.containsKey(serviceClassName);
     }
 
 
@@ -154,8 +150,7 @@ class ServiceContainer {
                     "Provider " + className + " not a subtype");
         }
         try {
-            S p = serviceType.cast(c.newInstance());
-            return p;
+            return serviceType.cast(c.newInstance());
         } catch (Throwable x) {
             fail(serviceType,
                     "Provider " + className + " could not be instantiated",


Mime
View raw message