You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2015/05/11 11:45:26 UTC

tapestry-5 git commit: fix some FindBugs warnings

Repository: tapestry-5
Updated Branches:
  refs/heads/master 39591ca49 -> 5dd3a5dc4


fix some FindBugs warnings


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/5dd3a5dc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/5dd3a5dc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/5dd3a5dc

Branch: refs/heads/master
Commit: 5dd3a5dc41bb1badfd6879f7be450ff79e90f565
Parents: 39591ca
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Mon May 11 11:45:07 2015 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Mon May 11 11:45:07 2015 +0200

----------------------------------------------------------------------
 .../ioc/internal/BasicTypeCoercions.java          |  4 ++--
 .../org/apache/tapestry5/ioc/RegistryBuilder.java |  2 +-
 .../tapestry5/ioc/internal/RegistryImpl.java      | 18 ++++++++++--------
 .../internal/services/ExceptionAnalyzerImpl.java  |  2 +-
 .../ioc/internal/util/AbstractResource.java       |  2 +-
 .../ioc/internal/util/InternalUtils.java          |  2 +-
 .../tapestry5/ioc/modules/TapestryIOCModule.java  |  5 +++--
 7 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java b/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java
index f7bde31..b16f470 100644
--- a/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java
+++ b/commons/src/main/java/org/apache/tapestry5/ioc/internal/BasicTypeCoercions.java
@@ -64,7 +64,7 @@ public class BasicTypeCoercions
             @Override
             public Double coerce(String input)
             {
-                return new Double(input);
+                return Double.valueOf(input);
             }
         });
 
@@ -103,7 +103,7 @@ public class BasicTypeCoercions
             @Override
             public Long coerce(String input)
             {
-                return new Long(input);
+                return Long.valueOf(input);
             }
         });
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
index d68b2da..9af07fa 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
@@ -162,7 +162,7 @@ public final class RegistryBuilder
         } catch (Exception ex)
         {
             throw new RuntimeException(String.format("Failure loading Tapestry IoC module class %s: %s", classname,
-                    ExceptionUtils.toMessage(ex), ex));
+                    ExceptionUtils.toMessage(ex)), ex);
         }
 
         return this;

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
index 73cadf3..822d4be 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
@@ -38,6 +38,7 @@ import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.*;
+import java.util.Map.Entry;
 
 @SuppressWarnings("all")
 public class RegistryImpl implements Registry, InternalRegistry, ServiceProxyProvider
@@ -1074,8 +1075,9 @@ public class RegistryImpl implements Registry, InternalRegistry, ServiceProxyPro
             markers.add(Local.class);
         }
 
-        for (Class marker : markerToServiceDef.keySet())
+        for (Entry<Class, List<ServiceDef2>> entry : markerToServiceDef.entrySet())
         {
+            Class marker = entry.getKey();
             if (provider.getAnnotation(marker) == null)
             {
                 continue;
@@ -1083,7 +1085,7 @@ public class RegistryImpl implements Registry, InternalRegistry, ServiceProxyPro
 
             markers.add(marker);
 
-            matches.retainAll(markerToServiceDef.get(marker));
+            matches.retainAll(entry.getValue());
 
             if (matches.isEmpty())
             {
@@ -1297,27 +1299,27 @@ public class RegistryImpl implements Registry, InternalRegistry, ServiceProxyPro
             
             this.delegates = delegates;
             
-            for (ServiceDef serviceDef : mapped.keySet())
+            for (Entry<ServiceDef, Map> entry : mapped.entrySet())
             {
                 for (ServiceConfigurationListener delegate : delegates)
                 {
-                    delegate.onMappedConfiguration(serviceDef, Collections.unmodifiableMap(mapped.get(serviceDef)));
+                    delegate.onMappedConfiguration(entry.getKey(), Collections.unmodifiableMap(entry.getValue()));
                 }
             }
 
-            for (ServiceDef serviceDef : unordered.keySet())
+            for (Entry<ServiceDef, Collection> entry : unordered.entrySet())
             {
                 for (ServiceConfigurationListener delegate : delegates)
                 {
-                    delegate.onUnorderedConfiguration(serviceDef, Collections.unmodifiableCollection(unordered.get(serviceDef)));
+                    delegate.onUnorderedConfiguration(entry.getKey(), Collections.unmodifiableCollection(entry.getValue()));
                 }
             }
 
-            for (ServiceDef serviceDef : ordered.keySet())
+            for (Entry<ServiceDef, List> entry : ordered.entrySet())
             {
                 for (ServiceConfigurationListener delegate : delegates)
                 {
-                    delegate.onOrderedConfiguration(serviceDef, Collections.unmodifiableList(ordered.get(serviceDef)));
+                    delegate.onOrderedConfiguration(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
                 }
             }
             

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ExceptionAnalyzerImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ExceptionAnalyzerImpl.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ExceptionAnalyzerImpl.java
index a0e1359..b345379 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ExceptionAnalyzerImpl.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ExceptionAnalyzerImpl.java
@@ -29,7 +29,7 @@ public class ExceptionAnalyzerImpl implements ExceptionAnalyzer
      * A tuple used to communicate up a lavel both the exception info
      * and the next exception in the stack.
      */
-    private class ExceptionData
+    private static class ExceptionData
     {
         final ExceptionInfo exceptionInfo;
         final Throwable cause;

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/AbstractResource.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/AbstractResource.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/AbstractResource.java
index e8076b2..81f63e4 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/AbstractResource.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/AbstractResource.java
@@ -30,7 +30,7 @@ import java.util.Locale;
  */
 public abstract class AbstractResource extends LockSupport implements Resource
 {
-    private class Localization
+    private static class Localization
     {
         final Locale locale;
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java
index a5f55b7..8a0b894 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java
@@ -1582,7 +1582,7 @@ public class InternalUtils
     /**
      * @since 5.3.1, 5.4
      */
-    public static Mapper<ObjectCreator, Object> CREATE_OBJECT = new Mapper<ObjectCreator, Object>()
+    public final static Mapper<ObjectCreator, Object> CREATE_OBJECT = new Mapper<ObjectCreator, Object>()
     {
         @Override
         public Object map(ObjectCreator element)

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5dd3a5dc/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
----------------------------------------------------------------------
diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
index 6d13d66..19f3528 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
@@ -32,6 +32,7 @@ import java.lang.reflect.Array;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.*;
+import java.util.Map.Entry;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
@@ -90,9 +91,9 @@ public final class TapestryIOCModule
     {
         final Map<String, ServiceLifecycle2> lifecycles = CollectionFactory.newCaseInsensitiveMap();
 
-        for (String name : configuration.keySet())
+        for (Entry<String, ServiceLifecycle> entry : configuration.entrySet())
         {
-            lifecycles.put(name, InternalUtils.toServiceLifecycle2(configuration.get(name)));
+            lifecycles.put(entry.getKey(), InternalUtils.toServiceLifecycle2(entry.getValue()));
         }
 
         return new ServiceLifecycleSource()