garydgregory commented on code in PR #312:
URL: https://github.com/apache/commons-dbcp/pull/312#discussion_r1368934365
##########
src/main/java/org/apache/commons/dbcp2/BasicDataSourceFactory.java:
##########
@@ -422,7 +422,7 @@ public Object getObjectInstance(final Object obj, final
Name name, final Context
private void validatePropertyNames(final Reference ref, final Name name,
final List<String> warnMessages,
final List<String> infoMessages) {
final String nameString = name != null ? "Name = " + name.toString() +
" " : "";
- if (NUPROP_WARNTEXT != null && !NUPROP_WARNTEXT.isEmpty()) {
+ if (!NUPROP_WARNTEXT.isEmpty()) {
Review Comment:
OK, but the `isEmpty()` is also superfluous. Now in git master.
##########
src/main/java/org/apache/commons/dbcp2/managed/DataSourceXAConnectionFactory.java:
##########
@@ -167,8 +167,8 @@ public Connection createConnection() throws SQLException {
}
// get the real connection and XAResource from the connection
- final Connection connection = xaConnection.getConnection();
final XAResource xaResource = xaConnection.getXAResource();
+ final Connection connection = xaConnection.getConnection();
Review Comment:
If the order matters, please document it in a comment. Does it?
##########
src/main/java/org/apache/commons/dbcp2/PoolingConnection.java:
##########
@@ -294,7 +295,10 @@ protected PStmtKey createKey(final String sql, final
String[] columnNames) {
@Override
public void destroyObject(final PStmtKey key, final
PooledObject<DelegatingPreparedStatement> pooledObject)
throws SQLException {
- pooledObject.getObject().getInnermostDelegate().close();
+ Statement s = pooledObject.getObject().getInnermostDelegate();
+ if (s != null) {
+ s.close();
Review Comment:
Hello @rmaucher
This needs a unit test.
##########
src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java:
##########
@@ -333,7 +334,10 @@ protected PStmtKey createKey(final String sql, final
String[] columnNames) {
@Override
public void destroyObject(final PStmtKey key, final
PooledObject<DelegatingPreparedStatement> pooledObject)
throws SQLException {
- pooledObject.getObject().getInnermostDelegate().close();
+ Statement s = pooledObject.getObject().getInnermostDelegate();
+ if (s != null) {
Review Comment:
This needs a unit test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]