Re: [tomcat] 01/03: Fix warnings with Java 6 caused by missing @Override annotations

2019-10-25 Thread Phil Steitz
Sorry I missed all of these things.  Is there a checkstyle or eclipse 
config somewhere that I can use to make sure the next batch is clean?


Phil

On 10/25/19 11:12 AM, ma...@apache.org wrote:

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

commit 9e612f96ecfd96e3e96f2ea95ce9500d03f96691
Author: Mark Thomas 
AuthorDate: Fri Oct 25 13:13:06 2019 +0200

 Fix warnings with Java 6 caused by missing @Override annotations
---
  .../dbcp/dbcp/AbstractConnectionPoolTest.java  |  90 +-
  .../tomcat/dbcp/dbcp/TestBasicDataSource.java  | 112 ++--
  .../tomcat/dbcp/dbcp/TesterCallableStatement.java  | 111 
  .../apache/tomcat/dbcp/dbcp/TesterConnection.java  |  49 ++
  .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java   | 174 +++
  test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java |   6 +
  .../tomcat/dbcp/dbcp/TesterPreparedStatement.java  |  74 +++-
  .../apache/tomcat/dbcp/dbcp/TesterResultSet.java   | 191 -
  .../apache/tomcat/dbcp/dbcp/TesterStatement.java   |  42 +
  9 files changed, 747 insertions(+), 102 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java 
b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
index 758f4e5..7a5db76 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.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.
@@ -35,7 +35,7 @@ import junit.framework.TestCase;
  
  /**

   * Base test suite for DBCP pools.
- *
+ *
   * @author Rodney Waldhoff
   * @author Sean C. Sullivan
   * @author John McNally
@@ -47,6 +47,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
  super(testName);
  }
  
+@Override

  public void tearDown() throws Exception {
  super.tearDown();
  // Close any connections opened by the test
@@ -54,7 +55,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
  Connection conn = (Connection) connections.pop();
  try {
  conn.close();
-} catch (Exception ex) {
+} catch (Exception ex) {
  // ignore
  } finally {
  conn = null;
@@ -63,18 +64,18 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
  }
  
  protected abstract Connection getConnection() throws Exception;

-
+
  protected int getMaxActive() {
  return 10;
  }
-
+
  protected long getMaxWait() {
  return 100L;
  }
-
+
  /** Connections opened during the course of a test */
  protected Stack connections = new Stack();
-
+
  /** Acquire a connection and push it onto the connections stack */
  protected Connection newConnection() throws Exception {
  Connection connection = getConnection();
@@ -82,7 +83,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
  return connection;
  }
  
-// --- Utility Methods -

+// --- Utility Methods -
  
  protected String getUsername(Connection conn) throws SQLException {

  Statement stmt = conn.createStatement();
@@ -93,14 +94,14 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
  return null;
  }
  
-// --- tests -

+// --- tests -
  
  public void testClearWarnings() throws Exception {

  Connection[] c = new Connection[getMaxActive()];
  for (int i = 0; i < c.length; i++) {
  c[i] = newConnection();
  assertTrue(c[i] != null);
-
+
  // generate SQLWarning on connection
  c[i].prepareCall("warning");
  }
@@ -112,10 +113,10 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
  for (int i = 0; i < c.length; i++) {
  c[i].close();
  }
-
+
  for (int i = 0; i < c.length; i++) {
  c[i] = newConnection();
-}
+}
  
  for (int i = 0; i < c.length; i++) {

  // warnings should have been cleared by putting the connection 
back in the pool
@@ -390,7 +391,7 @@ public abstract class 

[GitHub] [tomcat] steves14 opened a new pull request #220: BZ 63879 - Remove unnecessary exception from NioSocketWrapper doClose

2019-10-25 Thread GitBox
steves14 opened a new pull request #220: BZ 63879 - Remove unnecessary 
exception from NioSocketWrapper doClose
URL: https://github.com/apache/tomcat/pull/220
 
 
   https://bz.apache.org/bugzilla/show_bug.cgi?id=63879


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
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 remaining IDE warnings in DBCP 1.x test classes

2019-10-25 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 ee495b6  Fix remaining IDE warnings in DBCP 1.x test classes
ee495b6 is described below

commit ee495b658dafd6ca22b012e00710d750a51601ae
Author: Mark Thomas 
AuthorDate: Fri Oct 25 17:23:33 2019 +0200

Fix remaining IDE warnings in DBCP 1.x test classes
---
 .../tomcat/dbcp/dbcp/TesterCallableStatement.java  | 22 
 .../apache/tomcat/dbcp/dbcp/TesterConnection.java  | 29 ++
 .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java   | 19 ++
 .../apache/tomcat/dbcp/dbcp/TesterResultSet.java   | 22 
 .../apache/tomcat/dbcp/dbcp/TesterStatement.java   | 12 +
 5 files changed, 104 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
index fba4681..debe612 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
@@ -570,12 +570,34 @@ public class TesterCallableStatement extends 
TesterPreparedStatement implements
 /* JDBC_4_ANT_KEY_END */
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
+/**
+ * Hard-coded to return null.
+ *
+ * @param Unused
+ * @param parameterIndex Unused
+ * @param type   Unused
+ *
+ * @return Always false
+ *
+ * @throws SQLException Never happens
+ */
 // No @Override else it won't compile with Java 6
 public  T getObject(int parameterIndex, Class type)
 throws SQLException {
 return null;
 }
 
+/**
+ * Hard-coded to return null.
+ *
+ * @paramUnused
+ * @param parameterName Unused
+ * @param type  Unused
+ *
+ * @return Always false
+ *
+ * @throws SQLException Never happens
+ */
 // No @Override else it won't compile with Java 6
 public  T getObject(String parameterName, Class type)
 throws SQLException {
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
index 44212fa..bd4d8a3 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
@@ -386,21 +386,50 @@ public class TesterConnection implements Connection {
 /* JDBC_4_ANT_KEY_END */
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
+/**
+ * Not implemented.
+ *
+ * @param schema Unused
+ *
+ * @throws SQLException Always
+ */
 // No @Override else it won't compile with Java 6
 public void setSchema(String schema) throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
+/**
+ * Not implemented.
+ *
+ * @return Never returns normally
+ *
+ * @throws SQLException Always
+ */
 // No @Override else it won't compile with Java 6
 public String getSchema() throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
+/**
+ * Not implemented.
+ *
+ * @param executor Unused
+ *
+ * @throws SQLException Always
+ */
 // No @Override else it won't compile with Java 6
 public void abort(Executor executor) throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
+/**
+ * Not implemented.
+ *
+ * @param executor Unused
+ * @param milliseconds Unused
+ *
+ * @throws SQLException Always
+ */
 // No @Override else it won't compile with Java 6
 public void setNetworkTimeout(Executor executor, int milliseconds)
 throws SQLException {
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
index 6d86469..16a654c 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
@@ -936,6 +936,18 @@ public class TesterDatabaseMetaData implements 
DatabaseMetaData {
 /* JDBC_4_ANT_KEY_END */
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
+/**
+ * Hard-coded to return null.
+ *
+ * @param catalog   Unused
+ * @param schemaPattern Unused
+ * @param tableNamePattern  Unused
+ * @param columnNamePattern Unused
+ *
+ * @return Always false
+ *
+ * @throws SQLException Never happens
+ */
 // No @Override else it won't compile with Java 6
 public ResultSet getPseudoColumns(String catalog, String schemaPattern,
 String tableNamePattern, String columnNamePattern)
@@ -943,6 +955,13 @@ public class TesterDatabaseMetaData implements 
DatabaseMetaData {
 return null;
 }
 
+/**
+ * Hard-coded to 

[tomcat] 03/03: Fix IDE warnings for missing @Deprecated annotations

2019-10-25 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

commit ef5de17498316569ed490b0db1e60a7758b577a5
Author: Mark Thomas 
AuthorDate: Fri Oct 25 13:15:18 2019 +0200

Fix IDE warnings for missing @Deprecated annotations
---
 test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java | 1 +
 test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java | 1 +
 test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java | 4 
 3 files changed, 6 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
index 0c5a4dd..fba4681 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
@@ -115,6 +115,7 @@ public class TesterCallableStatement extends 
TesterPreparedStatement implements
 /**
  * @deprecated
  */
+@Deprecated
 @Override
 public BigDecimal getBigDecimal(int parameterIndex, int scale) throws 
SQLException {
 return null;
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java
index 8c6e083..30298b6 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java
@@ -184,6 +184,7 @@ public class TesterPreparedStatement extends 
TesterStatement implements Prepared
 }
 
 /** @deprecated */
+@Deprecated
 @Override
 public void setUnicodeStream(int parameterIndex, java.io.InputStream x, 
int length) throws SQLException {
 checkOpen();
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
index c1c4a28..f934b35 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
@@ -162,6 +162,7 @@ public class TesterResultSet implements ResultSet {
 }
 
 /** @deprecated */
+@Deprecated
 @Override
 public BigDecimal getBigDecimal(int columnIndex, int scale) throws 
SQLException {
 checkOpen();
@@ -199,6 +200,7 @@ public class TesterResultSet implements ResultSet {
 }
 
 /** @deprecated */
+@Deprecated
 @Override
 public java.io.InputStream getUnicodeStream(int columnIndex) throws 
SQLException {
 checkOpen();
@@ -260,6 +262,7 @@ public class TesterResultSet implements ResultSet {
 }
 
 /** @deprecated */
+@Deprecated
 @Override
 public BigDecimal getBigDecimal(String columnName, int scale) throws 
SQLException {
 checkOpen();
@@ -297,6 +300,7 @@ public class TesterResultSet implements ResultSet {
 }
 
 /** @deprecated */
+@Deprecated
 @Override
 public java.io.InputStream getUnicodeStream(String columnName) throws 
SQLException {
 checkOpen();


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



[tomcat] 02/03: Fix unnecessary code warnings in IDE

2019-10-25 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

commit cece962e9d880f0ec9911fc785513c567af40899
Author: Mark Thomas 
AuthorDate: Fri Oct 25 13:13:50 2019 +0200

Fix unnecessary code warnings in IDE
---
 test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java | 2 +-
 test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java 
b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
index 7a5db76..665f2a5 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
@@ -52,7 +52,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 super.tearDown();
 // Close any connections opened by the test
 while (!connections.isEmpty()) {
-Connection conn = (Connection) connections.pop();
+Connection conn = connections.pop();
 try {
 conn.close();
 } catch (Exception ex) {
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
index 39f30d7..1eb9c4d 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
@@ -593,4 +593,4 @@ class TesterConnRequestCountDriver extends TesterDriver {
 public static void initConnRequestCount() {
connectionRequestCount = 0;
 }
-};
+}


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



[tomcat] 01/03: Fix warnings with Java 6 caused by missing @Override annotations

2019-10-25 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

commit 9e612f96ecfd96e3e96f2ea95ce9500d03f96691
Author: Mark Thomas 
AuthorDate: Fri Oct 25 13:13:06 2019 +0200

Fix warnings with Java 6 caused by missing @Override annotations
---
 .../dbcp/dbcp/AbstractConnectionPoolTest.java  |  90 +-
 .../tomcat/dbcp/dbcp/TestBasicDataSource.java  | 112 ++--
 .../tomcat/dbcp/dbcp/TesterCallableStatement.java  | 111 
 .../apache/tomcat/dbcp/dbcp/TesterConnection.java  |  49 ++
 .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java   | 174 +++
 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java |   6 +
 .../tomcat/dbcp/dbcp/TesterPreparedStatement.java  |  74 +++-
 .../apache/tomcat/dbcp/dbcp/TesterResultSet.java   | 191 -
 .../apache/tomcat/dbcp/dbcp/TesterStatement.java   |  42 +
 9 files changed, 747 insertions(+), 102 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java 
b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
index 758f4e5..7a5db76 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.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.
@@ -35,7 +35,7 @@ import junit.framework.TestCase;
 
 /**
  * Base test suite for DBCP pools.
- * 
+ *
  * @author Rodney Waldhoff
  * @author Sean C. Sullivan
  * @author John McNally
@@ -47,6 +47,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 super(testName);
 }
 
+@Override
 public void tearDown() throws Exception {
 super.tearDown();
 // Close any connections opened by the test
@@ -54,7 +55,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 Connection conn = (Connection) connections.pop();
 try {
 conn.close();
-} catch (Exception ex) { 
+} catch (Exception ex) {
 // ignore
 } finally {
 conn = null;
@@ -63,18 +64,18 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 }
 
 protected abstract Connection getConnection() throws Exception;
-
+
 protected int getMaxActive() {
 return 10;
 }
-
+
 protected long getMaxWait() {
 return 100L;
 }
-
+
 /** Connections opened during the course of a test */
 protected Stack connections = new Stack();
-
+
 /** Acquire a connection and push it onto the connections stack */
 protected Connection newConnection() throws Exception {
 Connection connection = getConnection();
@@ -82,7 +83,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 return connection;
 }
 
-// --- Utility Methods - 
+// --- Utility Methods -
 
 protected String getUsername(Connection conn) throws SQLException {
 Statement stmt = conn.createStatement();
@@ -93,14 +94,14 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 return null;
 }
 
-// --- tests - 
+// --- tests -
 
 public void testClearWarnings() throws Exception {
 Connection[] c = new Connection[getMaxActive()];
 for (int i = 0; i < c.length; i++) {
 c[i] = newConnection();
 assertTrue(c[i] != null);
-
+
 // generate SQLWarning on connection
 c[i].prepareCall("warning");
 }
@@ -112,10 +113,10 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 for (int i = 0; i < c.length; i++) {
 c[i].close();
 }
-
+
 for (int i = 0; i < c.length; i++) {
 c[i] = newConnection();
-}
+}
 
 for (int i = 0; i < c.length; i++) {
 // warnings should have been cleared by putting the connection 
back in the pool
@@ -390,7 +391,7 @@ public abstract class AbstractConnectionPoolTest extends 
TestCase {
 conn = null;
 }
 
-public void testPooling() throws Exception {  
+public void testPooling() throws Exception {
 // Grab a maximal set of open connections from 

[tomcat] branch 7.0.x updated (5a93621 -> ef5de17)

2019-10-25 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 5a93621  Remove @Override annotations that trigger errors with Java 6
 new 9e612f9  Fix warnings with Java 6 caused by missing @Override 
annotations
 new cece962  Fix unnecessary code warnings in IDE
 new ef5de17  Fix IDE warnings for missing @Deprecated annotations

The 3 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:
 .../dbcp/dbcp/AbstractConnectionPoolTest.java  |  92 +-
 .../tomcat/dbcp/dbcp/TestBasicDataSource.java  | 114 ++--
 .../tomcat/dbcp/dbcp/TesterCallableStatement.java  | 112 
 .../apache/tomcat/dbcp/dbcp/TesterConnection.java  |  49 ++
 .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java   | 174 ++
 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java |   6 +
 .../tomcat/dbcp/dbcp/TesterPreparedStatement.java  |  75 +++-
 .../apache/tomcat/dbcp/dbcp/TesterResultSet.java   | 195 -
 .../apache/tomcat/dbcp/dbcp/TesterStatement.java   |  42 +
 9 files changed, 755 insertions(+), 104 deletions(-)


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



[tomcat] 03/03: Add more documentation about usage of RewriteMap

2019-10-25 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

commit e70ef8567bbe4b852ecfff41add0c43ba36d7fa6
Author: Felix Schumacher 
AuthorDate: Fri Oct 25 15:38:10 2019 +0200

Add more documentation about usage of RewriteMap

Add a more detailed example by providing a sample implementation
and a hopefully more clear example rewrite.config.
---
 webapps/docs/changelog.xml |  4 
 webapps/docs/rewrite.xml   | 47 ++
 2 files changed, 51 insertions(+)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index eb9e74d..87e5d44 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -55,6 +55,10 @@
 63832: Properly mark container as FAILED when a JVM error
 occurs on stop. (remm)
   
+  
+Add more details on the usage of RewriteMap
+functionality in the RewriteValve. (fschumacher)
+  
 
   
   
diff --git a/webapps/docs/rewrite.xml b/webapps/docs/rewrite.xml
index 142680c..82b0b77 100644
--- a/webapps/docs/rewrite.xml
+++ b/webapps/docs/rewrite.xml
@@ -17,6 +17,7 @@
 -->
 
+  
 ]>
 
 
@@ -404,6 +405,52 @@ public interface RewriteMap {
 public String lookup(String key);
 }]]>
 
+The referenced implementation of such a class  in our example 
rewriteMapClassName 
+will be instantiated and initialized with the optional parameter  
optionalParameters from above
+(be careful with whitespace)  by calling 
setParameters(String). That instance
+will then be registered under the name given as the first paramter of 
RewriteMap rule.
+
+That instance will be given the the lookup value that is configured in 
the corresponding RewriteRule by
+calling lookup(String). Your implementation is free to return 
null to indicate,
+that the given default should be used, or to return a replacement 
value.
+
+Say, you want to implement a rewrite map function that converts all 
lookup keys to uppercase. You
+would start by implementing a class that implements the 
RewriteMap interface.
+
+
+
+Compile this class, put it into a jar and place that jar in 
${CATALINA_BASE}/lib.
+
+Having done that, you can now define a map with the 
RewriteMap directive
+and further on use that map in a RewriteRule.
+
+RewriteMap uc example.maps.UpperCaseMap
+
+RewriteRule ^/(.*)$ ${uc:$1}
+
+
+With this setup a request to the url path /index.html 
would get routed
+to /INDEX.HTML.
   
 
   


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



[tomcat] branch master updated (071d63e -> e70ef85)

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

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


from 071d63e  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63831
 new 70b54a9  Small typo in changelog
 new 63ea6ad  Correct link target for RewriteMap in documentation
 new e70ef85  Add more documentation about usage of RewriteMap

The 3 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:
 webapps/docs/changelog.xml |  6 +-
 webapps/docs/rewrite.xml   | 51 --
 2 files changed, 54 insertions(+), 3 deletions(-)


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



[tomcat] 01/03: Small typo in changelog

2019-10-25 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

commit 70b54a99e8e366e1b178a7814c3b20ab36fd4195
Author: Felix Schumacher 
AuthorDate: Fri Oct 25 15:42:36 2019 +0200

Small typo in changelog
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 49e2d01..eb9e74d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -325,7 +325,7 @@
   
   
 63733: Remove the documentation for the Additional
-Components since they have been remove / merged into the core
+Components since they have been removed / merged into the core
 Tomcat distribution for 9.0.5 onwards. (markt)
   
   


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



[tomcat] 02/03: Correct link target for RewriteMap in documentation

2019-10-25 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

commit 63ea6ad6e3490c34d8915090f7e312fafbd5148f
Author: Felix Schumacher 
AuthorDate: Fri Oct 25 13:00:34 2019 +0200

Correct link target for RewriteMap in documentation
---
 webapps/docs/rewrite.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/webapps/docs/rewrite.xml b/webapps/docs/rewrite.xml
index 0b810bf..142680c 100644
--- a/webapps/docs/rewrite.xml
+++ b/webapps/docs/rewrite.xml
@@ -98,7 +98,7 @@
   RewriteMap expansions: These are
   expansions of the form ${mapname:key|default}.
-  See the documentation for
+  See the documentation for
   RewriteMap for more details.
 
 
@@ -509,7 +509,7 @@ cannot use $N in the substitution string!
 server-variables as in rule condition test-strings
 (%{VARNAME})
 
-mapping-function calls
+mapping-function calls
 (${mapname:key|default})
   
   Back-references are identifiers of the form


-
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: Remove @Override annotations that trigger errors with Java 6

2019-10-25 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 5a93621  Remove @Override annotations that trigger errors with Java 6
5a93621 is described below

commit 5a936210440bd2a5f3c25857670acb2f7ee3e4f5
Author: Mark Thomas 
AuthorDate: Fri Oct 25 13:06:13 2019 +0200

Remove @Override annotations that trigger errors with Java 6
---
 test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java |  4 ++--
 test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java| 10 +-
 test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java  |  4 ++--
 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java|  2 +-
 test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java |  4 ++--
 test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java |  4 ++--
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
index a4b9a42..4b9601b 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
@@ -458,13 +458,13 @@ public class TesterCallableStatement extends 
TesterPreparedStatement implements
 /* JDBC_4_ANT_KEY_END */
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
-@Override
+// No @Override else it won't compile with Java 6
 public  T getObject(int parameterIndex, Class type)
 throws SQLException {
 return null;
 }
 
-@Override
+// No @Override else it won't compile with Java 6
 public  T getObject(String parameterName, Class type)
 throws SQLException {
 return null;
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
index 9e4e492..8834c71 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
@@ -337,28 +337,28 @@ public class TesterConnection implements Connection {
 /* JDBC_4_ANT_KEY_END */
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
-@Override
+// No @Override else it won't compile with Java 6
 public void setSchema(String schema) throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
-@Override
+// No @Override else it won't compile with Java 6
 public String getSchema() throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
-@Override
+// No @Override else it won't compile with Java 6
 public void abort(Executor executor) throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
-@Override
+// No @Override else it won't compile with Java 6
 public void setNetworkTimeout(Executor executor, int milliseconds)
 throws SQLException {
 throw new SQLException("Not implemented.");
 }
 
-@Override
+// No @Override else it won't compile with Java 6
 public int getNetworkTimeout() throws SQLException {
 throw new SQLException("Not implemented.");
 }
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
index c99c28b..fb571df 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
@@ -762,14 +762,14 @@ public class TesterDatabaseMetaData implements 
DatabaseMetaData {
 /* JDBC_4_ANT_KEY_END */
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
-@Override
+// No @Override else it won't compile with Java 6
 public ResultSet getPseudoColumns(String catalog, String schemaPattern,
 String tableNamePattern, String columnNamePattern)
 throws SQLException {
 return null;
 }
 
-@Override
+// No @Override else it won't compile with Java 6
 public boolean generatedKeyAlwaysReturned() throws SQLException {
 return false;
 }
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java
index 6e2fca2..f59847e 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java
@@ -119,7 +119,7 @@ public class TesterDriver implements Driver {
 }
 
 /* JDBC_4_1_ANT_KEY_BEGIN */
-@Override
+// No @Override else it won't compile with Java 6
 public Logger getParentLogger() throws SQLFeatureNotSupportedException {
 throw new SQLFeatureNotSupportedException();
 }
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
index 6d562f4..465fa86 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
+++ 

[GitHub] [tomcat] markt-asf commented on issue #216: Add Commons DBCP 1.x unit tests to 7.0.x branch

2019-10-25 Thread GitBox
markt-asf commented on issue #216: Add Commons DBCP 1.x unit tests to 7.0.x 
branch
URL: https://github.com/apache/tomcat/pull/216#issuecomment-546302405
 
 
   All merged less that last commit that disabled the failing tests as another 
contributor has provided a fix for the bug that triggered the test failures. 
Thanks Phil.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [tomcat] markt-asf closed pull request #216: Add Commons DBCP 1.x unit tests to 7.0.x branch

2019-10-25 Thread GitBox
markt-asf closed pull request #216: Add Commons DBCP 1.x unit tests to 7.0.x 
branch
URL: https://github.com/apache/tomcat/pull/216
 
 
   


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[Bug 63833] NPE in DBCP when attempting to connect to a database that doesn't exist

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63833

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #7 from Mark Thomas  ---
Thanks for the patch. I applied the fix but not the unit test as Phil Steitz
has back-ported the Commons DBCP 1.x unit tests that also catch this error.

-- 
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] 11/15: Repackaging.

2019-10-25 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

commit 1fd365f70cee897860f8f6342a8a4acbb2f3370b
Author: Phil Steitz 
AuthorDate: Sun Oct 20 09:37:12 2019 -0700

Repackaging.
---
 .../apache/tomcat/dbcp/dbcp/TestBasicDataSource.java | 20 
 .../apache/tomcat/dbcp/dbcp/TestConnectionPool.java  |  2 +-
 .../tomcat/dbcp/dbcp/TesterCallableStatement.java|  2 +-
 .../apache/tomcat/dbcp/dbcp/TesterClassLoader.java   |  2 +-
 .../apache/tomcat/dbcp/dbcp/TesterConnection.java|  2 +-
 .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java |  2 +-
 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java   |  4 ++--
 .../tomcat/dbcp/dbcp/TesterPreparedStatement.java|  2 +-
 .../org/apache/tomcat/dbcp/dbcp/TesterResultSet.java |  2 +-
 .../org/apache/tomcat/dbcp/dbcp/TesterStatement.java |  2 +-
 10 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
index c98e4bd..734e681 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.dbcp;
+package org.apache.tomcat.dbcp.dbcp;
 
 import java.io.IOException;
 import java.sql.Connection;
@@ -27,6 +27,10 @@ import javax.sql.DataSource;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
 
 /**
  * TestSuite for BasicDataSource
@@ -53,8 +57,8 @@ public class TestBasicDataSource extends TestConnectionPool {
 public void setUp() throws Exception {
 super.setUp();
 ds = createDataSource();
-ds.setDriverClassName("org.apache.commons.dbcp.TesterDriver");
-ds.setUrl("jdbc:apache:commons:testdriver");
+ds.setDriverClassName("org.apache.tomcat.dbcp.dbcp.TesterDriver");
+ds.setUrl("jdbc:apache:tomcat:dbcp:testdriver");
 ds.setMaxActive(getMaxActive());
 ds.setMaxWait(getMaxWait());
 ds.setDefaultAutoCommit(true);
@@ -479,8 +483,8 @@ public class TestBasicDataSource extends TestConnectionPool 
{
 ds.close();
 ds = null;
 ds = createDataSource();
-ds.setDriverClassName("org.apache.commons.dbcp.TesterDriver");
-ds.setUrl("jdbc:apache:commons:testdriver");
+ds.setDriverClassName("org.apache.tomcat.dbcp.dbcp.TesterDriver");
+ds.setUrl("jdbc:apache:tomcat:dbcp:testdriver");
 ds.setMaxActive(getMaxActive());
 ds.setMaxWait(getMaxWait());
 ds.setDefaultAutoCommit(true);
@@ -526,8 +530,8 @@ public class TestBasicDataSource extends TestConnectionPool 
{
 ds.close();
 ds = null;
 ds = createDataSource();
-
ds.setDriverClassName("org.apache.commons.dbcp.TesterConnRequestCountDriver");
-ds.setUrl("jdbc:apache:commons:testerConnRequestCountDriver");
+
ds.setDriverClassName("org.apache.tomcat.dbcp.dbcp.TesterConnRequestCountDriver");
+ds.setUrl("jdbc:apache:tomcat:dbcp:testerConnRequestCountDriver");
 ds.setValidationQuery("SELECT DUMMY FROM DUAL");
 ds.setUsername("username");
 
@@ -568,7 +572,7 @@ public class TestBasicDataSource extends TestConnectionPool 
{
  * TesterDriver that keeps a static count of connection requests.
  */
 class TesterConnRequestCountDriver extends TesterDriver {
-protected static final String CONNECT_STRING = 
"jdbc:apache:commons:testerConnRequestCountDriver";
+protected static final String CONNECT_STRING = 
"jdbc:apache:tomcat:dbcp:testerConnRequestCountDriver";
 private static int connectionRequestCount = 0;
 
@Override
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
index 004a054..b458263 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.dbcp;
+package org.apache.tomcat.dbcp.dbcp;
 
 import java.sql.Connection;
 import java.sql.PreparedStatement;
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
index 851dfbf..d463cc1 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.commons.dbcp;
+package org.apache.tomcat.dbcp.dbcp;
 
 

[tomcat] 05/15: Add TesterResulSet from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit 11f3f4949c94a1c96fcfcb0fe257976ff69b5921
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:39:01 2019 -0700

Add TesterResulSet from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../apache/tomcat/dbcp/dbcp/TesterResultSet.java   | 985 +
 1 file changed, 985 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
new file mode 100644
index 000..bc8134a
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
@@ -0,0 +1,985 @@
+/*
+ * 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.commons.dbcp;
+
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.Calendar;
+/* JDBC_4_ANT_KEY_BEGIN */
+import java.io.InputStream;
+import java.io.Reader;
+import java.sql.NClob;
+import java.sql.RowId;
+import java.sql.SQLXML;
+/* JDBC_4_ANT_KEY_END */
+
+/**
+ * A dummy {@link ResultSet}, for testing purposes.
+ *
+ * @author Rodney Waldhoff
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public class TesterResultSet implements ResultSet {
+public TesterResultSet(Statement stmt) {
+_statement = stmt;
+}
+
+public TesterResultSet(Statement stmt, Object[][] data) {
+_statement = stmt;
+_data = data;
+}
+
+public TesterResultSet(Statement stmt, Object[][] data, int type, int 
concurrency) {
+_statement = stmt;
+_data = data;
+_type = type;
+_concurrency = concurrency;
+}
+
+protected int _type = ResultSet.TYPE_FORWARD_ONLY;
+protected int _concurrency = ResultSet.CONCUR_READ_ONLY;
+
+protected Object[][] _data = null;
+protected int _currentRow = -1;
+
+protected Statement _statement = null;
+protected int _rowsLeft = 2;
+protected boolean _open = true;
+
+public boolean next() throws SQLException {
+checkOpen();
+if (_data != null) {
+_currentRow++;
+return _currentRow < _data.length;
+}
+else {
+if(--_rowsLeft > 0) {
+return true;
+} else {
+return false;
+}
+}
+}
+
+public void close() throws SQLException {
+if (!_open) {
+return;
+}
+
+// Not all result sets are generated from statements eg 
DatabaseMetaData
+if (_statement != null) {
+((TesterStatement)_statement)._resultSet = null;
+}
+
+_open = false;
+}
+
+public boolean wasNull() throws SQLException {
+checkOpen();
+return false;
+}
+
+public String getString(int columnIndex) throws SQLException {
+checkOpen();
+if (columnIndex == -1) {
+throw new SQLException("broken connection");
+}
+if (_data != null) {
+return (String) getObject(columnIndex);
+}
+return "String" + columnIndex;
+}
+
+public boolean getBoolean(int columnIndex) throws SQLException {
+checkOpen();
+return true;
+}
+
+public byte getByte(int columnIndex) throws SQLException {
+checkOpen();
+return (byte)columnIndex;
+}
+
+public short getShort(int columnIndex) throws SQLException {
+checkOpen();
+return (short)columnIndex;
+}
+
+public int getInt(int columnIndex) throws SQLException {
+checkOpen();
+return (short)columnIndex;
+}
+
+public long getLong(int columnIndex) throws SQLException {
+checkOpen();
+return columnIndex;
+}
+
+public float getFloat(int columnIndex) throws SQLException {
+checkOpen();
+return columnIndex;
+}
+
+public double getDouble(int columnIndex) throws 

[tomcat] 14/15: Rename abstract test class so runner does not try to execute test cases in it.

2019-10-25 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

commit 89ca499adbc34e02183906520540a2171a07eef5
Author: Phil Steitz 
AuthorDate: Sun Oct 20 15:39:08 2019 -0700

Rename abstract test class so runner does not try to execute test cases in 
it.
---
 .../dbcp/{TestConnectionPool.java => AbstractConnectionPoolTest.java} | 4 ++--
 test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java 
b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
similarity index 99%
rename from test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
rename to test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
index f0ea905..758f4e5 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
@@ -42,8 +42,8 @@ import junit.framework.TestCase;
  * @author Dirk Verbeeck
  * @version $Revision$ $Date$
  */
-public abstract class TestConnectionPool extends TestCase {
-public TestConnectionPool(String testName) {
+public abstract class AbstractConnectionPoolTest extends TestCase {
+public AbstractConnectionPoolTest(String testName) {
 super(testName);
 }
 
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
index 4ea483f..79e5d76 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
@@ -34,7 +34,7 @@ import junit.framework.TestSuite;
  * @author Dirk Verbeeck
  * @version $Revision$ $Date$
  */
-public class TestBasicDataSource extends TestConnectionPool {
+public class TestBasicDataSource extends AbstractConnectionPoolTest {
 public TestBasicDataSource(String testName) {
 super(testName);
 }


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



[tomcat] 12/15: Remove unused imports.

2019-10-25 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

commit 2015090e55abc9272dd8b6f010a1a568c8263398
Author: psteitz 
AuthorDate: Sun Oct 20 12:02:46 2019 -0700

Remove unused imports.
---
 test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java | 4 
 1 file changed, 4 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
index 734e681..4ea483f 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
@@ -27,10 +27,6 @@ import javax.sql.DataSource;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
 
 /**
  * TestSuite for BasicDataSource


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



[tomcat] 15/15: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63833

2019-10-25 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

commit 8191a6aa8f3600cb48db064e23d89b7d9623ccc0
Author: Mark Thomas 
AuthorDate: Fri Oct 25 12:36:44 2019 +0200

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63833

Avoid potential NPE. Patch by Guoxiong Li.
---
 java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java | 4 +++-
 webapps/docs/changelog.xml  | 6 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java 
b/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java
index b04fa6f..af71261 100644
--- a/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java
+++ b/java/org/apache/tomcat/dbcp/dbcp/PoolableConnectionFactory.java
@@ -640,7 +640,9 @@ public class PoolableConnectionFactory implements 
PoolableObjectFactory
+  
+63833: Fix an error in the generification of the copied
+Commons DBCP 1.x code that caused a NullPointerException 
if
+a DataSource was configured with a database that did not exist. Patch
+provided by Guoxiong Li. (markt)
+  
 
   
 


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



[tomcat] 04/15: Add TesterDatabaseMetaData from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit 6b81f37775f4f9954f7228d7472008c9e524af1e
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:14:31 2019 -0700

Add TesterDatabaseMetaData from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java   | 777 +
 1 file changed, 777 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
new file mode 100644
index 000..95dae0c
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
@@ -0,0 +1,777 @@
+/**
+ *
+ * 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.commons.dbcp;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+/* JDBC_4_ANT_KEY_BEGIN */
+import java.sql.RowIdLifetime;
+/* JDBC_4_ANT_KEY_END */
+import java.sql.SQLException;
+
+/**
+ * Dummy {@link DatabaseMetaData} for tetsing purposes. Implements only those
+ * methods required by the test cases.
+ */
+public class TesterDatabaseMetaData implements DatabaseMetaData {
+
+public boolean allProceduresAreCallable() throws SQLException {
+return false;
+}
+
+public boolean allTablesAreSelectable() throws SQLException {
+return false;
+}
+
+public boolean dataDefinitionCausesTransactionCommit() throws SQLException 
{
+return false;
+}
+
+public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+return false;
+}
+
+public boolean deletesAreDetected(int type) throws SQLException {
+return false;
+}
+
+public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+return false;
+}
+
+public ResultSet getAttributes(String catalog, String schemaPattern,
+String typeNamePattern, String attributeNamePattern)
+throws SQLException {
+return null;
+}
+
+public ResultSet getBestRowIdentifier(String catalog, String schema,
+String table, int scope, boolean nullable) throws SQLException {
+return null;
+}
+
+public String getCatalogSeparator() throws SQLException {
+return null;
+}
+
+public String getCatalogTerm() throws SQLException {
+return null;
+}
+
+public ResultSet getCatalogs() throws SQLException {
+return null;
+}
+
+public ResultSet getColumnPrivileges(String catalog, String schema,
+String table, String columnNamePattern) throws SQLException {
+return null;
+}
+
+public ResultSet getColumns(String catalog, String schemaPattern,
+String tableNamePattern, String columnNamePattern)
+throws SQLException {
+return null;
+}
+
+public Connection getConnection() throws SQLException {
+return null;
+}
+
+public ResultSet getCrossReference(String parentCatalog,
+String parentSchema, String parentTable, String foreignCatalog,
+String foreignSchema, String foreignTable) throws SQLException {
+return null;
+}
+
+public int getDatabaseMajorVersion() throws SQLException {
+return 0;
+}
+
+public int getDatabaseMinorVersion() throws SQLException {
+return 0;
+}
+
+public String getDatabaseProductName() throws SQLException {
+return null;
+}
+
+public String getDatabaseProductVersion() throws SQLException {
+return null;
+}
+
+public int getDefaultTransactionIsolation() throws SQLException {
+return 0;
+}
+
+public int getDriverMajorVersion() {
+return 0;
+}
+
+public int getDriverMinorVersion() {
+return 0;
+}
+
+public String getDriverName() throws SQLException {
+return null;
+}
+
+public String getDriverVersion() throws SQLException {
+return null;
+}
+
+public ResultSet getExportedKeys(String catalog, String schema, String 
table)
+throws SQLException {

[tomcat] 06/15: Add TesterPreparedStatement from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit 36f7f4b42f8b2e10123e822056dc40043f522803
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:40:57 2019 -0700

Add TesterPreparedStatement from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../tomcat/dbcp/dbcp/TesterPreparedStatement.java  | 367 +
 1 file changed, 367 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java
new file mode 100644
index 000..cf2ab2c
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java
@@ -0,0 +1,367 @@
+/*
+ * 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.commons.dbcp;
+
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.Calendar;
+/* JDBC_4_ANT_KEY_BEGIN */
+import java.io.InputStream;
+import java.io.Reader;
+import java.sql.NClob;
+import java.sql.RowId;
+import java.sql.SQLXML;
+/* JDBC_4_ANT_KEY_END */
+
+/**
+ * A dummy {@link PreparedStatement}, for testing purposes.
+ * 
+ * @author Rodney Waldhoff
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public class TesterPreparedStatement extends TesterStatement implements 
PreparedStatement {
+private ResultSetMetaData _resultSetMetaData = null;
+private String _sql = null;
+private String _catalog = null;
+
+public TesterPreparedStatement(Connection conn) {
+super(conn);
+try {
+_catalog = conn.getCatalog();
+} catch (SQLException e) { }
+}
+
+public TesterPreparedStatement(Connection conn, String sql) {
+super(conn);
+_sql = sql;
+try {
+_catalog = conn.getCatalog();
+} catch (SQLException e) { }
+}
+
+public TesterPreparedStatement(Connection conn, String sql, int 
resultSetType, int resultSetConcurrency) {
+super(conn, resultSetType, resultSetConcurrency);
+_sql = sql;
+try {
+_catalog = conn.getCatalog();
+} catch (SQLException e) { }
+}
+
+/** for junit test only */
+public String getCatalog() {
+return _catalog;
+}
+
+public ResultSet executeQuery(String sql) throws SQLException {
+checkOpen();
+if("null".equals(sql)) {
+return null;
+} else {
+return new TesterResultSet(this, null, _resultSetType, 
_resultSetConcurrency);
+}
+}
+
+public int executeUpdate(String sql) throws SQLException {
+checkOpen();
+return _rowsUpdated;
+}
+
+public ResultSet executeQuery() throws SQLException {
+checkOpen();
+if("null".equals(_sql)) {
+return null;
+} else {
+return new TesterResultSet(this, null, _resultSetType, 
_resultSetConcurrency);
+}
+}
+
+public int executeUpdate() throws SQLException {
+checkOpen();
+return _rowsUpdated;
+}
+
+public void setNull(int parameterIndex, int sqlType) throws SQLException {
+checkOpen();
+}
+
+public void setBoolean(int parameterIndex, boolean x) throws SQLException {
+checkOpen();
+}
+
+public void setByte(int parameterIndex, byte x) throws SQLException {
+checkOpen();
+}
+
+public void setShort(int parameterIndex, short x) throws SQLException {
+checkOpen();
+}
+
+public void setInt(int parameterIndex, int x) throws SQLException {
+checkOpen();
+}
+
+public void setLong(int parameterIndex, long x) throws SQLException {
+checkOpen();
+}
+
+public void setFloat(int parameterIndex, float x) throws SQLException {
+checkOpen();
+}
+
+public void setDouble(int parameterIndex, double x) throws SQLException {
+checkOpen();
+}
+
+

[tomcat] 13/15: Generics.

2019-10-25 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

commit b18ab5fb864b39b3af32090d85169e4b6887a37b
Author: psteitz 
AuthorDate: Sun Oct 20 12:03:49 2019 -0700

Generics.
---
 test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java  | 4 ++--
 test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java | 4 ++--
 test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java| 6 +++---
 test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java | 5 +++--
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
index b458263..f0ea905 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
@@ -73,7 +73,7 @@ public abstract class TestConnectionPool extends TestCase {
 }
 
 /** Connections opened during the course of a test */
-protected Stack connections = new Stack();
+protected Stack connections = new Stack();
 
 /** Acquire a connection and push it onto the connections stack */
 protected Connection newConnection() throws Exception {
@@ -520,7 +520,7 @@ public abstract class TestConnectionPool extends TestCase {
  */
 public void testHashing() throws Exception {
 Connection con = getConnection();
-Hashtable hash = new Hashtable();
+Hashtable hash = new Hashtable();
 hash.put(con, "test");
 assertEquals("test", hash.get(con));
 assertTrue(hash.containsKey(con));
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
index d463cc1..a4b9a42 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
@@ -132,7 +132,7 @@ public class TesterCallableStatement extends 
TesterPreparedStatement implements
 return null;
 }
 
-public Object getObject(int i, Map map) throws SQLException {
+public Object getObject(int i, Map> map) throws 
SQLException {
 return null;
 }
 
@@ -311,7 +311,7 @@ public class TesterCallableStatement extends 
TesterPreparedStatement implements
 return null;
 }
 
-public Object getObject(String parameterName, Map map) throws SQLException 
{
+public Object getObject(String parameterName, Map> map) 
throws SQLException {
 return null;
 }
 
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
index 8b14447..9e4e492 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
@@ -50,7 +50,7 @@ public class TesterConnection implements Connection {
 protected int _transactionIsolation = 1;
 protected DatabaseMetaData _metaData = new TesterDatabaseMetaData();
 protected String _catalog = null;
-protected Map _typeMap = null;
+protected Map> _typeMap = null;
 protected boolean _readOnly = false;
 protected SQLWarning warnings = null;
 protected String username = null;
@@ -117,7 +117,7 @@ public class TesterConnection implements Connection {
 return _transactionIsolation;
 }
 
-public Map getTypeMap() throws SQLException {
+public Map> getTypeMap() throws SQLException {
 checkOpen();
 return _typeMap;
 }
@@ -199,7 +199,7 @@ public class TesterConnection implements Connection {
 _transactionIsolation = level;
 }
 
-public void setTypeMap(Map map) throws SQLException {
+public void setTypeMap(Map> map) throws SQLException {
 checkOpen();
 _typeMap = map;
 }
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
index 410ecfc..6d562f4 100644
--- a/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
@@ -28,6 +28,7 @@ import java.sql.SQLException;
 import java.sql.SQLWarning;
 import java.sql.Statement;
 import java.util.Calendar;
+import java.util.Map;
 /* JDBC_4_ANT_KEY_BEGIN */
 import java.io.InputStream;
 import java.io.Reader;
@@ -632,7 +633,7 @@ public class TesterResultSet implements ResultSet {
 }
 
 
-public Object getObject(int i, java.util.Map map) throws SQLException {
+public Object getObject(int i, Map> map) throws 
SQLException {
 checkOpen();
 return new Object();
 }
@@ -657,7 +658,7 @@ public class TesterResultSet implements ResultSet {
 return null;
 }
 
-public Object getObject(String colName, java.util.Map map) throws 
SQLException {
+public Object getObject(String colName, Map> map) throws 
SQLException {
 

[tomcat] 03/15: Add TesterConnection from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit baf58959e48c939805e0cb6f7a07277bf7ab89e6
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:10:18 2019 -0700

Add TesterConnection from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../apache/tomcat/dbcp/dbcp/TesterConnection.java  | 366 +
 1 file changed, 366 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
new file mode 100644
index 000..1c1fd25
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
@@ -0,0 +1,366 @@
+/*
+ * 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.commons.dbcp;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.Map;
+/* JDBC_4_ANT_KEY_BEGIN */
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.NClob;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLXML;
+import java.sql.Struct;
+import java.util.Properties;
+/* JDBC_4_ANT_KEY_END */
+import java.util.concurrent.Executor;
+
+/**
+ * A dummy {@link Connection}, for testing purposes.
+ *
+ * @author Rodney Waldhoff
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public class TesterConnection implements Connection {
+protected boolean _open = true;
+protected boolean _autoCommit = true;
+protected int _transactionIsolation = 1;
+protected DatabaseMetaData _metaData = new TesterDatabaseMetaData();
+protected String _catalog = null;
+protected Map _typeMap = null;
+protected boolean _readOnly = false;
+protected SQLWarning warnings = null;
+protected String username = null;
+protected String password = null;
+protected Exception failure;
+
+public TesterConnection(String username, String password) {
+this.username = username;
+this.password = password;
+}
+
+public String getUsername() {
+return this.username;
+}
+
+public void setWarnings(SQLWarning warning) {
+this.warnings = warning;
+}
+
+public void clearWarnings() throws SQLException {
+checkOpen();
+warnings = null;
+}
+
+public void close() throws SQLException {
+checkFailure();
+_open = false;
+}
+
+public void commit() throws SQLException {
+checkOpen();
+if (isReadOnly()) {
+throw new SQLException("Cannot commit a readonly connection");
+}
+}
+
+public Statement createStatement() throws SQLException {
+checkOpen();
+return new TesterStatement(this);
+}
+
+public Statement createStatement(int resultSetType, int 
resultSetConcurrency) throws SQLException {
+checkOpen();
+return new TesterStatement(this);
+}
+
+public boolean getAutoCommit() throws SQLException {
+checkOpen();
+return _autoCommit;
+}
+
+public String getCatalog() throws SQLException {
+checkOpen();
+return _catalog;
+}
+
+public DatabaseMetaData getMetaData() throws SQLException {
+checkOpen();
+return _metaData;
+}
+
+public int getTransactionIsolation() throws SQLException {
+checkOpen();
+return _transactionIsolation;
+}
+
+public Map getTypeMap() throws SQLException {
+checkOpen();
+return _typeMap;
+}
+
+public SQLWarning getWarnings() throws SQLException {
+checkOpen();
+return warnings;
+}
+
+public boolean isClosed() throws SQLException {
+checkFailure();
+return !_open;
+}
+
+public boolean isReadOnly() throws SQLException {
+checkOpen();
+return _readOnly;
+}
+
+public String nativeSQL(String sql) throws SQLException {
+checkOpen();
+return sql;
+}
+
+public CallableStatement 

[tomcat] 10/15: Add TestConnectionPool from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit 9480651047c408bcf931612b68c8319145b31e89
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:49:54 2019 -0700

Add TestConnectionPool from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../tomcat/dbcp/dbcp/TestConnectionPool.java   | 914 +
 1 file changed, 914 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
new file mode 100644
index 000..004a054
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestConnectionPool.java
@@ -0,0 +1,914 @@
+/*
+ * 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.commons.dbcp;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Hashtable;
+import java.util.Stack;
+
+import junit.framework.TestCase;
+
+// XXX FIX ME XXX
+// this class still needs some cleanup, but at least
+// this consolidates most of the relevant test code
+// in a fairly re-usable fashion
+// XXX FIX ME XXX
+
+/**
+ * Base test suite for DBCP pools.
+ * 
+ * @author Rodney Waldhoff
+ * @author Sean C. Sullivan
+ * @author John McNally
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public abstract class TestConnectionPool extends TestCase {
+public TestConnectionPool(String testName) {
+super(testName);
+}
+
+public void tearDown() throws Exception {
+super.tearDown();
+// Close any connections opened by the test
+while (!connections.isEmpty()) {
+Connection conn = (Connection) connections.pop();
+try {
+conn.close();
+} catch (Exception ex) { 
+// ignore
+} finally {
+conn = null;
+}
+}
+}
+
+protected abstract Connection getConnection() throws Exception;
+
+protected int getMaxActive() {
+return 10;
+}
+
+protected long getMaxWait() {
+return 100L;
+}
+
+/** Connections opened during the course of a test */
+protected Stack connections = new Stack();
+
+/** Acquire a connection and push it onto the connections stack */
+protected Connection newConnection() throws Exception {
+Connection connection = getConnection();
+connections.push(connection);
+return connection;
+}
+
+// --- Utility Methods - 
+
+protected String getUsername(Connection conn) throws SQLException {
+Statement stmt = conn.createStatement();
+ResultSet rs = stmt.executeQuery("select username");
+if (rs.next()) {
+return rs.getString(1);
+}
+return null;
+}
+
+// --- tests - 
+
+public void testClearWarnings() throws Exception {
+Connection[] c = new Connection[getMaxActive()];
+for (int i = 0; i < c.length; i++) {
+c[i] = newConnection();
+assertTrue(c[i] != null);
+
+// generate SQLWarning on connection
+c[i].prepareCall("warning");
+}
+
+for (int i = 0; i < c.length; i++) {
+assertNotNull(c[i].getWarnings());
+}
+
+for (int i = 0; i < c.length; i++) {
+c[i].close();
+}
+
+for (int i = 0; i < c.length; i++) {
+c[i] = newConnection();
+}
+
+for (int i = 0; i < c.length; i++) {
+// warnings should have been cleared by putting the connection 
back in the pool
+assertNull(c[i].getWarnings());
+}
+
+for (int i = 0; i < c.length; i++) {
+c[i].close();
+}
+}
+
+public void testIsClosed() throws Exception {
+for(int i=0;ihttp://issues.apache.org/bugzilla/show_bug.cgi?id=12400; */
+public void testConnectionsAreDistinct() throws Exception {
+ 

[tomcat] 09/15: Add TesterClassLoader from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit f406df20d22c62244cc2df9633693f5622d381a5
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:46:09 2019 -0700

Add TesterClassLoader from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../apache/tomcat/dbcp/dbcp/TesterClassLoader.java | 40 ++
 1 file changed, 40 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java
new file mode 100644
index 000..166041c
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java
@@ -0,0 +1,40 @@
+/*
+ * 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.commons.dbcp;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Simple class loader that just records the classes it was asked to load.
+ */
+public class TesterClassLoader extends ClassLoader {
+
+private Set loadedClasses = new HashSet();
+
+@Override
+protected synchronized Class loadClass(String name, boolean resolve)
+throws ClassNotFoundException {
+Class clazz =  super.loadClass(name, resolve);
+loadedClasses.add(name);
+return clazz;
+}
+
+public boolean didLoad(String className) {
+return loadedClasses.contains(className);
+}
+}


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



[tomcat] 08/15: Add TesterStatement from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit edf36aa3cb199f5cd06e99fe76441d2977e774c6
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:44:43 2019 -0700

Add TesterStatement from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../apache/tomcat/dbcp/dbcp/TesterStatement.java   | 310 +
 1 file changed, 310 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java
new file mode 100644
index 000..4a81e10
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java
@@ -0,0 +1,310 @@
+/*
+ * 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.commons.dbcp;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+
+/**
+ * A dummy {@link Statement}, for testing purposes.
+ *
+ * @author Rodney Waldhoff
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public class TesterStatement implements Statement {
+public TesterStatement(Connection conn) {
+_connection = conn;
+}
+
+public TesterStatement(Connection conn, int resultSetType, int 
resultSetConcurrency) {
+_connection = conn;
+_resultSetType = resultSetType;
+_resultSetConcurrency = resultSetConcurrency;
+}
+
+protected Connection _connection = null;
+protected boolean _open = true;
+protected int _rowsUpdated = 1;
+protected boolean _executeResponse = true;
+protected int _maxFieldSize = 1024;
+protected int _maxRows = 1024;
+protected boolean _escapeProcessing = false;
+protected int _queryTimeout = 1000;
+protected String _cursorName = null;
+protected int _fetchDirection = 1;
+protected int _fetchSize = 1;
+protected int _resultSetConcurrency = 1;
+protected int _resultSetType = 1;
+protected ResultSet _resultSet = null;
+
+public ResultSet executeQuery(String sql) throws SQLException {
+checkOpen();
+if("null".equals(sql)) {
+return null;
+}
+if("invalid".equals(sql)) {
+throw new SQLException("invalid query");
+}
+if ("broken".equals(sql)) {
+throw new SQLException("broken connection");
+}
+if("select username".equals(sql)) {
+String username = ((TesterConnection) _connection).getUsername();
+Object[][] data = {{username}};
+return new TesterResultSet(this, data);
+} else {
+// Simulate timeout if queryTimout is set to less than 5 seconds
+if (_queryTimeout > 0 && _queryTimeout < 5) {
+throw new SQLException("query timeout");
+}
+return new TesterResultSet(this);
+}
+}
+
+public int executeUpdate(String sql) throws SQLException {
+checkOpen();
+return _rowsUpdated;
+}
+
+public void close() throws SQLException {
+// calling close twice has no effect
+if (!_open) {
+return;
+}
+
+_open = false;
+if (_resultSet != null) {
+_resultSet.close();
+_resultSet = null;
+}
+}
+
+public int getMaxFieldSize() throws SQLException {
+checkOpen();
+return _maxFieldSize;
+}
+
+public void setMaxFieldSize(int max) throws SQLException {
+checkOpen();
+_maxFieldSize = max;
+}
+
+public int getMaxRows() throws SQLException {
+checkOpen();
+return _maxRows;
+}
+
+public void setMaxRows(int max) throws SQLException {
+checkOpen();
+_maxRows = max;
+}
+
+public void setEscapeProcessing(boolean enable) throws SQLException {
+checkOpen();
+_escapeProcessing = enable;
+}
+
+public int getQueryTimeout() throws SQLException {
+checkOpen();
+return _queryTimeout;
+}
+
+public void setQueryTimeout(int seconds) throws SQLException {
+checkOpen();
+

[tomcat] 02/15: Add TesterDriver from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit addbdbee01ea7b68912ca1d5a4a9126c066df649
Author: Phil Steitz 
AuthorDate: Sat Oct 19 13:52:22 2019 -0700

Add TesterDriver from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java | 134 +
 1 file changed, 134 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java
new file mode 100644
index 000..26eff85
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java
@@ -0,0 +1,134 @@
+/*
+ * 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.commons.dbcp;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+/**
+ * Mock object implementing the java.sql.Driver interface.
+ * Returns TestConnection's from getConnection methods.
+ * Valid username, password combinations are:
+ *
+ * 
+ * userpassword
+ * foobar
+ * u1p1
+ * u2p2
+ * usernamepassword
+ * 
+ *
+ * @author Rodney Waldhoff
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public class TesterDriver implements Driver {
+private static final Properties validUserPasswords = new Properties();
+static {
+try {
+DriverManager.registerDriver(new TesterDriver());
+} catch(Exception e) {
+}
+validUserPasswords.put("foo", "bar");
+validUserPasswords.put("u1", "p1");
+validUserPasswords.put("u2", "p2");
+validUserPasswords.put("username", "password");
+}
+
+/**
+ * TesterDriver specific method to add users to the list of valid users
+ */
+public static void addUser(String username, String password) {
+synchronized (validUserPasswords) {
+validUserPasswords.put(username, password);
+}
+}
+
+public boolean acceptsURL(String url) throws SQLException {
+return CONNECT_STRING.startsWith(url);
+}
+
+private void assertValidUserPassword(String user, String password)
+throws SQLException {
+synchronized (validUserPasswords) {
+String realPassword = validUserPasswords.getProperty(user);
+if (realPassword == null) {
+throw new SQLException(user + " is not a valid username.");
+}
+if (!realPassword.equals(password)) {
+throw new SQLException(password + " is not the correct 
password for " + user
++ ".  The correct password is " + realPassword);
+}
+}
+}
+
+public Connection connect(String url, Properties info) throws SQLException 
{
+//return (acceptsURL(url) ? new TesterConnection() : null);
+Connection conn = null;
+if (acceptsURL(url))
+{
+String username = "test";
+String password = "test";
+if (info != null)
+{
+username = info.getProperty("user");
+password = info.getProperty("password");
+assertValidUserPassword(username, password);
+}
+conn = new TesterConnection(username, password);
+}
+
+return conn;
+}
+
+public int getMajorVersion() {
+return MAJOR_VERSION;
+}
+
+public int getMinorVersion() {
+return MINOR_VERSION;
+}
+
+public boolean jdbcCompliant() {
+return true;
+}
+
+public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
+return new DriverPropertyInfo[0];
+}
+
+/* JDBC_4_1_ANT_KEY_BEGIN */
+@Override
+public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+throw new SQLFeatureNotSupportedException();
+}
+/* JDBC_4_1_ANT_KEY_END */
+
+protected static final String CONNECT_STRING = 

[tomcat] 01/15: Add TestBasicDataSource from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit 8ba4f4603bbf523aa912a28287f7de8e5efc843d
Author: Phil Steitz 
AuthorDate: Sat Oct 19 13:41:48 2019 -0700

Add TestBasicDataSource from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../tomcat/dbcp/dbcp/TestBasicDataSource.java  | 592 +
 1 file changed, 592 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java 
b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
new file mode 100644
index 000..c98e4bd
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
@@ -0,0 +1,592 @@
+/*
+ * 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.commons.dbcp;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * TestSuite for BasicDataSource
+ * 
+ * @author Dirk Verbeeck
+ * @version $Revision$ $Date$
+ */
+public class TestBasicDataSource extends TestConnectionPool {
+public TestBasicDataSource(String testName) {
+super(testName);
+}
+
+public static Test suite() {
+return new TestSuite(TestBasicDataSource.class);
+}
+
+protected Connection getConnection() throws Exception {
+return ds.getConnection();
+}
+
+protected BasicDataSource ds = null;
+private static final String CATALOG = "test catalog";
+
+public void setUp() throws Exception {
+super.setUp();
+ds = createDataSource();
+ds.setDriverClassName("org.apache.commons.dbcp.TesterDriver");
+ds.setUrl("jdbc:apache:commons:testdriver");
+ds.setMaxActive(getMaxActive());
+ds.setMaxWait(getMaxWait());
+ds.setDefaultAutoCommit(true);
+ds.setDefaultReadOnly(false);
+
ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+ds.setDefaultCatalog(CATALOG);
+ds.setUsername("username");
+ds.setPassword("password");
+ds.setValidationQuery("SELECT DUMMY FROM DUAL");
+ds.setConnectionInitSqls(Arrays.asList(new String[] { "SELECT 1", 
"SELECT 2"}));
+ds.setDriverClassLoader(new TesterClassLoader());
+}
+
+protected BasicDataSource createDataSource() throws Exception {
+return new BasicDataSource();
+}
+
+public void tearDown() throws Exception {
+super.tearDown();
+ds.close();
+ds = null;
+}
+
+public void testClose() throws Exception {
+ds.setAccessToUnderlyingConnectionAllowed(true);
+
+// active connection is held open when ds is closed
+Connection activeConnection = getConnection();
+Connection rawActiveConnection = ((DelegatingConnection) 
activeConnection).getInnermostDelegate();
+assertFalse(activeConnection.isClosed());
+assertFalse(rawActiveConnection.isClosed());
+
+// idle connection is in pool but closed
+Connection idleConnection = getConnection();
+Connection rawIdleConnection = ((DelegatingConnection) 
idleConnection).getInnermostDelegate();
+assertFalse(idleConnection.isClosed());
+assertFalse(rawIdleConnection.isClosed());
+
+// idle wrapper should be closed but raw connection should be open
+idleConnection.close();
+assertTrue(idleConnection.isClosed());
+assertFalse(rawIdleConnection.isClosed());
+
+ds.close();
+
+// raw idle connection should now be closed
+assertTrue(rawIdleConnection.isClosed());
+
+// active connection should still be open
+assertFalse(activeConnection.isClosed());
+assertFalse(rawActiveConnection.isClosed());
+
+// now close the active connection
+activeConnection.close();
+
+// both wrapper and raw active connection should be closed
+assertTrue(activeConnection.isClosed());
+assertTrue(rawActiveConnection.isClosed());

[tomcat] 07/15: Add TesterCallableStatement from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.

2019-10-25 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

commit 053ca1075545ba61cce553e6829ffa2265e0d1cc
Author: Phil Steitz 
AuthorDate: Sat Oct 19 14:42:46 2019 -0700

Add TesterCallableStatement from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
 .../tomcat/dbcp/dbcp/TesterCallableStatement.java  | 473 +
 1 file changed, 473 insertions(+)

diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java 
b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
new file mode 100644
index 000..851dfbf
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
@@ -0,0 +1,473 @@
+/**
+ *
+ * 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.commons.dbcp;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+/* JDBC_4_ANT_KEY_BEGIN */
+import java.sql.NClob;
+import java.sql.RowId;
+import java.sql.SQLXML;
+/* JDBC_4_ANT_KEY_END */
+
+/**
+ * Trivial implementation of a CallableStatement to avoid null pointer 
exceptions in tests.
+ *
+ * @author Dain Sundstrom
+ * @version $Revision$
+ */
+public class TesterCallableStatement extends TesterPreparedStatement 
implements CallableStatement {
+
+public TesterCallableStatement(Connection conn) {
+super(conn);
+}
+
+public TesterCallableStatement(Connection conn, String sql) {
+super(conn, sql);
+}
+
+public TesterCallableStatement(Connection conn, String sql, int 
resultSetType, int resultSetConcurrency) {
+super(conn, sql, resultSetType, resultSetConcurrency);
+}
+
+public void registerOutParameter(int parameterIndex, int sqlType) throws 
SQLException {
+}
+
+public void registerOutParameter(int parameterIndex, int sqlType, int 
scale) throws SQLException {
+}
+
+public boolean wasNull() throws SQLException {
+return false;
+}
+
+public String getString(int parameterIndex) throws SQLException {
+return null;
+}
+
+public boolean getBoolean(int parameterIndex) throws SQLException {
+return false;
+}
+
+public byte getByte(int parameterIndex) throws SQLException {
+return 0;
+}
+
+public short getShort(int parameterIndex) throws SQLException {
+return 0;
+}
+
+public int getInt(int parameterIndex) throws SQLException {
+return 0;
+}
+
+public long getLong(int parameterIndex) throws SQLException {
+return 0;
+}
+
+public float getFloat(int parameterIndex) throws SQLException {
+return 0;
+}
+
+public double getDouble(int parameterIndex) throws SQLException {
+return 0;
+}
+
+/**
+ * @deprecated
+ */
+public BigDecimal getBigDecimal(int parameterIndex, int scale) throws 
SQLException {
+return null;
+}
+
+public byte[] getBytes(int parameterIndex) throws SQLException {
+return new byte[0];
+}
+
+public Date getDate(int parameterIndex) throws SQLException {
+return null;
+}
+
+public Time getTime(int parameterIndex) throws SQLException {
+return null;
+}
+
+public Timestamp getTimestamp(int parameterIndex) throws SQLException {
+return null;
+}
+
+public Object getObject(int parameterIndex) throws SQLException {
+return null;
+}
+
+public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
+return null;
+}
+
+public Object getObject(int i, Map map) throws SQLException {
+return null;
+}
+
+public Ref getRef(int i) throws SQLException {
+return null;
+}
+
+public Blob getBlob(int i) throws SQLException {
+return null;
+}
+
+public Clob 

[tomcat] branch 7.0.x updated (0c756e4 -> 8191a6a)

2019-10-25 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 0c756e4  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63829
 new 8ba4f46  Add TestBasicDataSource from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new addbdbe  Add TesterDriver from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new baf5895  Add TesterConnection from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new 6b81f37  Add TesterDatabaseMetaData from Commons DBCP 1.5 branch, 
commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new 11f3f49  Add TesterResulSet from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new 36f7f4b  Add TesterPreparedStatement from Commons DBCP 1.5 branch, 
commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new 053ca10  Add TesterCallableStatement from Commons DBCP 1.5 branch, 
commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new edf36aa  Add TesterStatement from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new f406df2  Add TesterClassLoader from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new 9480651  Add TestConnectionPool from Commons DBCP 1.5 branch, commit 
fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
 new 1fd365f  Repackaging.
 new 2015090  Remove unused imports.
 new b18ab5f  Generics.
 new 89ca499  Rename abstract test class so runner does not try to execute 
test cases in it.
 new 8191a6a  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63833

The 15 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:
 .../dbcp/dbcp/PoolableConnectionFactory.java   |   4 +-
 .../dbcp/dbcp/AbstractConnectionPoolTest.java  | 914 +++
 .../tomcat/dbcp/dbcp/TestBasicDataSource.java  | 592 +
 .../tomcat/dbcp/dbcp/TesterCallableStatement.java  | 473 ++
 .../apache/tomcat/dbcp/dbcp/TesterClassLoader.java |  38 +-
 .../apache/tomcat/dbcp/dbcp/TesterConnection.java  | 366 
 .../tomcat/dbcp/dbcp/TesterDatabaseMetaData.java   | 777 
 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java | 134 +++
 .../tomcat/dbcp/dbcp/TesterPreparedStatement.java  | 367 
 .../apache/tomcat/dbcp/dbcp/TesterResultSet.java   | 986 +
 .../apache/tomcat/dbcp/dbcp/TesterStatement.java   | 310 +++
 webapps/docs/changelog.xml |   6 +
 12 files changed, 4949 insertions(+), 18 deletions(-)
 create mode 100644 
test/org/apache/tomcat/dbcp/dbcp/AbstractConnectionPoolTest.java
 create mode 100644 test/org/apache/tomcat/dbcp/dbcp/TestBasicDataSource.java
 create mode 100644 
test/org/apache/tomcat/dbcp/dbcp/TesterCallableStatement.java
 copy java/org/apache/tomcat/dbcp/dbcp/ConnectionFactory.java => 
test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java (58%)
 create mode 100644 test/org/apache/tomcat/dbcp/dbcp/TesterConnection.java
 create mode 100644 test/org/apache/tomcat/dbcp/dbcp/TesterDatabaseMetaData.java
 create mode 100644 test/org/apache/tomcat/dbcp/dbcp/TesterDriver.java
 create mode 100644 
test/org/apache/tomcat/dbcp/dbcp/TesterPreparedStatement.java
 create mode 100644 test/org/apache/tomcat/dbcp/dbcp/TesterResultSet.java
 create mode 100644 test/org/apache/tomcat/dbcp/dbcp/TesterStatement.java


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



[Bug 63875] Tomcat 8.5.46, APR/libtcnative crashes

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63875

--- Comment #11 from sachin.pip...@globallogic.com ---
(In reply to sachin.pipal1 from comment #6)
> (In reply to Remy Maucherat from comment #5)
> > It would be useful to test Tomcat 9 with NIO.
> > The stack indicates a crash on stop only, are the context reloads related to
> > it ?
> 
> Tested with tomcat 9.0.27 with NIO2
> Loaded APR based Apache Tomcat Native library [1.2.23] using APR version
> [1.7.0].
> OpenSSL successfully initialized [OpenSSL 1.1.1c  28 May 2019]
> Please find the attached
> logs.(hs_err_pid27914,SERVER2.server.runlog,SERVER2.System.0)
> Context reload are of during deployment of the webapp.
> 
> 
> 
> 
> 2019-10-25 14:35:16.602, WARNING,
> org.apache.tomcat.util.net.SSLHostConfigorg.apache.tomcat.util.net.
> SSLHostConfig setProtocols
>  - The protocol [TLSv1.1] was added to the list of protocols on the
> SSLHostConfig named [_default_]. Check if a +/- prefix is missing.
> 2019-10-25 14:35:16.602, WARNING,
> org.apache.tomcat.util.net.SSLHostConfigorg.apache.tomcat.util.net.
> SSLHostConfig setProtocols
>  - The protocol [TLSv1] was added to the list of protocols on the
> SSLHostConfig named [_default_]. Check if a +/- prefix is missing.
> 2019-10-25 14:35:16.609, INFO,
> org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.
> AprLifecycleListener lifecycleEvent
>  - Loaded APR based Apache Tomcat Native library [1.2.23] using APR version
> [1.7.0].
> 2019-10-25 14:35:16.609, INFO,
> org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.
> AprLifecycleListener lifecycleEvent
>  - APR capabilities: IPv6 [true], sendfile [true], accept filters [false],
> random [true].
> 2019-10-25 14:35:16.609, INFO,
> org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.
> AprLifecycleListener lifecycleEvent
>  - APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
> 2019-10-25 14:35:16.613, INFO,
> org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.
> AprLifecycleListener initializeSSL
>  - OpenSSL successfully initialized [OpenSSL 1.1.1c  28 May 2019]
> 2019-10-25 14:35:16.620, INFO,
> org.apache.coyote.http11.Http11Nio2Protocolorg.apache.coyote.http11.
> AbstractHttp11Protocol configureUpgradeProtocol
>  - The ["https-openssl-nio2-6090"] connector has been configured to support
> negotiation to [h2] via ALPN

-- 
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



[Bug 63875] Tomcat 8.5.46, APR/libtcnative crashes

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63875

--- Comment #10 from sachin.pip...@globallogic.com ---
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.202-b08 mixed mode linux-amd64
compressed oops)
# Problematic frame:
# C  [libtcnative-1.so+0x2c61be]  apr_pool_cleanup_kill+0x3a
#



Stack: [0x7f91865ec000,0x7f91866ed000],  sp=0x7f91866eb110,  free
space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libtcnative-1.so+0x2c61be]  apr_pool_cleanup_kill+0x3a
C  [libtcnative-1.so+0x2c632c]  apr_pool_cleanup_run+0x2b
j  org.apache.tomcat.jni.SSLContext.free(J)I+0
j  org.apache.tomcat.util.net.openssl.OpenSSLContext.destroy()V+25
j 
org.apache.tomcat.util.net.AbstractEndpoint.releaseSSLContext(Lorg/apache/tomcat/util/net/SSLHostConfig;)V+50
j  org.apache.tomcat.util.net.AbstractEndpoint.destroySsl()V+43
j  org.apache.tomcat.util.net.Nio2Endpoint.unbind()V+16
j  org.apache.tomcat.util.net.AbstractEndpoint.destroy()V+11
j  org.apache.coyote.AbstractProtocol.destroy()V+48
j  org.apache.catalina.connector.Connector.destroyInternal()V+11
j  org.apache.catalina.util.LifecycleBase.destroy()V+239
j  cmg.protocols.http.EmbeddedTomcat.stopService(Ljava/lang/String;)V+97
j  cmg.protocols.http.TomcatController.removeConnector(Ljava/lang/String;)Z+4
j  cmg.stdapp.restservices.frontend.RestWebServicesFE.deactivate()V+31
j 
cmg.services.ConfigurableNodeImpl.stop(Lcom/ericsson/cm/common/configurationmanagement/javabeans/online/ConfigId;ZZZ)Z+146
j 
cmg.communicationmanager.controller.NodeConfigurationHandler.handleManagerRequest(Lcom/ericsson/cm/common/messagingframework/javabeans/Message;)V+1032
j 
cmg.communicationmanager.controller.ManagerRequestHandler$RequestHandlerThread.run()V+299
J 4767 C1
java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V
(225 bytes) @ 0x7f9205dedeb4 [0x7f9205dece80+0x1034]

-- 
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



[Bug 63875] Tomcat 8.5.46, APR/libtcnative crashes

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63875

--- Comment #9 from sachin.pip...@globallogic.com ---
Created attachment 36860
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36860=edit
application log on tomcat9

-- 
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



[Bug 63875] Tomcat 8.5.46, APR/libtcnative crashes

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63875

--- Comment #8 from sachin.pip...@globallogic.com ---
Created attachment 36859
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36859=edit
runlog on tomcat9

-- 
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



[Bug 63875] Tomcat 8.5.46, APR/libtcnative crashes

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63875

--- Comment #7 from sachin.pip...@globallogic.com ---
Created attachment 36858
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36858=edit
JVM log on tomcat9

-- 
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



[Bug 63875] Tomcat 8.5.46, APR/libtcnative crashes

2019-10-25 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=63875

sachin.pip...@globallogic.com changed:

   What|Removed |Added

 Status|NEEDINFO|NEW

--- Comment #6 from sachin.pip...@globallogic.com ---
(In reply to Remy Maucherat from comment #5)
> It would be useful to test Tomcat 9 with NIO.
> The stack indicates a crash on stop only, are the context reloads related to
> it ?

Tested with tomcat 9.0.27 with NIO2
Loaded APR based Apache Tomcat Native library [1.2.23] using APR version
[1.7.0].
OpenSSL successfully initialized [OpenSSL 1.1.1c  28 May 2019]
Please find the attached
logs.(hs_err_pid27914,SERVER2.server.runlog,SERVER2.System.0)
Context reload are of during deployment of the webapp.




2019-10-25 14:35:16.602, SEVERE, module.Communication.HTTP - sachin inside3
getSSLHostConfig _default_
2019-10-25 14:35:16.602, WARNING,
org.apache.tomcat.util.net.SSLHostConfigorg.apache.tomcat.util.net.SSLHostConfig
setProtocols
 - The protocol [TLSv1.1] was added to the list of protocols on the
SSLHostConfig named [_default_]. Check if a +/- prefix is missing.
2019-10-25 14:35:16.602, WARNING,
org.apache.tomcat.util.net.SSLHostConfigorg.apache.tomcat.util.net.SSLHostConfig
setProtocols
 - The protocol [TLSv1] was added to the list of protocols on the SSLHostConfig
named [_default_]. Check if a +/- prefix is missing.
2019-10-25 14:35:16.609, INFO,
org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.AprLifecycleListener
lifecycleEvent
 - Loaded APR based Apache Tomcat Native library [1.2.23] using APR version
[1.7.0].
2019-10-25 14:35:16.609, INFO,
org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.AprLifecycleListener
lifecycleEvent
 - APR capabilities: IPv6 [true], sendfile [true], accept filters [false],
random [true].
2019-10-25 14:35:16.609, INFO,
org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.AprLifecycleListener
lifecycleEvent
 - APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2019-10-25 14:35:16.613, INFO,
org.apache.catalina.core.AprLifecycleListenerorg.apache.catalina.core.AprLifecycleListener
initializeSSL
 - OpenSSL successfully initialized [OpenSSL 1.1.1c  28 May 2019]
2019-10-25 14:35:16.620, INFO,
org.apache.coyote.http11.Http11Nio2Protocolorg.apache.coyote.http11.AbstractHttp11Protocol
configureUpgradeProtocol
 - The ["https-openssl-nio2-6090"] connector has been configured to support
negotiation to [h2] via ALPN

-- 
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