You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/05/05 00:46:37 UTC
svn commit: r771484 -
/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
Author: elecharny
Date: Mon May 4 22:46:36 2009
New Revision: 771484
URL: http://svn.apache.org/viewvc?rev=771484&view=rev
Log:
Fixed a NPE for Anonymous bind
Modified:
directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=771484&r1=771483&r2=771484&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java (original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Mon May 4 22:46:36 2009
@@ -271,6 +271,7 @@
if ( writeFuture.getException() != null )
{
+ writeFuture.getException().printStackTrace();
String message = "We have got an exception while writing the request : " +
writeFuture.getException().getMessage();
LOG.error( message );
@@ -1032,13 +1033,30 @@
{
// Simple bind
authentication = new SimpleAuthentication();
- ((SimpleAuthentication)authentication).setSimple( bindRequest.getCredentials() );
+
+ if ( bindRequest.getCredentials() != null )
+ {
+ ((SimpleAuthentication)authentication).setSimple( bindRequest.getCredentials() );
+ }
+ else
+ {
+ ((SimpleAuthentication)authentication).setSimple( StringTools.EMPTY_BYTES );
+ }
}
else
{
// SASL bind
authentication = new SaslCredentials();
- ((SaslCredentials)authentication).setCredentials( bindRequest.getCredentials() );
+
+ if ( bindRequest.getCredentials() != null )
+ {
+ ((SaslCredentials)authentication).setCredentials( bindRequest.getCredentials() );
+ }
+ else
+ {
+ ((SaslCredentials)authentication).setCredentials( StringTools.EMPTY_BYTES );
+ }
+
((SaslCredentials)authentication).setMechanism( bindRequest.getSaslMechanism() );
}