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/06/22 11:53:20 UTC

[directory-ldap-api] branch master updated: Fixes to support bad LDAP servers

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 906605c  Fixes to support bad LDAP servers
906605c is described below

commit 906605c801a9af7e8ed4136b090e576e1257fa2c
Author: Radovan Semancik <ra...@evolveum.com>
AuthorDate: Fri Jun 22 13:52:17 2018 +0200

    Fixes to support bad LDAP servers
---
 .../main/java/org/apache/directory/api/ldap/model/entry/Value.java  | 6 ++++--
 .../api/ldap/model/schema/parsers/OpenLdapSchemaParser.java         | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
index ecf46cb..ee5b32d 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
@@ -204,9 +204,11 @@ public class Value implements Cloneable, Externalizable, Comparable<Value>
             if ( attributeType.getSyntax() == null )
             {
                 // Some broken LDAP servers do not have proper syntax definitions, default to HR
-                if ( LOG.isInfoEnabled() )
+                // Log this on trace level only. Otherwise we get logs full of errors when working
+                // with AD and similar not-really-LDAP-compliant servers.
+                if ( LOG.isTraceEnabled() )
                 {
-                    LOG.info( I18n.err( I18n.ERR_13225_NO_SYNTAX ) );
+                    LOG.trace( I18n.err( I18n.ERR_13225_NO_SYNTAX ) );
                 }
                 
                 isHR = true;
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/parsers/OpenLdapSchemaParser.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/parsers/OpenLdapSchemaParser.java
index 3e94751..92eb068 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/parsers/OpenLdapSchemaParser.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/parsers/OpenLdapSchemaParser.java
@@ -2614,6 +2614,8 @@ public class OpenLdapSchemaParser
         }
         catch ( IOException | LdapSchemaException e )
         {
+            // This exception is not passed as a cause in ParseException. Therefore at least log in, so it won't be lost.
+            LOG.trace( "Error parsing attribute type {}: {}", attributeTypeDescription, e.getMessage(), e );
             throw new ParseException( e.getMessage(), 0 );
         }
     }
@@ -2927,7 +2929,9 @@ public class OpenLdapSchemaParser
                 break;
             }
             
-            skipWhites( reader, pos, true );
+            // Make whitespace non-mandatory here.
+            // E.g. OpenDJ is missing the the space in some schema definitions.
+            skipWhites( reader, pos, false );
 
             if ( startsWith( pos, NAME_STR ) )
             {