This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch release in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
commit ab2dc9d0488b701b2e2cf239e288a9f8a860cce6 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Tue Jul 30 09:41:53 2019 -0400 Revert "Use current version of JaCoCo." This reverts commit c419630e2342f6acc2109fb0773c55f1a96d9f67. --- pom.xml | 3 +-- .../org/apache/commons/dbcp2/BasicDataSource.java | 10 ++------ .../apache/commons/dbcp2/DelegatingConnection.java | 30 +++++++++++----------- .../dbcp2/datasources/InstanceKeyDataSource.java | 18 ++++++------- .../datasources/InstanceKeyDataSourceFactory.java | 2 +- .../java/org/apache/commons/dbcp2/TestJndi.java | 12 ++++----- 6 files changed, 34 insertions(+), 41 deletions(-) diff --git a/pom.xml b/pom.xml index 4142991..6a09757 100644 --- a/pom.xml +++ b/pom.xml @@ -312,12 +312,11 @@ <!-- Constant for Commons Pool version (used in multiple places) --> <commons.pool.version>2.7.0</commons.pool.version> <commons.japicmp.version>0.14.1</commons.japicmp.version> - <commons.jacoco.version>0.8.4</commons.jacoco.version> <!-- See DBCP-445 and DBCP-454 --> <commons.osgi.import>javax.transaction;version="1.1.0",javax.transaction.xa;version="1.1.0";partial=true;mandatory:=partial,*</commons.osgi.import> <commons.japicmp.ignoreMissingClasses>true</commons.japicmp.ignoreMissingClasses> <!-- Commons Release Plugin --> - <commons.bc.version>2.6.0</commons.bc.version> + <commons.bc.version>2.6.2</commons.bc.version> <commons.release.isDistModule>true</commons.release.isDistModule> <commons.releaseManagerName>Gary Gregory</commons.releaseManagerName> <commons.releaseManagerKey>86fdc7e2a11262cb</commons.releaseManagerKey> diff --git a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java index 25d5981..6dd7320 100644 --- a/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java +++ b/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java @@ -1520,19 +1520,13 @@ public class BasicDataSource implements DataSource, BasicDataSourceMXBean, MBean } } - protected void log(final String message) { + void log(final String message) { if (logWriter != null) { logWriter.println(message); } } - /** - * Logs the given throwable. - * - * @param throwable the throwable. - * @since 2.7.0 - */ - protected void log(Throwable throwable) { + void log(Throwable throwable) { if (logWriter != null) { throwable.printStackTrace(logWriter); } diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java index fc09b23..546e6a8 100644 --- a/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java +++ b/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java @@ -89,17 +89,17 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i */ @Override public synchronized String toString() { - String str = null; + String s = null; - final Connection conn = this.getInnermostDelegateInternal(); - if (conn != null) { + final Connection c = this.getInnermostDelegateInternal(); + if (c != null) { try { - if (conn.isClosed()) { - str = "connection is closed"; + if (c.isClosed()) { + s = "connection is closed"; } else { final StringBuffer sb = new StringBuffer(); sb.append(hashCode()); - final DatabaseMetaData meta = conn.getMetaData(); + final DatabaseMetaData meta = c.getMetaData(); if (meta != null) { sb.append(", URL="); sb.append(meta.getURL()); @@ -107,7 +107,7 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i sb.append(meta.getUserName()); sb.append(", "); sb.append(meta.getDriverName()); - str = sb.toString(); + s = sb.toString(); } } } catch (final SQLException ex) { @@ -115,11 +115,11 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i } } - if (str == null) { - str = super.toString(); + if (s == null) { + s = super.toString(); } - return str; + return s; } /** @@ -175,14 +175,14 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i * @return innermost delegate. */ public final Connection getInnermostDelegateInternal() { - Connection conn = connection; - while (conn != null && conn instanceof DelegatingConnection) { - conn = ((DelegatingConnection<?>) conn).getDelegateInternal(); - if (this == conn) { + Connection c = connection; + while (c != null && c instanceof DelegatingConnection) { + c = ((DelegatingConnection<?>) c).getDelegateInternal(); + if (this == c) { return null; } } - return conn; + return c; } /** diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java index 13c0cab..1b070cc 100644 --- a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java +++ b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java @@ -98,7 +98,7 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable /** Description */ private String description; - /** Environment that may be used to set up a JNDI initial context. */ + /** Environment that may be used to set up a jndi initial context. */ private Properties jndiEnvironment; /** Login TimeOut in seconds */ @@ -520,8 +520,8 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable } /** - * Gets the value of connectionPoolDataSource. This method will return null, if the backing data source is being - * accessed via JNDI. + * Gets the value of connectionPoolDataSource. This method will return null, if the backing datasource is being + * accessed via jndi. * * @return value of connectionPoolDataSource. */ @@ -530,8 +530,8 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable } /** - * Sets the backend ConnectionPoolDataSource. This property should not be set if using JNDI to access the - * data source. + * Sets the backend ConnectionPoolDataSource. This property should not be set if using jndi to access the + * datasource. * * @param v * Value to assign to connectionPoolDataSource. @@ -549,8 +549,8 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable } /** - * Gets the name of the ConnectionPoolDataSource which backs this pool. This name is used to look up the data source - * from a JNDI service provider. + * Gets the name of the ConnectionPoolDataSource which backs this pool. This name is used to look up the datasource + * from a jndi service provider. * * @return value of dataSourceName. */ @@ -559,8 +559,8 @@ public abstract class InstanceKeyDataSource implements DataSource, Referenceable } /** - * Sets the name of the ConnectionPoolDataSource which backs this pool. This name is used to look up the data source - * from a JNDI service provider. + * Sets the name of the ConnectionPoolDataSource which backs this pool. This name is used to look up the datasource + * from a jndi service provider. * * @param v * Value to assign to dataSourceName. diff --git a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java index f6ee923..ee68cd7 100644 --- a/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java +++ b/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java @@ -120,7 +120,7 @@ abstract class InstanceKeyDataSourceFactory implements ObjectFactory { if (isCorrectClass(ref.getClassName())) { final RefAddr refAddr = ref.get("instanceKey"); if (refAddr != null && refAddr.getContent() != null) { - // object was bound to JNDI via Referenceable API. + // object was bound to jndi via Referenceable api. obj = instanceMap.get(refAddr.getContent()); } else { // Tomcat JNDI creates a Reference out of server.xml diff --git a/src/test/java/org/apache/commons/dbcp2/TestJndi.java b/src/test/java/org/apache/commons/dbcp2/TestJndi.java index c9f5b27..6d5eb94 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestJndi.java +++ b/src/test/java/org/apache/commons/dbcp2/TestJndi.java @@ -43,12 +43,12 @@ public class TestJndi { protected static final String JNDI_SUBCONTEXT = "jdbc"; /** - * the full JNDI path to the data source. + * the full jndi path to the data source. */ protected static final String JNDI_PATH = JNDI_SUBCONTEXT + "/" + "jndiTestDataSource"; - /** JNDI context to use in tests **/ + /** jndi context to use in tests **/ protected Context context = null; /** @@ -97,7 +97,7 @@ public class TestJndi { } /** - * Binds a DataSource to the JNDI and checks that we have successfully + * Binds a DataSource to the jndi and checks that we have successfully * bound it by looking it up again. * * @throws Exception if the bind, lookup or connect fails @@ -108,7 +108,7 @@ public class TestJndi { } /** - * Binds a DataSource into JNDI. + * Binds a DataSource into jndi. * * @throws Exception if creation or binding fails. */ @@ -117,9 +117,9 @@ public class TestJndi { } /** - * Retrieves a DataSource from JNDI. + * Retrieves a DataSource from jndi. * - * @throws Exception if the JNDI lookup fails or no DataSource is bound. + * @throws Exception if the jndi lookup fails or no DataSource is bound. */ protected DataSource retrieveDataSource() throws Exception { final Context ctx = getInitialContext();