Changeset: cbce93e41ef6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cbce93e41ef6
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
Branch: default
Log Message:
Prevent Null Pointer Exceptions in ResultSet methods for when header is null.
This can happen when using MonetVirtualResultSet (which is a subclass of
MonetResult but with empty header).
diffs (30 lines):
diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -272,7 +272,7 @@ public class MonetResultSet extends Mone
*/
@Override
public void close() {
- if (!header.isClosed()) {
+ if (header != null && !header.isClosed()) {
header.close();
}
if (statement instanceof MonetStatement)
@@ -3007,7 +3007,7 @@ public class MonetResultSet extends Mone
*/
@Override
public SQLWarning getWarnings() throws SQLException {
- if (header.isClosed())
+ if (header != null && header.isClosed())
throw new SQLException("Cannot call on closed
ResultSet", "M1M20");
// if there are no warnings, this will be null, which fits with
the
@@ -3049,7 +3049,7 @@ public class MonetResultSet extends Mone
*/
@Override
public boolean isClosed() {
- return header.isClosed();
+ return header != null && header.isClosed();
}
/**
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list