Tagged DBCP 2.0.1 RC2.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/dbcp/tags/DBCP_2_0_1_RC2@1595370 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 94f4f55..c9d4f11 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,108 +1,30 @@
               Apache Apache Commons DBCP
-                  Version 2.0
+                  Version 2.0.1
                  RELEASE NOTES
 
-The Apache Commons DBCP team is pleased to announce the release of Apache Apache Commons DBCP 2.0
+The Apache Commons DBCP team is pleased to announce the release of Apache Apache Commons DBCP 2.0.1.
 
-Apache Commons DBCP software implements Database Connection Pooling
+Apache Commons DBCP software implements Database Connection Pooling.
 
-This release includes new features as well as bug fixes and enhancements.
-Version 2.0.x supports JDBC 4.1, so requires Java 7.
-
-The Java package name has been changed from 'org.apache.commons.dbcp' to 'org.apache.commons.dbcp2'.
-Also the Maven groupId is now 'org.apache.commons' and the artifactId is 'commons-dbcp2'
-These changes are necessary because the API is not strictly binary compatible with the 1.x releases.
-To convert from the earlier releases, update the package name in imports, update the dependencies and recompile.
-There may be a few other changes to be made (TBA)
-
-Java 6 users should use DBCP 1.4.x which supports JDBC 4.
-Java 1.4 and Java 5 users should use DBCP 1.3.x which supports JDBC 3.
-Applications running under Java 7 should use DBCP 2.0.x.
+This is a bug fix release.
 
 Changes in this version include:
 
-New features:
-o            Provide a new option (cacheState) to cache current values of autoCommit
-             and readOnly so database queries are not required for every call to the
-             associated getters. This option is enabled by default.
-o DBCP-292:  BasicDataSource instances are now exposed via JMX. All the configuration
-             properties are available as is the connection pool and the statement
-             pools (if statement pooling is enabled).
-o DBCP-368:  Expose the new Pool 2 property evictionPolicyClassName to enable more
-             sophisticated eviction strategies to be used.
-o DBCP-406:  Add support for pooling PreparedStatements that use auto-generated keys. Thanks to Steeve Beroard.
-o DBCP-177:  Enable DBCP to work with a SecurityManager such that only DBCP needs to
-             be granted the necessary permissions to communicate with the database.
-o DBCP-219:  Register pooled connections with JMX so that they may be forcibly closed
-             via JMX if required.
-o DBCP-373:  Modify SharedPoolDataSource and PerUserPoolDataSource to expose all of
-             the configuration properties of the underlying connection pool(s). This
-             represents a significant refactoring of these classes and a number of
-             property names have changed as a result.
-o DBCP-351:  Provide an option to control if autoCommit is always set to true when a
-             connection is returned to the connection pool.
-o DBCP-399:  Provide an option to control if rollback is called when a connection is
-             returned to the poll with autoCommit disabled.
-o DBCP-340:  Provide an option to set the default query timeout.
-o 249:    Add support for validation testing database connections on creation.
 
 Fixed Bugs:
-o DBCP-411:  BasicManagedDataSource - unregister from JMX on close().
-o DBCP-154:  Log validation failures of poolable connections.
-o DBCP-403:  DelegatingStatement.close() fails with NPE if statement is null
-o DBCP-322:  CPDSConnectionFactory.validateObject(Object) ignores Throwable.
-o DBCP-300:  Removed unnecessary synchronisation in BasicDataSource#createDataSource.
-o DBCP-384:  Fix threading issues with accessToUnderlyingConnectionAllowed attribute
-             of PoolingDriver which is used to support unit testing.
-o DBCP-376:  Fix thread safety issues in the SharedPoolDataSource and the
-             PerUserPoolDataSource. Thanks to Dave Oxley.
-o DBCP-382:  Allow accessToUnderlyingConnectionAllowed to be configured when
-             configuration takes place via JNDI in a JavaEE container. Thanks to Stefan Rempfer.
-o DBCP-369:  Fix threading issue when using multiple instances of the
-             SharedPoolDataSource concurrently. Thanks to Michael Pradel.
-o DBCP-391:  Ensure that the close state of a pooled connection and the underlying
-             connection is consistent when the underlying connection is closed as a
-             result of an error condition.
-o DBCP-404:  Make all mutable fields private.
-o DBCP-364:  Return BasicDataSource rather than DataSource from
-             BasicDataSourceFactory so a cast is not required to use BasicDataSource
-             specific methods.
-o DBCP-358:  The equals() implementations of the DelegatingXxx classes are now
-             symmetric. There are some important API changes underlying this fix.
-             Firstly, two DelegatingXxx instances are no longer considered equal if
-             they have the same innermost delegate. Secondly, a DelegatingXxx
-             instance is not considered equal to its innermost delegate. The
-             getInnermostDelegateInternal() method has been made public (but remains
-             part of the internal API) to allow classes extending this implementation
-             to access the innermost delegate when required.
-o DBCP-180:  Enable JDBC resources that are no longer referenced by client code to be
-             eligible for garbage collection.
-o DBCP-410:  Correct path to Javadoc overview in build.xml. Thanks to Andreas Sturmlechner.
-o DBCP-234:  The default values for readOnly, autoCommit and transactionIsolation are
-             now taken from the JDBC driver. No calls to setReadOnly(),
-             setAutoCommit() or setTransactionIsolation() will be made for a newly
-             borrowed connection unless a default is explicitly configured and the
-             connection is currently using a different setting.
-o            Connection.isValid() should not throw an SQLException if the connection
-             is closed.
-o DBCP-357:  Use Connection.isValid() to validate connections unless a validation
-             query is explicitly configured. Note that this means it is no longer
-             necessary for a validation query to be specified in order for validation
-             to take place. When testing with Oracle, this resulted in database
-             validation being approximately 7 times faster.
+o            Small performance improvements when returning connections to the pool.
+o DBCP-414:  Fixed DelegatingStatement close to ensure closed statements do not retain references
+             to pooled prepared statements. Due to finalization code added in 2.0, this was causing
+             pooled prepared statements to be closed by GC while in use by clients. Thanks to Pasi Eronen.
+o DBCP-417:  Fixed connection leak when managed connections are closed during transactions.
+o DBCP-418:  Enable PoolableConnection class to load without JMX.
 
 Changes:
-o            The Java package name has been changed from org.apache.commons.dbcp to
-             org.apache.commons.dbcp2.
-o            Update to Commons Pool 2 (based on java.util.concurrent) to provide
-             pooling functionality.
-o            Updated source code for Java 1.6 (added @Override & @Deprecated
-             annotations).
-o            Removed JOCL support.
-o DBCP-143:  Remove deprecated SQLNestedException.
+o DBCP-412:  Added check in PoolingDataSource constructor to ensure that the connection factory
+             and pool are properly linked.
 
 
 For complete information on Apache Commons DBCP, including instructions on how to submit bug reports,
 patches, or suggestions for improvement, see the Apache Apache Commons DBCP website:
 
-http://commons.apache.org/proper/commons-dbcp/
\ No newline at end of file
+http://commons.apache.org/proper/commons-dbcp/
diff --git a/build.xml b/build.xml
index ca1427b..da24dfc 100644
--- a/build.xml
+++ b/build.xml
@@ -45,7 +45,7 @@
 
       <property name="name" value="commons-dbcp2"/>
       <property name="title" value="Apache Commons Database Pooling Package"/>
-      <property name="version" value="2.0-SNAPSHOT"/>
+      <property name="version" value="2.0.1"/>
       <property name="package" value="org.apache.commons.dbcp2.*"/>
 
       <property name="build.dir" value="${basedir}/build"/>
diff --git a/dbcp-RC.sh b/dbcp-RC.sh
new file mode 100755
index 0000000..f12d27c
--- /dev/null
+++ b/dbcp-RC.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------------
+# Generates a pool RC and publishes (a superset of) maven artifacts to Nexus.
+# Should be run from top-level directory of a fresh checkout of the RC tag.
+#
+# Preconditions:
+# 0) dbcp-pre-RC has been run to update the download page and release notes
+#    and these have been checked in and included in the RC tag.
+# 1) Release artifacts from previous runs have been svn deleted from local
+#    svn pub/sub dev checkout.
+# 2) Nexus repo from previous RC has been dropped.
+#
+# $Revision$ $Date$
+# -----------------------------------------------------------------------------
+# Set script variables
+version=2.0.1
+repo_path=~/.m2/repository/org/apache/commons/commons-dbcp2/${version}
+release_path=~/dbcp-rc  #checkout of https://dist.apache.org/repos/dist/dev/commons/dbcp
+#
+# Delete any locally installed artifacts from previous runs
+rm -rf ${repo_path}
+echo "Cleaned maven repo."
+#
+# Generate site and release artifacts, deploy locally and upload to Nexus
+mvn clean site
+mvn deploy -Prelease
+#
+# Copy the zips/tarballs and release notes to the local svn pub path
+cp ${repo_path}/*bin.zip* ${release_path}/binaries
+cp ${repo_path}/*bin.tar.gz* ${release_path}/binaries
+cp ${repo_path}/*src.zip* ${release_path}/source
+cp ${repo_path}/*src.tar.gz* ${release_path}/source
+cp RELEASE-NOTES.txt ${release_path}
+
+echo "Release candidate complete."
+echo "svn add the generated artifacts and commit after inspection."
+echo "log in to repository.apache.org, manually (sic) drop the cruft and close the repo."
+
+
+
diff --git a/dbcp-pre-RC.sh b/dbcp-pre-RC.sh
new file mode 100755
index 0000000..b992bea
--- /dev/null
+++ b/dbcp-pre-RC.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------------
+#
+# Shell script to update download page and release notes prior
+# to preparing a commons pool release candidate.
+#
+# Note: RELEASE-NOTES.txt may need a little reformatting prior
+# to checkin.  Both RELEASE-NOTES.txt and the generated download
+# page need to be checked in after review.
+#
+# $Revision$ $Date$
+# ----------------------------------------------------------------------------
+version=2.0.1
+mvn changes:announcement-generate -Prelease-notes -Dchanges.version=${version}
+mvn commons:download-page -Dcommons.componentid=dbcp  # Override to get download_dbcp
diff --git a/dbcp-release.sh b/dbcp-release.sh
new file mode 100755
index 0000000..5a323c8
--- /dev/null
+++ b/dbcp-release.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------------
+# Performs the local svn steps necessary to publish a dbcp release.
+#
+# Preconditions:
+# 0) Successful release VOTE has completed, based on artifacts in rc_path
+#    (checkout of https://dist.apache.org/repos/dist/dev/commons/dbcp)
+# 1) release_path points to a local checkout of
+#     https://dist.apache.org/repos/dist/release/commons/dbcp
+# 2) RELEASE-NOTES.txt for the new release is in top level of rc_path
+#
+# NOTE: This script does not do any of the following:
+# 0) Commit the local changes to actually publish the artifacts
+# 1) Cleanup old versions in dist
+#
+# $Revision$ $Date$
+# -----------------------------------------------------------------------------
+# Set script variables
+version=2.0.1        # version being released
+last_version=2.0   # previous version, will be replaced in README.html
+rc_path=~/dbcp-rc  # checkout of https://dist.apache.org/repos/dist/dev/commons/pool
+release_path=~/dbcp-release #https://dist.apache.org/repos/dist/release/commons/pool
+#
+# Move release notes
+cp $rc_path/RELEASE-NOTES.txt $release_path
+svn rm $rc_path/RELEASE-NOTES.txt
+#
+# Update README.html
+sed -i "" "s/$last_version/$version/g" $release_path/README.html
+# OSX  ^^ required suffix
+#
+cp $release_path/README.html $release_path/source
+cp $release_path/README.html $release_path/binaries
+# ^^^^^^^^^^ Maybe we can toss these? ^^^^^^^
+#
+# Move release artifacts
+svn mv $rc_path/source/* $release_path/source
+svn mv $rc_path/binaries/* $release_path/binaries
+#
+echo "Local svn changes complete."
+echo "Inspect the files in $release_path and commit to publish the release."
+echo "Also remember to commit $rc_path to drop RC artifacts and svn rm"
+echo "obsolete artifacts from $release_path."
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 4cc55b8..6185fe8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-dbcp2</artifactId>
-  <version>2.0.1-SNAPSHOT</version>
+  <version>2.0.1</version>
   <name>Apache Commons DBCP</name>
 
   <inceptionYear>2001</inceptionYear>
@@ -218,7 +218,7 @@
     <maven.compiler.source>1.7</maven.compiler.source>
     <maven.compiler.target>1.7</maven.compiler.target>
     <commons.componentid>dbcp2</commons.componentid>
-    <commons.release.version>2.0</commons.release.version>
+    <commons.release.version>2.0.1</commons.release.version>
     <commons.release.desc>for JDBC 4.1 (Java 7.0+)</commons.release.desc>
     <commons.release.2.version>1.4</commons.release.2.version>
     <commons.release.2.desc>for JDBC 4 (Java 6.0)</commons.release.2.desc>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 37997df..f5ad789 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -60,7 +60,7 @@
      -->
 
   <body>
-    <release version="2.0.1" date="TBD" description="This is a bug fix release">
+    <release version="2.0.1" date="TBD" description="This is a bug fix release.">
       <action dev="markt" type="fix">
         Small performance improvements when returning connections to the pool.
       </action>
@@ -76,6 +76,9 @@
       <action issue="DBCP-417" dev="psteitz" type="fix">
         Fixed connection leak when managed connections are closed during transactions.
       </action>
+      <action issue="DBCP-418" dev="psteitz" type="fix">
+        Enable PoolableConnection class to load without JMX.
+      </action>
     </release>
     <release version="2.0" date="3 March 2014" description=
 "This release includes new features as well as bug fixes and enhancements.
diff --git a/src/changes/release-notes.vm b/src/changes/release-notes.vm
index 311726b..6a5a727 100644
--- a/src/changes/release-notes.vm
+++ b/src/changes/release-notes.vm
@@ -18,10 +18,10 @@
                   Version ${version}
                  RELEASE NOTES
 
-The ${developmentTeam} is pleased to announce the release of Apache ${project.name} ${version}
+The ${developmentTeam} is pleased to announce the release of Apache ${project.name} ${version}.
 
 $introduction.replaceAll("(?<!\015)\012", "
-").replaceAll("(?m)^ +","")
+").replaceAll("(?m)^ +","").
 
 ## N.B. the available variables are described here:
 ## http://maven.apache.org/plugins/maven-changes-plugin/examples/using-a-custom-announcement-template.html
@@ -104,4 +104,4 @@
 For complete information on ${project.name}, including instructions on how to submit bug reports,
 patches, or suggestions for improvement, see the Apache ${project.name} website:
 
-${project.url}
\ No newline at end of file
+${project.url}
diff --git a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
index 7116f38..83b2ee8 100644
--- a/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
+++ b/src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
@@ -45,7 +45,15 @@
 public class PoolableConnection extends DelegatingConnection<Connection>
         implements PoolableConnectionMXBean {
 
-    private static MBeanServer MBEAN_SERVER = ManagementFactory.getPlatformMBeanServer();
+    private static MBeanServer MBEAN_SERVER = null; 
+
+    static {
+        try {
+            MBEAN_SERVER = ManagementFactory.getPlatformMBeanServer();
+        } catch (Exception ex) {
+            // ignore - JMX not available
+        }
+    }
 
     /** The pool to which I should return. */
     private ObjectPool<PoolableConnection> _pool = null;
diff --git a/src/main/resources/org/apache/commons/dbcp2/LocalStrings.properties b/src/main/resources/org/apache/commons/dbcp2/LocalStrings.properties
index fd1674f..142342d 100644
--- a/src/main/resources/org/apache/commons/dbcp2/LocalStrings.properties
+++ b/src/main/resources/org/apache/commons/dbcp2/LocalStrings.properties
@@ -19,4 +19,5 @@
 
 swallowedExceptionLogger.onSwallowedException=An internal object pool swallowed an Exception
 
-poolingDataSource.factoryConfig="PoolableConnectionFactory not linked to pool. Calling setPool() to fix the configuration."
+poolingDataSource.factoryConfig=PoolableConnectionFactory not linked to pool. Calling setPool() to fix the configuration.
+
diff --git a/src/site/xdoc/download_dbcp.xml b/src/site/xdoc/download_dbcp.xml
index d6dde91..db47871 100644
--- a/src/site/xdoc/download_dbcp.xml
+++ b/src/site/xdoc/download_dbcp.xml
@@ -95,32 +95,32 @@
       </p>
     </subsection>
     </section>
-    <section name="Apache Commons DBCP 2.0 for JDBC 4.1 (Java 7.0+)">
+    <section name="Apache Commons DBCP 2.0.1 for JDBC 4.1 (Java 7.0+)">
       <subsection name="Binaries">
         <table>
           <tr>
-              <td><a href="[preferred]/commons/dbcp/binaries/commons-dbcp2-2.0-bin.tar.gz">commons-dbcp2-2.0-bin.tar.gz</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0-bin.tar.gz.md5">md5</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0-bin.tar.gz.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbcp/binaries/commons-dbcp2-2.0.1-bin.tar.gz">commons-dbcp2-2.0.1-bin.tar.gz</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0.1-bin.tar.gz.md5">md5</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0.1-bin.tar.gz.asc">pgp</a></td>
           </tr>
           <tr>
-              <td><a href="[preferred]/commons/dbcp/binaries/commons-dbcp2-2.0-bin.zip">commons-dbcp2-2.0-bin.zip</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0-bin.zip.md5">md5</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0-bin.zip.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbcp/binaries/commons-dbcp2-2.0.1-bin.zip">commons-dbcp2-2.0.1-bin.zip</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0.1-bin.zip.md5">md5</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/binaries/commons-dbcp2-2.0.1-bin.zip.asc">pgp</a></td>
           </tr>
         </table>
       </subsection>
       <subsection name="Source">
         <table>
           <tr>
-              <td><a href="[preferred]/commons/dbcp/source/commons-dbcp2-2.0-src.tar.gz">commons-dbcp2-2.0-src.tar.gz</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0-src.tar.gz.md5">md5</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0-src.tar.gz.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbcp/source/commons-dbcp2-2.0.1-src.tar.gz">commons-dbcp2-2.0.1-src.tar.gz</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0.1-src.tar.gz.md5">md5</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0.1-src.tar.gz.asc">pgp</a></td>
           </tr>
           <tr>
-              <td><a href="[preferred]/commons/dbcp/source/commons-dbcp2-2.0-src.zip">commons-dbcp2-2.0-src.zip</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0-src.zip.md5">md5</a></td>
-              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0-src.zip.asc">pgp</a></td>
+              <td><a href="[preferred]/commons/dbcp/source/commons-dbcp2-2.0.1-src.zip">commons-dbcp2-2.0.1-src.zip</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0.1-src.zip.md5">md5</a></td>
+              <td><a href="http://www.apache.org/dist/commons/dbcp/source/commons-dbcp2-2.0.1-src.zip.asc">pgp</a></td>
           </tr>
         </table>
       </subsection>