commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1431456 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Date Thu, 10 Jan 2013 16:01:36 GMT
Author: markt
Date: Thu Jan 10 16:01:35 2013
New Revision: 1431456

URL: http://svn.apache.org/viewvc?rev=1431456&view=rev
Log:
Remove unnecessary null-check after further analysis prompted by FindBugs

Modified:
    commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java

Modified: commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1431456&r1=1431455&r2=1431456&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Thu Jan 10 16:01:35 2013
@@ -325,7 +325,6 @@ public class GenericKeyedObjectPool<K,T>
      * @throws NoSuchElementException if a keyed object instance cannot be
      *                                returned.
      */
-    @SuppressWarnings("null") // objectDeque will always be non-null
     public T borrowObject(K key, long borrowMaxWaitMillis) throws Exception {
         assertOpen();
 
@@ -366,9 +365,7 @@ public class GenericKeyedObjectPool<K,T>
                         p = null;
                     }
                 } else {
-                    if (objectDeque != null) {
-                        p = objectDeque.getIdleObjects().pollFirst();
-                    }
+                    p = objectDeque.getIdleObjects().pollFirst();
                     if (p == null) {
                         create = true;
                         p = create(key);
@@ -552,7 +549,7 @@ public class GenericKeyedObjectPool<K,T>
                     "Object not currently part of this pool");
         }
         synchronized (p) {
-            if (p.getState() != PooledObjectState.INVALID) { 
+            if (p.getState() != PooledObjectState.INVALID) {
                 destroy(key, p, true);
             }
         }
@@ -1030,6 +1027,9 @@ public class GenericKeyedObjectPool<K,T>
 
     /*
      * register() and deregister() must always be used as a pair.
+     *
+     * If this method returns without throwing an exception then it will never
+     * return null.
      */
     private ObjectDeque<T> register(K k) {
         Lock lock = keyLock.readLock();



Mime
View raw message