Bug #72077 Fabric connection with username to a server with disabled auth throws NPE
Submitted: 19 Mar 2014 13:42 Modified: 2 Jun 2015 18:28
Reporter: Jess Balint Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.30 OS:Any
Assigned to: Jess Balint CPU Architecture:Any
Tags: fabric

[19 Mar 2014 13:42] Jess Balint
Description:
The Fabric server requires authentication by default. However, it can be disabled. A connection to a server with authentication disabled should be able to be detected and authentication information skipped.

How to repeat:
Disable auth, try to connect with a non-empty username and non-null password. Following exception is thrown:

Exception in thread "main" java.lang.NullPointerException
at com.mysql.fabric.proto.xmlrpc.DigestAuthentication.parseDigestChallenge(DigestAuthentication.java:147)
at com.mysql.fabric.proto.xmlrpc.AuthenticatedXmlRpcMethodCaller.call(AuthenticatedXmlRpcMethodCaller.java:69)
at testsuite.fabric.jdbc.myXmlRpcClient.errorSafeCallMethod(myXmlRpcClient.java:116)
at testsuite.fabric.jdbc.myXmlRpcClient.getGroupNames(myXmlRpcClient.java:145)
[3 Apr 2015 16:41] Jess Balint
5.1.35 is returning:

java.sql.SQLNonTransientConnectionException: Unable to establish connection to the Fabric server
	at com.mysql.jdbc.exceptions.SQLError.createSQLException(SQLError.java:705)
	at com.mysql.jdbc.exceptions.SQLError.createSQLException(SQLError.java:692)
	at com.mysql.jdbc.exceptions.SQLError.createSQLException(SQLError.java:681)
	at com.mysql.jdbc.exceptions.SQLError.createSQLException(SQLError.java:627)
	at com.mysql.jdbc.exceptions.SQLError.createSQLException(SQLError.java:659)
	at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:187)
	at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:73)
	at com.mysql.fabric.jdbc.FabricMySQLDataSource.getConnection(FabricMySQLDataSource.java:125)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:136)
	at testsuite.fabric.jdbc.TestHABasics.setUp(TestHABasics.java:55)
Caused by: com.mysql.fabric.FabricCommunicationException: Unable to obtain challenge header for authentication
	at com.mysql.fabric.proto.xmlrpc.AuthenticatedXmlRpcMethodCaller.call(AuthenticatedXmlRpcMethodCaller.java:63)
	at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.errorSafeCallMethod(XmlRpcClient.java:149)
	at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:198)
	at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:218)
	at com.mysql.fabric.FabricConnection.refreshState(FabricConnection.java:68)
	at com.mysql.fabric.FabricConnection.<init>(FabricConnection.java:43)
	at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:185)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:32274
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1839)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
	at com.mysql.fabric.proto.xmlrpc.DigestAuthentication.getChallengeHeader(DigestAuthentication.java:50)
	at com.mysql.fabric.proto.xmlrpc.AuthenticatedXmlRpcMethodCaller.call(AuthenticatedXmlRpcMethodCaller.java:61)
[2 Jun 2015 18:28] Daniel So
Added the following entry to the Connector/J 5.1.36 changelog:

"Using Connector/J to connect with non-null user name and password to a MySQL Fabric server that had authentication disabled resulted in a null pointer exception."