changeset 47:562dbfb2fee8

Prevent null pointer exception by checking props argument Extended Changelog for changes made to setClientInfo() methods
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 10 Nov 2016 18:58:27 +0100 (2016-11-10)
parents 5d4524c27902
children 6cc63d6cb224
files ChangeLog src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- 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());
+			}
 		}
 	}