# HG changeset patch # User Martin van Dinther <martin.van.dinther@monetdbsolutions.com> # Date 1478800707 -3600 # Node ID 562dbfb2fee885e341e0566f6826b3c974f41126 # Parent 5d4524c2790230abe41165c8e72d6f8ec6a064d7 Prevent null pointer exception by checking props argument Extended Changelog for changes made to setClientInfo() methods diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -4,8 +4,11 @@ * Thu Nov 10 2016 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> - Implemented Connection methods: getClientInfo(name) and getClientInfo(). They used to return null and empty Properties object. - Method Connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT) now - throws an SQLFeatureNotSupportedException. + Corrected implementation of Connection methods: setClientInfo(name, value) + and setClientInfo(properties). They are now processed as expected. + Corrected implementation of Connection.setHoldability(holdability). It now + throws an SQLFeatureNotSupportedException when holdability is not + ResultSet.HOLD_CURSORS_OVER_COMMIT (which is the only supported holdability). * Thu Oct 13 2016 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> - Corrected implementation of java.sql.Wrapper methods isWrapperFor() diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java --- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @@ -1448,9 +1448,11 @@ public class MonetConnection extends Mon */ @Override public void setClientInfo(Properties props) throws java.sql.SQLClientInfoException { - for (Entry<Object, Object> entry : props.entrySet()) { - setClientInfo(entry.getKey().toString(), - entry.getValue().toString()); + if (props != null) { + for (Entry<Object, Object> entry : props.entrySet()) { + setClientInfo(entry.getKey().toString(), + entry.getValue().toString()); + } } }