[tomcat] branch 7.0.x updated: Add PStmtKey from latest DBCP

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new f0fce33  Add PStmtKey from latest DBCP
f0fce33 is described below

commit f0fce337b20c303ba5a4db54312e8af75cd2abdf
Author: Mark Thomas 
AuthorDate: Fri Mar 22 20:59:53 2019 +

Add PStmtKey from latest DBCP

Deprecated code has been removed. This covers more fields as a result of
post-DBCP 2.0 fixes that should also be back-ported.
The code added in this commit is unused at this point.
---
 java/org/apache/tomcat/dbcp/dbcp/PStmtKey.java | 693 +
 .../apache/tomcat/dbcp/dbcp/PoolingConnection.java |   6 +
 2 files changed, 699 insertions(+)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/PStmtKey.java 
b/java/org/apache/tomcat/dbcp/dbcp/PStmtKey.java
new file mode 100644
index 000..0a44504
--- /dev/null
+++ b/java/org/apache/tomcat/dbcp/dbcp/PStmtKey.java
@@ -0,0 +1,693 @@
+/*
+ * 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.
+ */
+package org.apache.tomcat.dbcp.dbcp;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Arrays;
+
+import org.apache.tomcat.dbcp.dbcp.PoolingConnection.StatementType;
+
+/**
+ * A key uniquely identifying {@link java.sql.PreparedStatement 
PreparedStatement}s.
+ *
+ * @since 2.0
+ */
+public class PStmtKey {
+
+/**
+ * Builder for prepareCall(String sql).
+ */
+private class PreparedCallSQL implements StatementBuilder {
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareCall(sql);
+}
+}
+
+/**
+ * Builder for prepareCall(String sql, int resultSetType, int 
resultSetConcurrency).
+ */
+private class PreparedCallWithResultSetConcurrency implements 
StatementBuilder {
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareCall(sql, resultSetType.intValue(), 
resultSetConcurrency.intValue());
+}
+}
+
+/**
+ * Builder for prepareCall(String sql, int resultSetType, int 
resultSetConcurrency, int resultSetHoldability).
+ */
+private class PreparedCallWithResultSetHoldability implements 
StatementBuilder {
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareCall(sql, resultSetType.intValue(), 
resultSetConcurrency.intValue(),
+resultSetHoldability.intValue());
+}
+}
+
+/**
+ * Builder for prepareStatement(String sql).
+ */
+private class PreparedStatementSQL implements StatementBuilder {
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareStatement(sql);
+}
+}
+
+/**
+ * Builder for prepareStatement(String sql, int autoGeneratedKeys).
+ */
+private class PreparedStatementWithAutoGeneratedKeys implements 
StatementBuilder {
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareStatement(sql, 
autoGeneratedKeys.intValue());
+}
+}
+
+/**
+ * Builder for prepareStatement(String sql, int[] columnIndexes).
+ */
+private class PreparedStatementWithColumnIndexes implements 
StatementBuilder {
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareStatement(sql, columnIndexes);
+}
+}
+
+/**
+ * Builder for prepareStatement(String sql, String[] columnNames).
+ */
+private class PreparedStatementWithColumnNames implements StatementBuilder 
{
+@Override
+public Statement createStatement(final Connection connection) throws 
SQLException {
+return connection.prepareStatement(sql, columnNames);
+}

[tomcat] branch 7.0.x updated: Correct doubled words

2019-03-22 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new d923443  Correct doubled words
d923443 is described below

commit d923443f48b2b5c4e24f6f73b1cc01a0fcf38189
Author: Felix Schumacher 
AuthorDate: Fri Mar 22 18:08:23 2019 +0100

Correct doubled words

These are a few places where the following script found duplicated word:

 $ grep -rP '\b([a-z]\w+)\s+\1\b' webapps/
---
 RELEASE-NOTES   |  2 +-
 webapps/docs/changelog.xml  | 14 +++---
 webapps/examples/WEB-INF/classes/HelloWorldExample.java |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index d3fe912..43ea7ae 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -180,7 +180,7 @@ To enable and configue SSI support, please see the 
ssi-howto.html page.
 Security manager URLs:
 ==
 In order to grant security permissions to JARs located inside the
-web application repository, use URLs of of the following format
+web application repository, use URLs of the following format
 in your policy file:
 
 file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0499770..c1526fd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -815,7 +815,7 @@
   
 
   
-Log an error message if the AJP connector detects the the reverse proxy
+Log an error message if the AJP connector detects that the reverse 
proxy
 is sending AJP messages that are too large for the configured
 packetSize. (markt)
   
@@ -2057,7 +2057,7 @@
 
   
 Review those places where Tomcat re-encodes a URI or URI component and
-ensure that that correct encoding (path differs from query string) is
+ensure that the correct encoding (path differs from query string) is
 applied and that the encoding is applied consistently. (markt)
   
   
@@ -3438,7 +3438,7 @@
 examples web application. (markt)
   
   
-59229: Fix error in HTTP docs and make clear the the HTTP 
NIO
+59229: Fix error in HTTP docs and make clear that the HTTP 
NIO
 connector uses non-blocking I/O to read the HTTP request headers.
 (markt)
   
@@ -5623,7 +5623,7 @@
 client implementation. Patch provided by Niklas Hallqvist. (markt)
   
   
-57118: Ensure that that an EncodeException is
+57118: Ensure that an EncodeException is
 thrown by RemoteEndpoint.Basic.sendObject(Object) rather
 than an IOException when no suitable Encoder
 is configured for the given Object. (markt)
@@ -12332,7 +12332,7 @@
   
 The fix for bug 51310 caused a regression that re-introduced
 bug 49957 and deleted the contents of the work directory
-when Tomcat was shutdown. This fix ensures that that work directory for
+when Tomcat was shutdown. This fix ensures that the work directory for
 an application is not deleted when Tomcat is shutdown. (markt)
   
   
@@ -14174,7 +14174,7 @@
   
   
 50222: Modify memory leak prevention code so it pins the
-system class loader in memory rather than than the common class loader,
+system class loader in memory rather than the common class loader,
 which is better for embedded systems. Patch provided by Christopher
 Schultz. (markt)
   
@@ -14926,7 +14926,7 @@
   
   
 Update a few places in the docs where the Manager documentation 
referred
-to the old role name of manager rather than than the new 
manager-script.
+to the old role name of manager rather than the new manager-script.
 (markt)
   
 
diff --git a/webapps/examples/WEB-INF/classes/HelloWorldExample.java 
b/webapps/examples/WEB-INF/classes/HelloWorldExample.java
index b642aba..49b8601 100644
--- a/webapps/examples/WEB-INF/classes/HelloWorldExample.java
+++ b/webapps/examples/WEB-INF/classes/HelloWorldExample.java
@@ -54,7 +54,7 @@ public class HelloWorldExample extends HttpServlet {
 
 // note that all links are created to be relative. this
 // ensures that we can move the web application that this
-// servlet belongs to to a different place in the url
+// servlet belongs to a different place in the url
 // tree and not have any harmful side effects.
 
 // XXX


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Correct doubled words

2019-03-22 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new f897666  Correct doubled words
f897666 is described below

commit f8970abace814fc5aef8d64fe0afad235c41
Author: Felix Schumacher 
AuthorDate: Fri Mar 22 18:08:23 2019 +0100

Correct doubled words

These are a few places where the following script found duplicated word:

 $ grep -rP '\b([a-z]\w+)\s+\1\b' webapps/
---
 RELEASE-NOTES   | 2 +-
 webapps/docs/changelog.xml  | 4 ++--
 webapps/examples/WEB-INF/classes/HelloWorldExample.java | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 2a52a3d..d9cc4af 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -120,7 +120,7 @@ and putting them in the shared classloader instead (JARs 
should be put in the
 Security manager URLs:
 ==
 In order to grant security permissions to JARs located inside the
-web application repository, use URLs of of the following format
+web application repository, use URLs of the following format
 in your policy file:
 
 file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0fce5c0..dee1320 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -1244,7 +1244,7 @@
 Consistent exception propagation for NIO2 SSL close. (remm)
   
   
-Log an error message if the AJP connector detects the the reverse proxy
+Log an error message if the AJP connector detects that the reverse 
proxy
 is sending AJP messages that are too large for the configured
 packetSize. (markt)
   
@@ -3095,7 +3095,7 @@
 
   
 Review those places where Tomcat re-encodes a URI or URI component and
-ensure that that correct encoding (path differs from query string) is
+ensure that the correct encoding (path differs from query string) is
 applied and that the encoding is applied consistently. (markt)
   
   
diff --git a/webapps/examples/WEB-INF/classes/HelloWorldExample.java 
b/webapps/examples/WEB-INF/classes/HelloWorldExample.java
index 1a5ea5a..4a75a4d 100644
--- a/webapps/examples/WEB-INF/classes/HelloWorldExample.java
+++ b/webapps/examples/WEB-INF/classes/HelloWorldExample.java
@@ -56,7 +56,7 @@ public class HelloWorldExample extends HttpServlet {
 
 // note that all links are created to be relative. this
 // ensures that we can move the web application that this
-// servlet belongs to to a different place in the url
+// servlet belongs to a different place in the url
 // tree and not have any harmful side effects.
 
 // XXX


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53930] allow capture of catalina stdout/stderr to a command instead of just a file [PATCH]

2019-03-22 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=53930

Mark Thomas  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |WONTFIX

--- Comment #9 from Mark Thomas  ---
The breakage for systemd users is of greater impact to the community than the
lack of ability to pipe to a process.

Therefore, there having been no further input I am proceeding with option 2 and
closing this as WONTFIX with the recommendation to use a named pipe if you need
this feature.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Correct doubled words

2019-03-22 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 1c69b25  Correct doubled words
1c69b25 is described below

commit 1c69b2528790d40569f4b4b034c184ee21ccaea1
Author: Felix Schumacher 
AuthorDate: Fri Mar 22 18:08:23 2019 +0100

Correct doubled words

These are a few places where the following script found duplicated word:

 $ grep -rP '\b([a-z]\w+)\s+\1\b' webapps/
---
 RELEASE-NOTES   | 2 +-
 webapps/docs/changelog.xml  | 6 +++---
 webapps/examples/WEB-INF/classes/HelloWorldExample.java | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index a6ced8c..2377d4f 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -115,7 +115,7 @@ and putting them in the shared classloader instead (JARs 
should be put in the
 Security manager URLs:
 ==
 In order to grant security permissions to JARs located inside the
-web application repository, use URLs of of the following format
+web application repository, use URLs of the following format
 in your policy file:
 
 file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0f39d60..5c5331c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -608,7 +608,7 @@
   
 Add dns-ping support to enumerate cluster members. This is much simpler
 than getting the pod list but it does not indicate pod status.
-Submitted by by Maxime Beck. (remm)
+Submitted by Maxime Beck. (remm)
   
   
 Never expire the local member from a Membership. (remm)
@@ -1678,7 +1678,7 @@
 Followup sync fix for NIO2 async IO blocking read/writes. (remm)
   
   
-Log an error message if the AJP connector detects the the reverse proxy
+Log an error message if the AJP connector detects that the reverse 
proxy
 is sending AJP messages that are too large for the configured
 packetSize. (markt)
   
@@ -3798,7 +3798,7 @@
 
   
 Review those places where Tomcat re-encodes a URI or URI component and
-ensure that that correct encoding (path differs from query string) is
+ensure that the correct encoding (path differs from query string) is
 applied and that the encoding is applied consistently. (markt)
   
   
diff --git a/webapps/examples/WEB-INF/classes/HelloWorldExample.java 
b/webapps/examples/WEB-INF/classes/HelloWorldExample.java
index 1a5ea5a..4a75a4d 100644
--- a/webapps/examples/WEB-INF/classes/HelloWorldExample.java
+++ b/webapps/examples/WEB-INF/classes/HelloWorldExample.java
@@ -56,7 +56,7 @@ public class HelloWorldExample extends HttpServlet {
 
 // note that all links are created to be relative. this
 // ensures that we can move the web application that this
-// servlet belongs to to a different place in the url
+// servlet belongs to a different place in the url
 // tree and not have any harmful side effects.
 
 // XXX


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Is it possible to modify the commit email template?

2019-03-22 Thread Mark Thomas
You'll need to talk to infra. If you provide a patch I suspect it would
be accepted gratefully.

Mark


On 22/03/2019 16:40, Igal Sapir wrote:
> Is it possible to add a URL to the commit email templates so that it's
> easier to see the diff?
> 
> For example, the email titled "[tomcat] branch 7.0.x updated: Generics:
> BasicDataSource" has a commit hash of 153757518621f906d3a223836b8d80
> 
> If we could prefix it as below it can become a link to a colorful diff
> which is much easier to read than the one in the email:
> 
> https://gitbox.apache.org/repos/asf?p=tomcat.git;a=commitdiff;h=153757518621f906d3a223836b8d80
> 
> Thanks,
> 
> Igal
> 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Is it possible to modify the commit email template?

2019-03-22 Thread Igal Sapir
Is it possible to add a URL to the commit email templates so that it's
easier to see the diff?

For example, the email titled "[tomcat] branch 7.0.x updated: Generics:
BasicDataSource" has a commit hash of 153757518621f906d3a223836b8d80

If we could prefix it as below it can become a link to a colorful diff
which is much easier to read than the one in the email:

https://gitbox.apache.org/repos/asf?p=tomcat.git;a=commitdiff;h=153757518621f906d3a223836b8d80

Thanks,

Igal


Re: [tomcat] branch master updated: Add optional listeners for Server/Listener

2019-03-22 Thread Rémy Maucherat
On Fri, Mar 22, 2019 at 10:12 AM  wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> remm pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
>  new 407d805  Add optional listeners for Server/Listener
> 407d805 is described below
>
> commit 407d805f1772ae1dd03b6ffbac03be83f55c406b
> Author: remm 
> AuthorDate: Fri Mar 22 10:11:57 2019 +0100
>
> Add optional listeners for Server/Listener
>
> It is a very slight variant of a standard listener. The difference is
> that loading is not fatal when it fails. This would allow adding
> example
> configuration to the standard server.xml if deemed useful (example:
> CDI).
> Storeconfig will not attempt to persist the new listener at this time.
> The dummy listener object includes the necessary information, just in
> case, to hold on the properties and original className.
>

For maximum flexibility, I was planning to add service loader support, but
this then causes difficulties for overriding or avoiding to use a listener.
Maybe it is best to not do it.

Rémy


[tomcat] branch 7.0.x updated: Generics: Remaining low hanging fruit

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 39dc17a  Generics: Remaining low hanging fruit
39dc17a is described below

commit 39dc17a811ddbac92d74f784ade64052769595a3
Author: Mark Thomas 
AuthorDate: Fri Mar 22 11:55:05 2019 +

Generics: Remaining low hanging fruit
---
 java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/DriverAdapterCPDS.java | 2 +-
 .../apache/tomcat/dbcp/dbcp/cpdsadapter/PooledConnectionImpl.java   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/DriverAdapterCPDS.java 
b/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/DriverAdapterCPDS.java
index d332bc5..24d1d2c 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/DriverAdapterCPDS.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/DriverAdapterCPDS.java
@@ -278,7 +278,7 @@ public class DriverAdapterCPDS
  */
 @Override
 public Object getObjectInstance(Object refObj, Name name,
-Context context, Hashtable env)
+Context context, Hashtable env)
 throws Exception {
 // The spec says to return null if we can't create an instance
 // of the reference
diff --git 
a/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/PooledConnectionImpl.java 
b/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/PooledConnectionImpl.java
index 8dfcc5b..03d9a91 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/PooledConnectionImpl.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/cpdsadapter/PooledConnectionImpl.java
@@ -62,12 +62,12 @@ class PooledConnectionImpl
 /**
  * ConnectionEventListeners
  */
-private final Vector eventListeners;
+private final Vector eventListeners;
 
 /**
  * StatementEventListeners
  */
-private final Vector statementEventListeners = new Vector();
+private final Vector statementEventListeners = new 
Vector();
 
 /**
  * flag set to true, once close() is called.
@@ -95,7 +95,7 @@ class PooledConnectionImpl
 } else {
 this.delegatingConnection = new DelegatingConnection(connection);
 }
-eventListeners = new Vector();
+eventListeners = new Vector();
 isClosed = false;
 if (pool != null) {
 pstmtPool = pool;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Generics: BasicDataSource excluding the statement pool

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 744c87b  Generics: BasicDataSource excluding the statement pool
744c87b is described below

commit 744c87b973c74439e8b033b3e1a84741b7f39027
Author: Mark Thomas 
AuthorDate: Fri Mar 22 11:51:21 2019 +

Generics: BasicDataSource excluding the statement pool
---
 .../apache/tomcat/dbcp/dbcp/BasicDataSource.java   |   4 +-
 .../dbcp/dbcp/PoolableConnectionFactory.java   | 157 ++---
 2 files changed, 76 insertions(+), 85 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
index 585cff5..48fc6d1 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
@@ -1726,9 +1726,9 @@ public class BasicDataSource implements DataSource {
 }
 
 protected static void validateConnectionFactory(PoolableConnectionFactory 
connectionFactory) throws Exception {
-Connection conn = null;
+PoolableConnection conn = null;
 try {
-conn = (Connection) connectionFactory.makeObject();
+conn = connectionFactory.makeObject();
 connectionFactory.activateObject(conn);
 connectionFactory.validateConnection(conn);
 connectionFactory.passivateObject(conn);
diff --git a/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java 
b/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java
index 6642689..9406365 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java
@@ -23,6 +23,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.Iterator;
+
 import org.apache.tomcat.dbcp.pool.KeyedObjectPool;
 import org.apache.tomcat.dbcp.pool.KeyedObjectPoolFactory;
 import org.apache.tomcat.dbcp.pool.PoolableObjectFactory;
@@ -37,7 +38,7 @@ import org.apache.tomcat.dbcp.pool.ObjectPool;
  * @author James House
  * @author Dirk Verbeeck
  */
-public class PoolableConnectionFactory implements PoolableObjectFactory {
+public class PoolableConnectionFactory implements 
PoolableObjectFactory {
 /**
  * Create a new PoolableConnectionFactory.
  * @param connFactory the {@link ConnectionFactory} from which to obtain 
base {@link Connection}s
@@ -47,7 +48,8 @@ public class PoolableConnectionFactory implements 
PoolableObjectFactory {
  * @param defaultReadOnly the default "read only" setting for borrowed 
{@link Connection}s
  * @param defaultAutoCommit the default "auto commit" setting for returned 
{@link Connection}s
  */
-public PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool 
pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean 
defaultReadOnly, boolean defaultAutoCommit) {
+public PoolableConnectionFactory(ConnectionFactory connFactory, 
ObjectPool pool,
+KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, 
boolean defaultReadOnly, boolean defaultAutoCommit) {
 _connFactory = connFactory;
 _pool = pool;
 _pool.setFactory(this);
@@ -68,7 +70,8 @@ public class PoolableConnectionFactory implements 
PoolableObjectFactory {
  * @param defaultAutoCommit the default "auto commit" setting for returned 
{@link Connection}s
  * @since 1.3
  */
-public PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool 
pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, 
Collection connectionInitSqls, boolean defaultReadOnly, boolean 
defaultAutoCommit) {
+public PoolableConnectionFactory(ConnectionFactory connFactory, 
ObjectPool pool,
+KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, 
Collection connectionInitSqls, boolean defaultReadOnly, boolean 
defaultAutoCommit) {
 _connFactory = connFactory;
 _pool = pool;
 _pool.setFactory(this);
@@ -78,7 +81,7 @@ public class PoolableConnectionFactory implements 
PoolableObjectFactory {
 _defaultReadOnly = defaultReadOnly ? Boolean.TRUE : Boolean.FALSE;
 _defaultAutoCommit = defaultAutoCommit;
 }
-
+
 /**
  * Create a new PoolableConnectionFactory.
  * @param connFactory the {@link ConnectionFactory} from which to obtain 
base {@link Connection}s
@@ -90,7 +93,8 @@ public class PoolableConnectionFactory implements 
PoolableObjectFactory {
  * @param defaultAutoCommit the default "auto commit" setting for returned 
{@link Connection}s
  * @since 1.3
  */
-public PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool 
pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, 

[tomcat] branch 7.0.x updated: Generics: BasicDataSource

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 1537575  Generics: BasicDataSource
1537575 is described below

commit 153757518621f906d3a223836b8d803770481550
Author: Mark Thomas 
AuthorDate: Fri Mar 22 11:38:39 2019 +

Generics: BasicDataSource
---
 .../apache/tomcat/dbcp/dbcp/BasicDataSource.java   | 38 +++---
 .../tomcat/dbcp/dbcp/BasicDataSourceFactory.java   | 25 +++---
 2 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
index 6fe2488..585cff5 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
@@ -978,7 +978,7 @@ public class BasicDataSource implements DataSource {
  *
  * @since 1.3
  */
-protected volatile List connectionInitSqls;
+protected volatile List connectionInitSqls;
 
 /**
  * Returns the list of SQL statements executed when a physical connection
@@ -988,10 +988,10 @@ public class BasicDataSource implements DataSource {
  * @return initialization SQL statements
  * @since 1.3
  */
-public Collection getConnectionInitSqls() {
-Collection result = connectionInitSqls;
+public Collection getConnectionInitSqls() {
+Collection result = connectionInitSqls;
 if (result == null) {
-return Collections.EMPTY_LIST;
+return Collections.emptyList();
 }
 return result;
 }
@@ -1008,17 +1008,16 @@ public class BasicDataSource implements DataSource {
  * @param connectionInitSqls Collection of SQL statements to execute
  * on connection creation
  */
-public void setConnectionInitSqls(Collection connectionInitSqls) {
+public void setConnectionInitSqls(Collection connectionInitSqls) {
 if ((connectionInitSqls != null) && (connectionInitSqls.size() > 0)) {
-ArrayList newVal = null;
-for (Iterator iterator = connectionInitSqls.iterator();
+ArrayList newVal = null;
+for (Iterator iterator = connectionInitSqls.iterator();
 iterator.hasNext();) {
-Object o = iterator.next();
-if (o != null) {
-String s = o.toString();
+String s = iterator.next();
+if (s != null) {
 if (s.trim().length() > 0) {
 if (newVal == null) {
-newVal = new ArrayList();
+newVal = new ArrayList();
 }
 newVal.add(s);
 }
@@ -1067,7 +1066,7 @@ public class BasicDataSource implements DataSource {
 /**
  * The object pool that internally manages our connections.
  */
-protected volatile GenericObjectPool connectionPool = null;
+protected volatile GenericObjectPool connectionPool = 
null;
 
 /**
  * The connection properties that will be sent to our JDBC driver when
@@ -1396,7 +1395,7 @@ public class BasicDataSource implements DataSource {
  */
 public synchronized void close() throws SQLException {
 closed = true;
-GenericObjectPool oldpool = connectionPool;
+GenericObjectPool oldpool = connectionPool;
 connectionPool = null;
 dataSource = null;
 try {
@@ -1550,7 +1549,7 @@ public class BasicDataSource implements DataSource {
  */
 protected ConnectionFactory createConnectionFactory() throws SQLException {
 // Load the JDBC driver class
-Class driverFromCCL = null;
+Class driverFromCCL = null;
 if (driverClassName != null) {
 try {
 try {
@@ -1634,12 +1633,12 @@ public class BasicDataSource implements DataSource {
  */
 protected void createConnectionPool() {
 // Create an object pool to contain our active connections
-GenericObjectPool gop;
+GenericObjectPool gop;
 if ((abandonedConfig != null) && 
(abandonedConfig.getRemoveAbandoned())) {
-gop = new AbandonedObjectPool(null,abandonedConfig);
+gop = new 
AbandonedObjectPool(null,abandonedConfig);
 }
 else {
-gop = new GenericObjectPool();
+gop = new GenericObjectPool();
 }
 gop.setMaxActive(maxActive);
 gop.setMaxIdle(maxIdle);
@@ -1658,7 +1657,7 @@ public class BasicDataSource implements DataSource {
  * Closes the connection pool, silently swallowing any exception that 
occurs.
  */
 private void closeConnectionPool() {
-GenericObjectPool oldpool = connectionPool;
+GenericObjectPool oldpool = connectionPool;
 

Re: Tomcat 7, DBCP 1.x and generics

2019-03-22 Thread Mark Thomas
On 20/03/2019 15:44, Igal Sapir wrote:
> On 3/19/2019 6:34 AM, Mark Thomas wrote:
>> On 19/03/2019 04:04, Igal Sapir wrote:
>>> On 3/18/2019 1:28 PM, Mark Thomas wrote:
 All,

 I started to work on cleaning up the DBCP generics warnings in 7.0.x
 before I remembered what "fun" it was when I did this for DBCP2.
 While some of it is straight-forward, some of it requires some
 refactoring. From memory, the refactoring did fix a few bugs along
 the way.

 Given that the changes aren't trivial, I wanted to get some feedback
 from the community as to the best approach here. Options include:

 a) No nothing

 b) Fix the trivial generics

 c) Fix all the generics including any necessary refactoring
>>>
>>> I actually enjoy refactoring code so I'd be happy to help with (b) or
>>> (c) if either is chosen.
>>
>> Thanks. I'll leave the thread open for a few days to see what folks
>> think.
>>
>> I have a lot of the trivial fixes sat in a local branch so it will be
>> the 'fun' ones that will need to be completed.
> 
> Sounds good.
> 
> Working on tasks like that will make me more familiar with the source
> code and prepare me for tackling bigger issues in the future, so it can
> be beneficial beyond just completing the tasks.

No-one else spoke up and I am one of those people who prefers to see
warning free code (mainly because when I get things wrong the warnings
that appear help me figure out I did something wrong) so I've gone ahead
and applied the 'easy' generics fixes I had locally.

>From memory, code the went anywhere near PStmtKey (and there are two of
them just for fun) got quite tricky to add generics to. If you want an
interesting problem to tackle that might be a good place to start. I
have been using the equivalent code in the DBCP 2.0 tag as a guide.

I planning on working on this as well as time allows. I'll commit
regularly to reduce the change of duplicating effort.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Generics: JOCL

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 5aa7b67  Generics: JOCL
5aa7b67 is described below

commit 5aa7b67648bba99037133b79d731ae6c7cc573c2
Author: Mark Thomas 
AuthorDate: Fri Mar 22 11:13:23 2019 +

Generics: JOCL
---
 .../apache/tomcat/dbcp/jocl/ConstructorUtil.java   | 15 
 .../tomcat/dbcp/jocl/JOCLContentHandler.java   | 44 +++---
 2 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/jocl/ConstructorUtil.java 
b/java/org/apache/tomcat/dbcp/jocl/ConstructorUtil.java
index b4cee2f..2bc9cba 100644
--- a/java/org/apache/tomcat/dbcp/jocl/ConstructorUtil.java
+++ b/java/org/apache/tomcat/dbcp/jocl/ConstructorUtil.java
@@ -5,9 +5,9 @@
  * 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.
@@ -36,11 +36,11 @@ public class ConstructorUtil {
  * if no such Constructor can be found.
  * @see #invokeConstructor
  */
-public static Constructor getConstructor(Class type, Class[] argTypes) {
+public static  Constructor getConstructor(Class type, Class[] 
argTypes) {
 if(null == type || null == argTypes) {
 throw new NullPointerException();
 }
-Constructor ctor = null;
+Constructor ctor = null;
 try {
 ctor = type.getConstructor(argTypes);
 } catch(Exception e) {
@@ -51,9 +51,10 @@ public class ConstructorUtil {
 // look for something that will work
 // XXX this should really be more careful to
 // adhere to the jls mechanism for late binding
-Constructor[] ctors = type.getConstructors();
+@SuppressWarnings("unchecked")
+Constructor[] ctors = (Constructor[]) type.getConstructors();
 for(int i=0;i[] paramtypes = ctors[i].getParameterTypes();
 if(paramtypes.length == argTypes.length) {
 boolean canuse = true;
 for(int j=0;j T invokeConstructor(Class type, Class[] argTypes, 
Object[] argValues) throws InstantiationException, IllegalAccessException, 
InvocationTargetException {
 return 
ConstructorUtil.getConstructor(type,argTypes).newInstance(argValues);
 }
 }
diff --git a/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java 
b/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java
index f05136d..f8a8766 100644
--- a/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java
+++ b/java/org/apache/tomcat/dbcp/jocl/JOCLContentHandler.java
@@ -5,9 +5,9 @@
  * 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.
@@ -379,8 +379,8 @@ public class JOCLContentHandler extends DefaultHandler {
  * Clears all the values and types in my list.
  */
 public void clear() {
-_typeList = new ArrayList();
-_valueList = new ArrayList();
+_typeList = new ArrayList>();
+_valueList = new ArrayList();
 }
 
 /**
@@ -394,8 +394,8 @@ public class JOCLContentHandler extends DefaultHandler {
 /**
  * Returns the type of the object at the specified index.
  */
-public Class getType(int i) {
-return(Class)(_typeList.get(i));
+public Class getType(int i) {
+return _typeList.get(i);
 }
 
 /**
@@ -499,8 +499,8 @@ public class JOCLContentHandler extends DefaultHandler {
 } else {
 _cur.addArgument(temp.getType(),temp.createObject());
 }
-} 
-/* 
+}
+/*
 else if(ELT_BOOLEAN.equals(localName)) {
 // nothing to do here
 } else if(ELT_BYTE.equals(localName)) {
@@ -544,7 +544,7 @@ public class JOCLContentHandler extends DefaultHandler {
  * @see #_acceptEmptyNamespaceForElements
  * @see #_acceptJoclPrefixForElements
  */
-protected boolean isJoclNamespace(String uri, String 

[tomcat] branch 7.0.x updated: Generics: AbandonedObjectPool

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 858ead0  Generics: AbandonedObjectPool
858ead0 is described below

commit 858ead0fa9facb2083afecdf97cc09875823f4ac
Author: Mark Thomas 
AuthorDate: Fri Mar 22 11:02:10 2019 +

Generics: AbandonedObjectPool
---
 .../tomcat/dbcp/dbcp/AbandonedObjectPool.java  | 50 +++---
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java 
b/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java
index 5cd5e5d..983ed3d 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/AbandonedObjectPool.java
@@ -5,9 +5,9 @@
  * 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.
@@ -29,20 +29,20 @@ import org.apache.tomcat.dbcp.pool.impl.GenericObjectPool;
  * tracks JDBC connections and can recover abandoned db connections.
  * If logAbandoned=true, a stack trace will be printed for any
  * abandoned db connections recovered.
- *
+ *
  * @author Glenn L. Nielsen
  */
-public class AbandonedObjectPool extends GenericObjectPool {
+public class AbandonedObjectPool extends 
GenericObjectPool {
 
-/** 
- * DBCP AbandonedConfig 
+/**
+ * DBCP AbandonedConfig
  */
 private final AbandonedConfig config;
-
+
 /**
  * A list of connections in use
  */
-private final List trace = new ArrayList();
+private final List trace = new ArrayList();
 
 /**
  * Create an ObjectPool which tracks db connections.
@@ -50,7 +50,7 @@ public class AbandonedObjectPool extends GenericObjectPool {
  * @param factory PoolableObjectFactory used to create this
  * @param config configuration for abandoned db connections
  */
-public AbandonedObjectPool(PoolableObjectFactory factory,
+public AbandonedObjectPool(PoolableObjectFactory factory,
AbandonedConfig config) {
 super(factory);
 this.config = config;
@@ -63,22 +63,22 @@ public class AbandonedObjectPool extends GenericObjectPool {
  * have been idle > removeAbandonedTimeout and
  * getNumActive() > getMaxActive() - 3 and
  * getNumIdle() < 2
- * 
+ *
  * @return Object JDBC Connection
- * @throws Exception if an exception occurs retrieving a 
+ * @throws Exception if an exception occurs retrieving a
  * connection from the pool
  */
 @Override
-public Object borrowObject() throws Exception {
+public T borrowObject() throws Exception {
 if (config != null
 && config.getRemoveAbandoned()
 && (getNumIdle() < 2)
 && (getNumActive() > getMaxActive() - 3) ) {
 removeAbandoned();
 }
-Object obj = super.borrowObject();
-if (obj instanceof AbandonedTrace) {
-((AbandonedTrace) obj).setStackTrace();
+T obj = super.borrowObject();
+if (obj != null) {
+obj.setStackTrace();
 }
 if (obj != null && config != null && config.getRemoveAbandoned()) {
 synchronized (trace) {
@@ -96,7 +96,7 @@ public class AbandonedObjectPool extends GenericObjectPool {
  * to the pool
  */
 @Override
-public void returnObject(Object obj) throws Exception {
+public void returnObject(T obj) throws Exception {
 if (config != null && config.getRemoveAbandoned()) {
 synchronized (trace) {
 boolean foundObject = trace.remove(obj);
@@ -115,7 +115,7 @@ public class AbandonedObjectPool extends GenericObjectPool {
  * @throws Exception if an exception occurs invalidating the object
  */
 @Override
-public void invalidateObject(Object obj) throws Exception {
+public void invalidateObject(T obj) throws Exception {
 if (config != null && config.getRemoveAbandoned()) {
 synchronized (trace) {
 boolean foundObject = trace.remove(obj);
@@ -124,7 +124,7 @@ public class AbandonedObjectPool extends GenericObjectPool {
 }
 }
 }
-super.invalidateObject(obj);
+super.invalidateObject(obj);
 }
 
 /**
@@ -135,11 +135,11 @@ public class AbandonedObjectPool extends 

[tomcat] branch 7.0.x updated: Generics: Properties

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new ba9c387  Generics: Properties
ba9c387 is described below

commit ba9c3875a520a1b766902ba71555a769ac27
Author: Mark Thomas 
AuthorDate: Fri Mar 22 10:54:24 2019 +

Generics: Properties
---
 .../tomcat/dbcp/dbcp/BasicDataSourceFactory.java   | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.java 
b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.java
index 2ae9282..d5629a9 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSourceFactory.java
@@ -5,9 +5,9 @@
  * 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.
@@ -134,7 +134,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
  */
 @Override
 public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-Hashtable environment)
+Hashtable environment)
 throws Exception {
 
 // We only know how to deal with javax.naming.References
@@ -163,7 +163,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
 /**
  * Creates and configures a {@link BasicDataSource} instance based on the
  * given properties.
- * 
+ *
  * @param properties the datasource configuration properties
  * @throws Exception if an error occurs creating the data source
  */
@@ -226,7 +226,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
 if (value != null) {
 dataSource.setLifo(Boolean.valueOf(value).booleanValue());
 }
-
+
 value = properties.getProperty(PROP_MAXACTIVE);
 if (value != null) {
 dataSource.setMaxActive(Integer.parseInt(value));
@@ -276,7 +276,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
 if (value != null) {
 dataSource.setMinEvictableIdleTimeMillis(Long.parseLong(value));
 }
-
+
 value = properties.getProperty(PROP_SOFTMINEVICTABLEIDLETIMEMILLIS);
 if (value != null) {
 
dataSource.setSoftMinEvictableIdleTimeMillis(Long.parseLong(value));
@@ -311,7 +311,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
 if (value != null) {
 dataSource.setValidationQueryTimeout(Integer.parseInt(value));
 }
-
+
 value = 
properties.getProperty(PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED);
 if (value != null) {
 
dataSource.setAccessToUnderlyingConnectionAllowed(Boolean.valueOf(value).booleanValue());
@@ -323,7 +323,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
 }
 
 value = properties.getProperty(PROP_REMOVEABANDONEDTIMEOUT);
-if (value != null) { 
+if (value != null) {
 dataSource.setRemoveAbandonedTimeout(Integer.parseInt(value));
 }
 
@@ -351,7 +351,7 @@ public class BasicDataSourceFactory implements 
ObjectFactory {
 value = properties.getProperty(PROP_CONNECTIONPROPERTIES);
 if (value != null) {
   Properties p = getProperties(value);
-  Enumeration e = p.propertyNames();
+  Enumeration e = p.propertyNames();
   while (e.hasMoreElements()) {
 String propertyName = (String) e.nextElement();
 dataSource.addConnectionProperty(propertyName, 
p.getProperty(propertyName));


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated (d2b9172 -> 6292cf5)

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from d2b9172  Generics: Datasources
 new a132f36  Generics: PoolingDataSource
 new 6292cf5  Generics: PoolableXxx

The 11932 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/tomcat/dbcp/dbcp/PoolableCallableStatement.java  | 12 +++-
 java/org/apache/tomcat/dbcp/dbcp/PoolableConnection.java| 10 +-
 .../apache/tomcat/dbcp/dbcp/PoolablePreparedStatement.java  | 13 +++--
 java/org/apache/tomcat/dbcp/dbcp/PoolingDataSource.java | 10 +-
 4 files changed, 24 insertions(+), 21 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated (4819646 -> d2b9172)

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 4819646  Generics: DataSource factories
 new e8191eb  Generics: PoolingDriver
 new d2b9172  Generics: Datasources

The 11930 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/tomcat/dbcp/dbcp/PoolingDriver.java | 28 -
 .../dbcp/datasources/PerUserPoolDataSource.java| 67 +++---
 .../datasources/PerUserPoolDataSourceFactory.java  | 30 +-
 .../dbcp/datasources/SharedPoolDataSource.java |  7 ++-
 4 files changed, 68 insertions(+), 64 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Generics: DataSource factories

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 4819646  Generics: DataSource factories
4819646 is described below

commit 48196467ca0a5a9624c14cdcece222490894f34e
Author: Mark Thomas 
AuthorDate: Mon Mar 18 15:17:07 2019 +

Generics: DataSource factories
---
 .../dbcp/datasources/CPDSConnectionFactory.java| 136 
 .../dbcp/datasources/InstanceKeyObjectFactory.java |  27 ++--
 .../datasources/KeyedCPDSConnectionFactory.java| 180 ++---
 3 files changed, 164 insertions(+), 179 deletions(-)

diff --git 
a/java/org/apache/tomcat/dbcp/dbcp/datasources/CPDSConnectionFactory.java 
b/java/org/apache/tomcat/dbcp/dbcp/datasources/CPDSConnectionFactory.java
index a959de5..47bc497 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/datasources/CPDSConnectionFactory.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/datasources/CPDSConnectionFactory.java
@@ -40,7 +40,7 @@ import org.apache.tomcat.dbcp.pool.PoolableObjectFactory;
  * @author John D. McNally
  */
 class CPDSConnectionFactory
-implements PoolableObjectFactory, ConnectionEventListener, 
PooledConnectionManager {
+implements PoolableObjectFactory, 
ConnectionEventListener, PooledConnectionManager {
 
 private static final String NO_KEY_MESSAGE
 = "close() was called on a Connection, but "
@@ -49,7 +49,7 @@ class CPDSConnectionFactory
 private final ConnectionPoolDataSource _cpds;
 private final String _validationQuery;
 private final boolean _rollbackAfterValidation;
-private final ObjectPool _pool;
+private final ObjectPool _pool;
 private String _username = null;
 private String _password = null;
 
@@ -57,12 +57,13 @@ class CPDSConnectionFactory
  * Map of PooledConnections for which close events are ignored.
  * Connections are muted when they are being validated.
  */
-private final Map /*  */ validatingMap = new 
HashMap();
+private final Map  validatingMap = new 
HashMap();
 
 /**
  * Map of PooledConnectionAndInfo instances
  */
-private final WeakHashMap /*  
*/ pcMap = new WeakHashMap();
+private final WeakHashMap  
pcMap =
+new WeakHashMap();
 
 /**
  * Create a new PoolableConnectionFactory.
@@ -78,7 +79,7 @@ class CPDSConnectionFactory
  * @param password
  */
 public CPDSConnectionFactory(ConnectionPoolDataSource cpds,
- ObjectPool pool,
+ ObjectPool pool,
  String validationQuery,
  String username,
  String password) {
@@ -101,7 +102,7 @@ class CPDSConnectionFactory
  * @param password
  */
  public CPDSConnectionFactory(ConnectionPoolDataSource cpds,
-  ObjectPool pool,
+  ObjectPool pool,
   String validationQuery,
   boolean rollbackAfterValidation,
   String username,
@@ -120,13 +121,13 @@ class CPDSConnectionFactory
   *
   * @return ObjectPool managing pooled connections
   */
- public ObjectPool getPool() {
+ public ObjectPool getPool() {
  return _pool;
  }
 
 @Override
-public synchronized Object makeObject() {
-Object obj;
+public synchronized PooledConnectionAndInfo makeObject() {
+PooledConnectionAndInfo obj;
 try {
 PooledConnection pc = null;
 if (_username == null) {
@@ -154,84 +155,77 @@ class CPDSConnectionFactory
  * Closes the PooledConnection and stops listening for events from it.
  */
 @Override
-public void destroyObject(Object obj) throws Exception {
-if (obj instanceof PooledConnectionAndInfo) {
-PooledConnection pc = 
((PooledConnectionAndInfo)obj).getPooledConnection();
-pc.removeConnectionEventListener(this);
-pcMap.remove(pc);
-pc.close();
-}
+public void destroyObject(PooledConnectionAndInfo obj) throws Exception {
+PooledConnection pc = obj.getPooledConnection();
+pc.removeConnectionEventListener(this);
+pcMap.remove(pc);
+pc.close();
 }
 
 @Override
-public boolean validateObject(Object obj) {
+public boolean validateObject(PooledConnectionAndInfo obj) {
 boolean valid = false;
-if (obj instanceof PooledConnectionAndInfo) {
-PooledConnection pconn =
-((PooledConnectionAndInfo) obj).getPooledConnection();
-String query = _validationQuery;
-if (null != query) {
-Connection conn = null;
-Statement stmt = null;

[tomcat] branch 7.0.x updated: Generics: AbandonedTrace

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 9022aa5  Generics: AbandonedTrace
9022aa5 is described below

commit 9022aa50f2c18e560d39dfa58b4397de0cec8962
Author: Mark Thomas 
AuthorDate: Mon Mar 18 14:52:23 2019 +

Generics: AbandonedTrace
---
 .../apache/tomcat/dbcp/dbcp/AbandonedTrace.java| 24 +++---
 .../tomcat/dbcp/dbcp/DelegatingConnection.java |  6 +++---
 .../tomcat/dbcp/dbcp/DelegatingStatement.java  |  4 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/AbandonedTrace.java 
b/java/org/apache/tomcat/dbcp/dbcp/AbandonedTrace.java
index ec04cc5..ba8f702 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/AbandonedTrace.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/AbandonedTrace.java
@@ -5,9 +5,9 @@
  * 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.
@@ -29,7 +29,7 @@ import java.util.List;
  *
  * The JDBC Connection, Statement, and ResultSet classes
  * extend this class.
- * 
+ *
  * @author Glenn L. Nielsen
  */
 public class AbandonedTrace {
@@ -39,7 +39,7 @@ public class AbandonedTrace {
 /** A stack trace of the code that created me (if in debug mode) */
 private volatile Exception createdBy;
 /** A list of objects created by children of this object */
-private final List traceList = new ArrayList();
+private final List traceList = new 
ArrayList();
 /** Last time this connection was used */
 private volatile long lastUsed = 0;
 
@@ -78,7 +78,7 @@ public class AbandonedTrace {
  * @param parent AbandonedTrace parent object
  */
 private void init(AbandonedTrace parent) {
-if (parent != null) {  
+if (parent != null) {
 parent.addTrace(this);
 }
 
@@ -131,9 +131,9 @@ public class AbandonedTrace {
  * object trace list.
  */
 protected void setStackTrace() {
-if (config == null) { 
-return;   
-}
+if (config == null) {
+return;
+}
 if (config.getLogAbandoned()) {
 createdBy = new AbandonedObjectException();
 }
@@ -167,9 +167,9 @@ public class AbandonedTrace {
  *
  * @return List of objects
  */
-protected List getTrace() {
+protected List getTrace() {
 synchronized (this.traceList) {
-return new ArrayList(traceList);
+return new ArrayList(traceList);
 }
 }
 
@@ -182,9 +182,9 @@ public class AbandonedTrace {
 createdBy.printStackTrace(config.getLogWriter());
 }
 synchronized(this.traceList) {
-Iterator it = this.traceList.iterator();
+Iterator it = this.traceList.iterator();
 while (it.hasNext()) {
-AbandonedTrace at = (AbandonedTrace)it.next();
+AbandonedTrace at = it.next();
 at.printStackTrace();
 }
 }
diff --git a/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java 
b/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java
index 47cc1c0..890863d 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java
@@ -448,11 +448,11 @@ public class DelegatingConnection extends AbandonedTrace
 // The JDBC spec requires that a Connection close any open
 // Statement's when it is closed.
 // DBCP-288. Not all the traced objects will be statements
-List traces = getTrace();
+List traces = getTrace();
 if(traces != null) {
-Iterator traceIter = traces.iterator();
+Iterator traceIter = traces.iterator();
 while (traceIter.hasNext()) {
-Object trace = traceIter.next();
+AbandonedTrace trace = traceIter.next();
 if (trace instanceof Statement) {
 ((Statement) trace).close();
 } else if (trace instanceof ResultSet) {
diff --git a/java/org/apache/tomcat/dbcp/dbcp/DelegatingStatement.java 
b/java/org/apache/tomcat/dbcp/dbcp/DelegatingStatement.java
index 905c3b0..b8622de 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/DelegatingStatement.java
+++ 

[tomcat] branch 7.0.x updated: Generics: typeMap

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new f709250  Generics: typeMap
f709250 is described below

commit f709250834c783782d90a8b9e288eb5b2f63ab4f
Author: Mark Thomas 
AuthorDate: Mon Mar 18 14:34:08 2019 +

Generics: typeMap
---
 java/org/apache/tomcat/dbcp/dbcp/DelegatingCallableStatement.java | 4 ++--
 java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java| 4 ++--
 java/org/apache/tomcat/dbcp/dbcp/DelegatingResultSet.java | 4 ++--
 java/org/apache/tomcat/dbcp/dbcp/PoolingDataSource.java   | 4 ++--
 java/org/apache/tomcat/dbcp/dbcp/PoolingDriver.java   | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/DelegatingCallableStatement.java 
b/java/org/apache/tomcat/dbcp/dbcp/DelegatingCallableStatement.java
index 0b5f50b..979c352 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/DelegatingCallableStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/DelegatingCallableStatement.java
@@ -168,7 +168,7 @@ public class DelegatingCallableStatement extends 
DelegatingPreparedStatement
 { checkOpen(); try { return ((CallableStatement)_stmt).getBigDecimal( 
parameterIndex); } catch (SQLException e) { handleException(e); return null; } }
 
 @Override
-public Object getObject(int i, Map map) throws SQLException
+public Object getObject(int i, Map> map) throws 
SQLException
 { checkOpen(); try { return ((CallableStatement)_stmt).getObject( i, map); 
} catch (SQLException e) { handleException(e); return null; } }
 
 @Override
@@ -376,7 +376,7 @@ public class DelegatingCallableStatement extends 
DelegatingPreparedStatement
 { checkOpen(); try { return 
((CallableStatement)_stmt).getBigDecimal(parameterName); } catch (SQLException 
e) { handleException(e); return null; } }
 
 @Override
-public Object getObject(String parameterName, Map map) throws SQLException
+public Object getObject(String parameterName, Map> map) 
throws SQLException
 { checkOpen(); try { return 
((CallableStatement)_stmt).getObject(parameterName, map); } catch (SQLException 
e) { handleException(e); return null; } }
 
 @Override
diff --git a/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java 
b/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java
index c518282..47cc1c0 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/DelegatingConnection.java
@@ -373,7 +373,7 @@ public class DelegatingConnection extends AbandonedTrace
 { checkOpen(); try { return _conn.getTransactionIsolation(); } catch 
(SQLException e) { handleException(e); return -1; } }
 
 @Override
-public Map getTypeMap() throws SQLException
+public Map> getTypeMap() throws SQLException
 { checkOpen(); try { return _conn.getTypeMap(); } catch (SQLException e) { 
handleException(e); return null; } }
 
 @Override
@@ -409,7 +409,7 @@ public class DelegatingConnection extends AbandonedTrace
 { checkOpen(); try { _conn.setTransactionIsolation(level); } catch 
(SQLException e) { handleException(e); } }
 
 @Override
-public void setTypeMap(Map map) throws SQLException
+public void setTypeMap(Map> map) throws SQLException
 { checkOpen(); try { _conn.setTypeMap(map); } catch (SQLException e) { 
handleException(e); } }
 
 @Override
diff --git a/java/org/apache/tomcat/dbcp/dbcp/DelegatingResultSet.java 
b/java/org/apache/tomcat/dbcp/dbcp/DelegatingResultSet.java
index 2812f12..66fe959 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/DelegatingResultSet.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/DelegatingResultSet.java
@@ -661,7 +661,7 @@ public class DelegatingResultSet extends AbandonedTrace 
implements ResultSet {
 { try { _res.moveToCurrentRow(); } catch (SQLException e) { 
handleException(e); } }
 
 @Override
-public Object getObject(int i, Map map) throws SQLException
+public Object getObject(int i, Map> map) throws 
SQLException
 { try { return _res.getObject(i, map); } catch (SQLException e) { 
handleException(e); return null; } }
 
 @Override
@@ -681,7 +681,7 @@ public class DelegatingResultSet extends AbandonedTrace 
implements ResultSet {
 { try { return _res.getArray(i); } catch (SQLException e) { 
handleException(e); return null; } }
 
 @Override
-public Object getObject(String colName, Map map) throws SQLException
+public Object getObject(String colName, Map> map) throws 
SQLException
 { try { return _res.getObject(colName, map); } catch (SQLException e) { 
handleException(e); return null; } }
 
 @Override
diff --git a/java/org/apache/tomcat/dbcp/dbcp/PoolingDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp/PoolingDataSource.java
index 43b7ce3..fe519cf 100644
--- 

[tomcat] branch 7.0.x updated: Remove unused code: password

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new e41f64e  Remove unused code: password
e41f64e is described below

commit e41f64e71ffa0d53ccc85872a8250372e08be5ce
Author: Mark Thomas 
AuthorDate: Fri Mar 22 09:21:43 2019 +

Remove unused code: password
---
 .../dbcp/dbcp/datasources/PerUserPoolDataSource.java| 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git 
a/java/org/apache/tomcat/dbcp/dbcp/datasources/PerUserPoolDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp/datasources/PerUserPoolDataSource.java
index 4ed8ad0..9e20e52 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/datasources/PerUserPoolDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/datasources/PerUserPoolDataSource.java
@@ -342,8 +342,8 @@ public class PerUserPoolDataSource
 /**
  * Get the number of active connections in the pool for a given user.
  */
-public int getNumActive(String username, String password) {
-ObjectPool pool = getPool(getPoolKey(username,password));
+public int getNumActive(String username, @SuppressWarnings("unused") 
String password) {
+ObjectPool pool = getPool(getPoolKey(username));
 return (pool == null) ? 0 : pool.getNumActive();
 }
 
@@ -357,8 +357,8 @@ public class PerUserPoolDataSource
 /**
  * Get the number of idle connections in the pool for a given user.
  */
-public int getNumIdle(String username, String password) {
-ObjectPool pool = getPool(getPoolKey(username,password));
+public int getNumIdle(String username, @SuppressWarnings("unused") String 
password) {
+ObjectPool pool = getPool(getPoolKey(username));
 return (pool == null) ? 0 : pool.getNumIdle();
 }
 
@@ -371,7 +371,7 @@ public class PerUserPoolDataSource
 getPooledConnectionAndInfo(String username, String password)
 throws SQLException {
 
-final PoolKey key = getPoolKey(username,password);
+final PoolKey key = getPoolKey(username);
 ObjectPool pool;
 PooledConnectionManager manager;
 synchronized(this) {
@@ -466,8 +466,7 @@ public class PerUserPoolDataSource
 
 @Override
 protected PooledConnectionManager getConnectionManager(UserPassKey upkey) {
-return (PooledConnectionManager) managers.get(getPoolKey(
-upkey.getUsername(), upkey.getPassword()));
+return (PooledConnectionManager) 
managers.get(getPoolKey(upkey.getUsername()));
 }
 
 /**
@@ -483,7 +482,7 @@ public class PerUserPoolDataSource
 return ref;
 }
 
-private PoolKey getPoolKey(String username, String password) {
+private PoolKey getPoolKey(String username) {
 return new PoolKey(getDataSourceName(), username);
 }
 
@@ -523,7 +522,7 @@ public class PerUserPoolDataSource
 CPDSConnectionFactory factory = new CPDSConnectionFactory(cpds, pool, 
getValidationQuery(),
 isRollbackAfterValidation(), username, password);
 
-Object old = managers.put(getPoolKey(username,password), factory);
+Object old = managers.put(getPoolKey(username), factory);
 if (old != null) {
 throw new IllegalStateException("Pool already contains an entry 
for this user/password: "+username);
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 7.0.x updated: Fix possible NPE

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new c3b8200  Fix possible NPE
c3b8200 is described below

commit c3b8200f91563ef9f45837d8d9e5f2de3c4ca3c0
Author: Mark Thomas 
AuthorDate: Fri Mar 22 09:14:35 2019 +

Fix possible NPE
---
 .../tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java   | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java
index 94dfe4e..6f5fdfb 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/datasources/InstanceKeyDataSource.java
@@ -726,8 +726,9 @@ public abstract class InstanceKeyDataSource
 throw new SQLException("Cannot borrow connection from pool", e);
 }
 
+// Password on PooledConnectionAndInfo does not match
 if (!(null == password ? null == info.getPassword()
-: password.equals(info.getPassword( {  // Password on 
PooledConnectionAndInfo does not match
+: password.equals(info.getPassword( {
 try { // See if password has changed by attempting connection
 testCPDS(username, password);
 } catch (SQLException ex) {
@@ -736,8 +737,7 @@ public abstract class InstanceKeyDataSource
 throw new SQLException("Given password did not match password 
used"
+ " to create the PooledConnection.");
 } catch (javax.naming.NamingException ne) {
-throw (SQLException) new SQLException(
-"NamingException encountered connecting to 
database").initCause(ne);
+throw new SQLException("NamingException encountered connecting 
to database", ne);
 }
 /*
  * Password must have changed -> destroy connection and keep 
retrying until we get a new, good one,
@@ -764,7 +764,7 @@ public abstract class InstanceKeyDataSource
 closeDueToException(info);
 throw new SQLException("Cannot borrow connection from 
pool", e);
 }
-if (info != null && password.equals(info.getPassword())) {
+if (info != null && password != null && 
password.equals(info.getPassword())) {
 break;
 } else {
 if (info != null) {


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Add optional listeners for Server/Listener

2019-03-22 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 407d805  Add optional listeners for Server/Listener
407d805 is described below

commit 407d805f1772ae1dd03b6ffbac03be83f55c406b
Author: remm 
AuthorDate: Fri Mar 22 10:11:57 2019 +0100

Add optional listeners for Server/Listener

It is a very slight variant of a standard listener. The difference is
that loading is not fatal when it fails. This would allow adding example
configuration to the standard server.xml if deemed useful (example:
CDI).
Storeconfig will not attempt to persist the new listener at this time.
The dummy listener object includes the necessary information, just in
case, to hold on the properties and original className.
---
 java/org/apache/catalina/startup/Catalina.java |   5 +-
 .../catalina/startup/ListenerCreateRule.java   | 110 +
 .../catalina/startup/LocalStrings.properties   |   2 +
 .../catalina/storeconfig/server-registry.xml   |   1 +
 .../tomcat/util/digester/ObjectCreateRule.java |  31 +++---
 webapps/docs/changelog.xml |   7 ++
 6 files changed, 141 insertions(+), 15 deletions(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index f6b1446..f5a0974 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -315,9 +315,8 @@ public class Catalina {
 "setGlobalNamingResources",
 "org.apache.catalina.deploy.NamingResourcesImpl");
 
-digester.addObjectCreate("Server/Listener",
- null, // MUST be specified in the element
- "className");
+digester.addRule("Server/Listener",
+new ListenerCreateRule(null, "className"));
 digester.addSetProperties("Server/Listener");
 digester.addSetNext("Server/Listener",
 "addLifecycleListener",
diff --git a/java/org/apache/catalina/startup/ListenerCreateRule.java 
b/java/org/apache/catalina/startup/ListenerCreateRule.java
new file mode 100644
index 000..4a63952
--- /dev/null
+++ b/java/org/apache/catalina/startup/ListenerCreateRule.java
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.catalina.startup;
+
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.digester.ObjectCreateRule;
+import org.apache.tomcat.util.res.StringManager;
+import org.xml.sax.Attributes;
+
+
+/**
+ * Rule implementation that creates a server listener.
+ */
+public class ListenerCreateRule extends ObjectCreateRule {
+
+private static final Log log = LogFactory.getLog(ListenerCreateRule.class);
+protected static final StringManager sm = 
StringManager.getManager(ListenerCreateRule.class);
+
+public ListenerCreateRule(String className, String attributeName) {
+super(className, attributeName);
+}
+
+@Override
+public void begin(String namespace, String name, Attributes attributes)
+throws Exception {
+if ("true".equals(attributes.getValue("optional"))) {
+try {
+super.begin(namespace, name, attributes);
+} catch (Exception e) {
+String className = getRealClassName(attributes);
+if (log.isDebugEnabled()) {
+log.info(sm.getString("listener.createFailed", className), 
e);
+} else {
+log.info(sm.getString("listener.createFailed", className));
+}
+digester.push(new OptionalListener(className));
+}
+} else {
+super.begin(namespace, name, attributes);
+}
+}
+
+public class 

[tomcat] branch 7.0.x updated: Remove use of deprecated code. SQLNestedException -> SQLException

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
 new 292198a  Remove use of deprecated code. SQLNestedException -> 
SQLException
292198a is described below

commit 292198acbe21a13ab350e7396bcb37b83237df9d
Author: Mark Thomas 
AuthorDate: Fri Mar 22 09:08:39 2019 +

Remove use of deprecated code. SQLNestedException -> SQLException
---
 .../apache/tomcat/dbcp/dbcp/BasicDataSource.java   | 10 +++---
 .../dbcp/dbcp/PoolableCallableStatement.java   |  2 +-
 .../dbcp/dbcp/PoolablePreparedStatement.java   |  2 +-
 .../apache/tomcat/dbcp/dbcp/PoolingConnection.java | 10 +++---
 .../apache/tomcat/dbcp/dbcp/PoolingDataSource.java |  4 +--
 .../dbcp/cpdsadapter/PooledConnectionImpl.java | 15 -
 .../dbcp/datasources/InstanceKeyDataSource.java|  9 +++---
 .../dbcp/datasources/PerUserPoolDataSource.java|  8 ++---
 .../dbcp/datasources/SharedPoolDataSource.java | 37 +++---
 9 files changed, 46 insertions(+), 51 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java 
b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
index 2797448..6fe2488 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/BasicDataSource.java
@@ -1408,7 +1408,7 @@ public class BasicDataSource implements DataSource {
 } catch(RuntimeException e) {
 throw e;
 } catch(Exception e) {
-throw new SQLNestedException("Cannot close connection pool", e);
+throw new SQLException("Cannot close connection pool", e);
 }
 }
 
@@ -1523,7 +1523,7 @@ public class BasicDataSource implements DataSource {
 }
 } catch (Exception e) {
 closeConnectionPool();
-throw new SQLNestedException("Error preloading the connection 
pool", e);
+throw new SQLException("Error preloading the connection pool", e);
 }
 
 // If timeBetweenEvictionRunsMillis > 0, start the pool's evictor task
@@ -1570,7 +1570,7 @@ public class BasicDataSource implements DataSource {
 driverClassName + "'";
 logWriter.println(message);
 t.printStackTrace(logWriter);
-throw new SQLNestedException(message, t);
+throw new SQLException(message, t);
 }
 }
 
@@ -1593,7 +1593,7 @@ public class BasicDataSource implements DataSource {
 "' for connect URL '" + url + "'";
 logWriter.println(message);
 t.printStackTrace(logWriter);
-throw new SQLNestedException(message, t);
+throw new SQLException(message, t);
 }
 
 // Can't test without a validationQuery
@@ -1721,7 +1721,7 @@ public class BasicDataSource implements DataSource {
 } catch (RuntimeException e) {
 throw e;
 } catch (Exception e) {
-throw new SQLNestedException("Cannot create 
PoolableConnectionFactory (" + e.getMessage() + ")", e);
+throw new SQLException("Cannot create PoolableConnectionFactory (" 
+ e.getMessage() + ")", e);
 }
 }
 
diff --git a/java/org/apache/tomcat/dbcp/dbcp/PoolableCallableStatement.java 
b/java/org/apache/tomcat/dbcp/dbcp/PoolableCallableStatement.java
index acd2db5..cf9a1f1 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/PoolableCallableStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/PoolableCallableStatement.java
@@ -80,7 +80,7 @@ public class PoolableCallableStatement extends 
DelegatingCallableStatement {
 } catch(RuntimeException e) {
 throw e;
 } catch(Exception e) {
-throw new SQLNestedException("Cannot close CallableStatement 
(return to pool failed)", e);
+throw new SQLException("Cannot close CallableStatement (return 
to pool failed)", e);
 }
 }
 }
diff --git a/java/org/apache/tomcat/dbcp/dbcp/PoolablePreparedStatement.java 
b/java/org/apache/tomcat/dbcp/dbcp/PoolablePreparedStatement.java
index 7c86d7e..d3770e2 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/PoolablePreparedStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/PoolablePreparedStatement.java
@@ -101,7 +101,7 @@ public class PoolablePreparedStatement extends 
DelegatingPreparedStatement {
 } catch(RuntimeException e) {
 throw e;
 } catch(Exception e) {
-throw new SQLNestedException("Cannot close preparedstatement 
(return to pool failed)", e);
+throw new SQLException("Cannot close preparedstatement (return 
to pool failed)", e);
 }
 }
 }
diff --git a/java/org/apache/tomcat/dbcp/dbcp/PoolingConnection.java 
b/java/org/apache/tomcat/dbcp/dbcp/PoolingConnection.java

[tomcat] branch 7.0.x updated (2934d5f -> 0a4a017)

2019-03-22 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 2934d5f  Switch to Checkstyle JRE6 backport
 new 35b3690  Remove unused code: update()
 new 0a4a017  Remove unused code: restartNeeded

The 11922 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/tomcat/dbcp/dbcp/BasicDataSource.java   | 53 --
 java/org/apache/tomcat/dbcp/pool/PoolUtils.java|  9 
 2 files changed, 62 deletions(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Tomcat 7, Checkstyle and Gump

2019-03-22 Thread Emmanuel Bourg
Le 20/03/2019 à 23:51, Mark Thomas a écrit :

> Any suggestions?

Maybe disable Checkstyke for Tomcat 7? It isn't that important for old
code in maintenance mode. Backported code is unlikely to have a wildly
different formatting style anyway.

Emmanuel Bourg

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org