directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r1028848 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/filter/ test/java/org/apache/directory/shared/ldap/filter/
Date Fri, 29 Oct 2010 17:04:53 GMT
Author: felixk
Date: Fri Oct 29 17:04:52 2010
New Revision: 1028848

URL: http://svn.apache.org/viewvc?rev=1028848&view=rev
Log:
Fix DIRSHARED-69
Thanks Steven for pointing

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java?rev=1028848&r1=1028847&r2=1028848&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
Fri Oct 29 17:04:52 2010
@@ -145,6 +145,11 @@ public abstract class AbstractExprNode i
      */
     protected static Value<?> escapeFilterValue( Value<?> value )
     {
+        if ( value.isNull() )
+        {
+            return value;
+        }
+
         StringBuilder sb = null;
         String val;
 
@@ -195,7 +200,7 @@ public abstract class AbstractExprNode i
                     sb.append( digit.toUpperCase() );
                 }
             }
-            
+
             return new StringValue( sb.toString() );
         }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java?rev=1028848&r1=1028847&r2=1028848&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
Fri Oct 29 17:04:52 2010
@@ -72,7 +72,13 @@ public class ApproximateNode<T> extends 
             buf.append( attribute );
         }
         
-        buf.append( "~=" ).append( getEscapedValue() );
+        buf.append( "~=" );
+
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
         

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java?rev=1028848&r1=1028847&r2=1028848&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
Fri Oct 29 17:04:52 2010
@@ -74,7 +74,13 @@ public class EqualityNode<T> extends Sim
             buf.append( attribute );
         }
         
-        buf.append( "=" ).append( getEscapedValue() );
+        buf.append( "=" );
+        
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
         

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java?rev=1028848&r1=1028847&r2=1028848&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
Fri Oct 29 17:04:52 2010
@@ -74,7 +74,13 @@ public class GreaterEqNode<T> extends Si
             buf.append( attribute );
         }
         
-        buf.append( ">=" ).append( getEscapedValue() );
+        buf.append( ">=" );
+
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java?rev=1028848&r1=1028847&r2=1028848&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
Fri Oct 29 17:04:52 2010
@@ -74,7 +74,13 @@ public class LessEqNode<T> extends Simpl
             buf.append( attribute );
         }
         
-        buf.append( "<=" ).append( getEscapedValue() );
+        buf.append( "<=" );
+
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java?rev=1028848&r1=1028847&r2=1028848&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java
Fri Oct 29 17:04:52 2010
@@ -45,6 +45,34 @@ public class FilterToStringTest
         String str = "(ou=test)";
         ExprNode node = FilterParser.parse( str );
         assertEquals( str, node.toString() );
+
+        str = "(ou~=test)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str = "(ou>=test)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str = "(ou<=test)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou~=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou>=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou<=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
     }
 
 



Mime
View raw message