You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2012/07/15 19:32:29 UTC
svn commit: r1361739 - in /commons/proper/pool/trunk:
findbugs-exclude-filter.xml
src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Author: markt
Date: Sun Jul 15 17:32:29 2012
New Revision: 1361739
URL: http://svn.apache.org/viewvc?rev=1361739&view=rev
Log:
Find Bugs review of GKOP
Modified:
commons/proper/pool/trunk/findbugs-exclude-filter.xml
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Modified: commons/proper/pool/trunk/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/findbugs-exclude-filter.xml?rev=1361739&r1=1361738&r2=1361739&view=diff
==============================================================================
--- commons/proper/pool/trunk/findbugs-exclude-filter.xml (original)
+++ commons/proper/pool/trunk/findbugs-exclude-filter.xml Sun Jul 15 17:32:29 2012
@@ -17,9 +17,16 @@
-->
<!--
- This file contains some false positive bugs detected by findbugs. Their
+ This file contains some false positive bugs detected by Find Bugs. Their
false positive nature has been analyzed individually and they have been
- put here to instruct findbugs to ignore them.
+ put here to instruct Find Bugs to ignore them.
-->
<FindBugsFilter>
+ <!-- Ignoring the exception is deliberate since an earlier exception is -->
+ <!-- more important. -->
+ <Match>
+ <Class name="org.apache.commons.pool2.impl.GenericKeyedObjectPool" />
+ <Method name="borrowObject" />
+ <Bug code="DE" />
+ </Match>
</FindBugsFilter>
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=1361739&r1=1361738&r2=1361739&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 Sun Jul 15 17:32:29 2012
@@ -325,6 +325,7 @@ 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();
@@ -342,14 +343,12 @@ public class GenericKeyedObjectPool<K,T>
while (p == null) {
create = false;
if (blockWhenExhausted) {
- if (objectDeque != null) {
- p = objectDeque.getIdleObjects().pollFirst();
- }
+ p = objectDeque.getIdleObjects().pollFirst();
if (p == null) {
create = true;
p = create(key);
}
- if (p == null && objectDeque != null) {
+ if (p == null) {
if (borrowMaxWaitMillis < 0) {
p = objectDeque.getIdleObjects().takeFirst();
} else {