Skip to content

Commit

Permalink
Merge pull request #4011 from katzyn/null
Browse files Browse the repository at this point in the history
Return empty map from JdbcConnection.getTypeMap()
  • Loading branch information
katzyn committed Feb 27, 2024
2 parents 4eaa018 + 6a60a5a commit 8f5c541
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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

0 comments on commit 8f5c541

Please sign in to comment.