Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1219448

Summary: NPE when configuring both SSL and authentication in the same fluid configuration API for HotRod
Product: [JBoss] JBoss Data Grid 6 Reporter: Thomas Qvarnström <tqvarnst>
Component: ServerAssignee: Tristan Tarrant <ttarrant>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Gencur <mgencur>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.2.1CC: anistor, jdg-bugs
Target Milestone: ER4   
Target Release: 6.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-23 12:24:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas Qvarnström 2015-05-07 11:54:46 UTC
Description of problem:
When adding both ssl() and authentication() in the same fluid api call to HotRod ConfigurationBuilder I get a NullPointerException

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Add the following code to a HotRod client

ClassLoader tccl = Thread.currentThread().getContextClassLoader();
ConfigurationBuilder config = new ConfigurationBuilder();
config.addServer()
    .host(host)
    .port(port)
  .maxRetries(0)
  .security()
    .authentication()
      .serverName("node0")
      .saslMechanism("PLAIN")
      .callbackHandler(new LoginHandler(user, passwd.toCharArray(), "LdapRealm"))
    .ssl()
      .keyStoreFileName(tccl.getResource("keystore.jks").getPath())
      .keyStorePassword("password1".toCharArray())
      .trustStoreFileName(tccl.getResource("keystore.jks").getPath())
      .trustStorePassword("password1".toCharArray())
  .enable();
return new RemoteCacheManager(config.build(), true).getCache(CACHE_NAME);

2. Run 
3.

Actual results:
Even if I don't have a server running I get the following exception.
Exception in thread "main" java.lang.NullPointerException
	at org.infinispan.client.hotrod.configuration.AbstractSecurityConfigurationChildBuilder.ssl(AbstractSecurityConfigurationChildBuilder.java:21)
	at org.jboss.datagrid.demo.LDAPSSLTest.getRemoteCache(LDAPSSLTest.java:91)
	at org.jboss.datagrid.demo.LDAPSSLTest.loadcontent(LDAPSSLTest.java:20)
	at org.jboss.datagrid.demo.LDAPSSLTest.main(LDAPSSLTest.java:47)


Expected results:
Getting a RemoteCache Object back


Additional info:

It works if I separate the ssl() and authentication() in separate statements like this:

ClassLoader tccl = Thread.currentThread().getContextClassLoader();
ConfigurationBuilder config = new ConfigurationBuilder();
config.addServer()
		.host(host)
		.port(port)
	.maxRetries(0)
	.security()
		.authentication()
			.serverName("node0")
			.saslMechanism("PLAIN")
			.callbackHandler(new LoginHandler(user, passwd.toCharArray(), "LdapRealm"))
    .enable(); //End the first configuration statement
config.security()
	.ssl()
		.keyStoreFileName(tccl.getResource("keystore.jks").getPath())
		.keyStorePassword("password1".toCharArray())
		.trustStoreFileName(tccl.getResource("keystore.jks").getPath())
        .trustStorePassword("password1".toCharArray())
	.enable();
		return new RemoteCacheManager(config.build(), true).getCache(CACHE_NAME);