Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return empty map from JdbcConnection.getTypeMap() #4011

Merged
merged 1 commit into from Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions h2/src/docsrc/html/changelog.html
Expand Up @@ -21,6 +21,14 @@ <h1>Change Log</h1>

<h2>Next Version (unreleased)</h2>
<ul>
<li>Issue #4010: org.h2.jdbc.JdbcConnection.getTypeMap() returns null
</li>
<li>PR #4007: Update pom.xml related to CVE-2024-1597
</li>
<li>Issue #3907: MvStoreTool unable to Repair() or Rollback() [2.1.214]
</li>
<li>RP #3997: Server-side batch execution for prepared statements
</li>
<li>Issue #3106: Trailing commas in SELECT are accepted by the parser
</li>
<li>PR #3992: Add IPv6 support to H2 Console
Expand Down
4 changes: 2 additions & 2 deletions h2/src/main/org/h2/jdbc/JdbcConnection.java
Expand Up @@ -830,7 +830,7 @@ public Map<String, Class<?>> getTypeMap() throws SQLException {
try {
debugCodeCall("getTypeMap");
checkClosed();
return null;
return Map.of();
} catch (Exception e) {
throw logAndConvert(e);
}
Expand Down Expand Up @@ -1861,7 +1861,7 @@ public int getNetworkTimeout() {
* @throws DbException if the map is not empty
*/
static void checkMap(Map<String, Class<?>> map) {
if (map != null && map.size() > 0) {
if (map != null && !map.isEmpty()) {
throw DbException.getUnsupportedException("map.size > 0");
}
}
Expand Down
1 change: 1 addition & 0 deletions h2/src/test/org/h2/test/jdbc/TestStatement.java
Expand Up @@ -69,6 +69,7 @@ private void testUnwrap() throws SQLException {
}

private void testUnsupportedOperations() throws Exception {
assertTrue(conn.getTypeMap().isEmpty());
conn.setTypeMap(null);
HashMap<String, Class<?>> map = new HashMap<>();
conn.setTypeMap(map);
Expand Down