You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/07/04 19:21:31 UTC
[tomcat] branch main updated (06d0c35557 -> 3ca1ca2ad3)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from 06d0c35557 Explicitly close streams
new 2eae3f7f56 Increment version for next development cycle
new 3ca1ca2ad3 Fix potential resource leaks
The 2 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:
build.properties.default | 2 +-
.../catalina/users/DataSourceUserDatabase.java | 58 +++++++++++-----------
res/maven/mvn.properties.default | 2 +-
webapps/docs/changelog.xml | 12 ++++-
4 files changed, 41 insertions(+), 33 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 02/02: Fix potential resource leaks
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 3ca1ca2ad3beecd975860d331ade5869023ccabc
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 4 20:21:11 2023 +0100
Fix potential resource leaks
---
.../catalina/users/DataSourceUserDatabase.java | 58 +++++++++++-----------
webapps/docs/changelog.xml | 8 +++
2 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 47a7a4a42e..d79082d758 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -465,27 +465,26 @@ public class DataSourceUserDatabase extends SparseUserDatabase {
groups.putAll(createdGroups);
groups.putAll(modifiedGroups);
- Connection dbConnection = openConnection();
- if (dbConnection != null && preparedAllGroups != null) {
- try (PreparedStatement stmt = dbConnection.prepareStatement(preparedAllGroups)) {
- try (ResultSet rs = stmt.executeQuery()) {
- while (rs.next()) {
- String groupName = rs.getString(1);
- if (groupName != null) {
- if (!groups.containsKey(groupName) && !removedGroups.containsKey(groupName)) {
- Group group = findGroupInternal(dbConnection, groupName);
- if (group != null) {
- groups.put(groupName, group);
+ try (Connection dbConnection = openConnection()) {
+ if (dbConnection != null && preparedAllGroups != null) {
+ try (PreparedStatement stmt = dbConnection.prepareStatement(preparedAllGroups)) {
+ try (ResultSet rs = stmt.executeQuery()) {
+ while (rs.next()) {
+ String groupName = rs.getString(1);
+ if (groupName != null) {
+ if (!groups.containsKey(groupName) && !removedGroups.containsKey(groupName)) {
+ Group group = findGroupInternal(dbConnection, groupName);
+ if (group != null) {
+ groups.put(groupName, group);
+ }
}
}
}
}
}
- } catch (SQLException e) {
- log.error(sm.getString("dataSourceUserDatabase.exception"), e);
- } finally {
- closeConnection(dbConnection);
}
+ } catch (SQLException e) {
+ log.error(sm.getString("dataSourceUserDatabase.exception"), e);
}
return groups.values().iterator();
} finally {
@@ -506,27 +505,26 @@ public class DataSourceUserDatabase extends SparseUserDatabase {
roles.putAll(createdRoles);
roles.putAll(modifiedRoles);
- Connection dbConnection = openConnection();
- if (dbConnection != null && preparedAllRoles != null) {
- try (PreparedStatement stmt = dbConnection.prepareStatement(preparedAllRoles)) {
- try (ResultSet rs = stmt.executeQuery()) {
- while (rs.next()) {
- String roleName = rs.getString(1);
- if (roleName != null) {
- if (!roles.containsKey(roleName) && !removedRoles.containsKey(roleName)) {
- Role role = findRoleInternal(dbConnection, roleName);
- if (role != null) {
- roles.put(roleName, role);
+ try (Connection dbConnection = openConnection()) {
+ if (dbConnection != null && preparedAllRoles != null) {
+ try (PreparedStatement stmt = dbConnection.prepareStatement(preparedAllRoles)) {
+ try (ResultSet rs = stmt.executeQuery()) {
+ while (rs.next()) {
+ String roleName = rs.getString(1);
+ if (roleName != null) {
+ if (!roles.containsKey(roleName) && !removedRoles.containsKey(roleName)) {
+ Role role = findRoleInternal(dbConnection, roleName);
+ if (role != null) {
+ roles.put(roleName, role);
+ }
}
}
}
}
}
- } catch (SQLException e) {
- log.error(sm.getString("dataSourceUserDatabase.exception"), e);
- } finally {
- closeConnection(dbConnection);
}
+ } catch (SQLException e) {
+ log.error(sm.getString("dataSourceUserDatabase.exception"), e);
}
return roles.values().iterator();
} finally {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 142b486c3b..671cffadfa 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 11.0.0-M10 (markt)" rtext="in development">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ Fix potential database connection leaks in
+ <code>DataSourceUserDatabase</code> identified by Coverity Scan. (markt)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 11.0.0-M9 (markt)" rtext="release in progress">
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 01/02: Increment version for next development cycle
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 2eae3f7f5665e3479d9e13ce436b6ee90d648cba
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 4 20:18:34 2023 +0100
Increment version for next development cycle
---
build.properties.default | 2 +-
res/maven/mvn.properties.default | 2 +-
webapps/docs/changelog.xml | 4 +++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/build.properties.default b/build.properties.default
index d7704a2349..013329919a 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -33,7 +33,7 @@ version.major=11
version.minor=0
version.build=0
version.patch=0
-version.suffix=-M9
+version.suffix=-M10
version.dev=-dev
# ----- Build tools -----
diff --git a/res/maven/mvn.properties.default b/res/maven/mvn.properties.default
index 40f701f0e2..94795ac67f 100644
--- a/res/maven/mvn.properties.default
+++ b/res/maven/mvn.properties.default
@@ -39,7 +39,7 @@ maven.asf.release.repo.url=https://repository.apache.org/service/local/staging/d
maven.asf.release.repo.repositoryId=apache.releases.https
# Release version info
-maven.asf.release.deploy.version=11.0.0-M9
+maven.asf.release.deploy.version=11.0.0-M10
#Where do we load the libraries from
tomcat.lib.path=../../output/build/lib
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c15078d332..142b486c3b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -104,7 +104,9 @@
They eventually become mixed with the numbered issues (i.e., numbered
issues do not "pop up" wrt. others).
-->
-<section name="Tomcat 11.0.0-M9 (markt)" rtext="in development">
+<section name="Tomcat 11.0.0-M10 (markt)" rtext="in development">
+</section>
+<section name="Tomcat 11.0.0-M9 (markt)" rtext="release in progress">
<subsection name="Other">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org