You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2018/08/23 09:42:18 UTC

[directory-ldap-api] branch master updated: A couple of NPE fixes

This is an automated email from the ASF dual-hosted git repository.

semancik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git


The following commit(s) were added to refs/heads/master by this push:
     new c26c197  A couple of NPE fixes
c26c197 is described below

commit c26c197059527fcbce14941c160df6ed3b78f7b1
Author: Radovan Semancik <ra...@evolveum.com>
AuthorDate: Thu Aug 23 11:41:43 2018 +0200

    A couple of NPE fixes
---
 .../org/apache/directory/api/ldap/model/entry/DefaultAttribute.java  | 4 ++--
 .../src/main/java/org/apache/directory/api/ldap/model/name/Dn.java   | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
index 0f8c44c..b1b0557 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
@@ -495,7 +495,7 @@ public class DefaultAttribute implements Attribute, Cloneable
     {
         Value value = get();
 
-        if ( !isHR && ( value != null ) )
+        if ( !isHumanReadable() && ( value != null ) )
         {
             return value.getBytes();
         }
@@ -514,7 +514,7 @@ public class DefaultAttribute implements Attribute, Cloneable
     {
         Value value = get();
 
-        if ( isHR && ( value != null ) )
+        if ( isHumanReadable() && ( value != null ) )
         {
             return value.getValue();
         }
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
index 2616842..c5a0f8a 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
@@ -1082,6 +1082,11 @@ public class Dn implements Iterable<Rdn>, Externalizable
         // Shortcut if the Dn is normalized
         if ( isSchemaAware() )
         {
+            if ( normName == null )
+            {
+                // equals() should never NPE
+                return other.normName == null;
+            }
             return normName.equals( other.normName );
         }