From e5422efa5cf3d5a0784ce0bd182c762744a390bb Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 31 May 2021 12:00:25 -0400 Subject: [PATCH] Fix SpotBugs errors. [ERROR] Medium: org.apache.commons.dbcp2.PStmtKey.getColumnNames() may expose internal representation by returning PStmtKey.columnNames [org.apache.commons.dbcp2.PStmtKey] At PStmtKey.java:[line 864] EI_EXPOSE_REP [ERROR] Medium: org.apache.commons.dbcp2.PoolingDriver.pools is a mutable collection which should be package protected [org.apache.commons.dbcp2.PoolingDriver] At PoolingDriver.java:[line 51] MS_MUTABLE_COLLECTION_PK --- src/changes/changes.xml | 6 ++++++ src/main/java/org/apache/commons/dbcp2/PStmtKey.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 28ad799435fb..1fabc7c9f3e6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -107,6 +107,12 @@ The type attribute can be add,update,fix,remove. org.apache.commons.dbcp2.managed.DataSourceXAConnectionFactory.setPassword(char[]) may expose internal representation by storing an externally mutable object into DataSourceXAConnectionFactory.userPassword. + + org.apache.commons.dbcp2.PStmtKey.getColumnIndexes() may expose internal representation by returning PStmtKey.columnIndexes. + + + org.apache.commons.dbcp2.PStmtKey.getColumnNames() may expose internal representation by returning PStmtKey.columnNames. + Bump mockito-core from 3.5.11 to 3.10.0 #66, #72, #77, #85, #91, #105. diff --git a/src/main/java/org/apache/commons/dbcp2/PStmtKey.java b/src/main/java/org/apache/commons/dbcp2/PStmtKey.java index 96c619515bc0..34f786c4b579 100644 --- a/src/main/java/org/apache/commons/dbcp2/PStmtKey.java +++ b/src/main/java/org/apache/commons/dbcp2/PStmtKey.java @@ -852,7 +852,7 @@ public String getCatalog() { * @return An array of column indexes. */ public int[] getColumnIndexes() { - return columnIndexes; + return columnIndexes == null ? null : columnIndexes.clone(); } /** @@ -861,7 +861,7 @@ public int[] getColumnIndexes() { * @return An array of column names. */ public String[] getColumnNames() { - return columnNames; + return columnNames == null ? null : columnNames.clone(); } /**