You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/07/30 18:25:14 UTC
[commons-dbcp] 11/13: Add @SuppressWarnings.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
commit cf295bd593a68963d4711f0fbe6d8032cbbf6999
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 30 10:27:59 2019 -0400
Add @SuppressWarnings.
---
.../java/org/apache/commons/dbcp2/DelegatingConnection.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
index fc09b23..fe0de9d 100644
--- a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
@@ -87,6 +87,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
/**
* Returns a string representation of the metadata associated with the innermost delegate connection.
*/
+ @SuppressWarnings("resource")
@Override
public synchronized String toString() {
String str = null;
@@ -114,12 +115,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
// Ignore
}
}
-
- if (str == null) {
- str = super.toString();
- }
-
- return str;
+ return str != null ? str : super.toString();
}
/**
@@ -142,6 +138,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
* connection to compare innermost delegate with
* @return true if innermost delegate equals <code>c</code>
*/
+ @SuppressWarnings("resource")
public boolean innermostDelegateEquals(final Connection c) {
final Connection innerCon = getInnermostDelegateInternal();
if (innerCon == null) {
@@ -174,6 +171,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
*
* @return innermost delegate.
*/
+ @SuppressWarnings("resource")
public final Connection getInnermostDelegateInternal() {
Connection conn = connection;
while (conn != null && conn instanceof DelegatingConnection) {