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 2022/01/13 05:38:45 UTC

[directory-ldap-api] branch master updated: Fixed come compilation failures

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

elecharny 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 cd94294  Fixed come compilation failures
cd94294 is described below

commit cd94294893c95ab978c4ea7c949bba96b27346d1
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Thu Jan 13 06:38:37 2022 +0100

    Fixed come compilation failures
---
 .../api/ldap/entry/SchemaAwareAttributeTest.java        | 10 ----------
 .../directory/api/ldap/model/filter/FilterParser.java   |  8 ++++----
 .../directory/api/ldap/model/filter/UndefinedNode.java  | 17 ++++++++++++++---
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/integ/src/test/java/org/apache/directory/api/ldap/entry/SchemaAwareAttributeTest.java b/integ/src/test/java/org/apache/directory/api/ldap/entry/SchemaAwareAttributeTest.java
index 16ae2c4..b2ba705 100644
--- a/integ/src/test/java/org/apache/directory/api/ldap/entry/SchemaAwareAttributeTest.java
+++ b/integ/src/test/java/org/apache/directory/api/ldap/entry/SchemaAwareAttributeTest.java
@@ -33,7 +33,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.text.ParseException;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -44,8 +43,6 @@ import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
-import org.apache.directory.api.ldap.model.filter.FilterParser;
-import org.apache.directory.api.ldap.model.filter.SimpleNode;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
@@ -2128,11 +2125,4 @@ public class SchemaAwareAttributeTest
         assertTrue( dsaSer.contains( password ) );
         assertFalse( dsaSer.isHumanReadable() );
     }
-    
-    
-    @Test
-    public void testFilter() throws ParseException
-    {
-        SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( schemaManager, "(uniqueMember=cn=abc*)" );
-    }
 }
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
index 17d964b..478232e 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
@@ -138,7 +138,7 @@ public final class FilterParser
         {
             ExprNode node = parseFilterInternal( schemaManager, filterBytes, pos, relaxed );
             
-            if ( node == UndefinedNode.UNDEFINED_NODE )
+            if ( node instanceof UndefinedNode )
             {
                 return null;
             }
@@ -187,7 +187,7 @@ public final class FilterParser
             }
             else
             {
-                return UndefinedNode.UNDEFINED_NODE;
+                return new UndefinedNode( attribute );
             }
         }
         else
@@ -907,7 +907,7 @@ public final class FilterParser
                         }
                         else
                         {
-                            return UndefinedNode.UNDEFINED_NODE;
+                            return new UndefinedNode( attribute );
                         }
                     }
 
@@ -1018,7 +1018,7 @@ public final class FilterParser
         // We must have at least one filter
         ExprNode child = parseFilterInternal( schemaManager, filterBytes, pos, relaxed );
 
-        if ( child != UndefinedNode.UNDEFINED_NODE )
+        if ( !( child instanceof UndefinedNode ) )
         {
             // Add the child to the node children
             branchNode.addNode( child );
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/UndefinedNode.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/UndefinedNode.java
index c1c1690..a19300e 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/UndefinedNode.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/UndefinedNode.java
@@ -28,15 +28,20 @@ package org.apache.directory.api.ldap.model.filter;
 public final class UndefinedNode extends AbstractExprNode
 {
     /** A static instance of this node */
-    public static final UndefinedNode UNDEFINED_NODE = new UndefinedNode();
+    public static final UndefinedNode UNDEFINED_NODE = new UndefinedNode( "" );
+
+    /** attribute on which this leaf is based */
+    protected String attribute;
 
 
     /**
      * Creates a new instance of UndefinedNode.
      */
-    private UndefinedNode()
+    public UndefinedNode( String attribute )
     {
         super( AssertionType.UNDEFINED );
+
+        this.attribute = attribute;
     }
 
 
@@ -75,6 +80,12 @@ public final class UndefinedNode extends AbstractExprNode
         return false;
     }
 
+    
+    public void setAttribute( String attribute )
+    {
+        this.attribute = attribute;
+    }
+    
 
     /**
      * {@inheritDoc}
@@ -82,6 +93,6 @@ public final class UndefinedNode extends AbstractExprNode
     @Override
     public String toString()
     {
-        return "Undefined";
+        return "(Undefined:" + attribute + ")";
     }
 }