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 2015/10/13 20:56:51 UTC
svn commit: r1708486 [1/2] - in /directory/shared/trunk:
integ/src/test/java/org/apache/directory/api/ldap/model/name/
ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/
ldap/model/src/main/antlr/ ldap/model/src/main/java/org/apache/di...
Author: elecharny
Date: Tue Oct 13 18:56:51 2015
New Revision: 1708486
URL: http://svn.apache.org/viewvc?rev=1708486&view=rev
Log:
o Propagated the SchemaManager down to the AVA and Value classes
o Fixed failing tests
o Create one single instance of the LDAP codec
Modified:
directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareAvaSerializationTest.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnSerializationTest.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnTest.java
directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/AbstractValue.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/BinaryValue.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/StringValue.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifRevertor.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Dn.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/FastDnParser.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PrepareString.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaSerializationTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/FastDnParserTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizerTest.java
directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java Tue Oct 13 18:56:51 2015
@@ -238,9 +238,9 @@ public class AvaTest
errors += "\nAva.getNormType fails '" + ava.getNormType() + "'";
}
- if ( !"Exemple + Rdn\u00E4 ".equals( ava.getNormValue().getString() ) )
+ if ( !"Exemple + Rdn\u00E4 ".equals( ava.getValue().getNormValue().toString() ) )
{
- errors += "\nAva.getNormValue fails '" + ava.getNormValue().getString() + "'";
+ errors += "\nAva.getNormValue fails '" + ava.getValue().getNormValue().toString() + "'";
}
if ( !"OU=Exemple \\+ Rdn\u00E4\\ ".equals( ava.getName() ) )
@@ -281,9 +281,9 @@ public class AvaTest
{
String errors = null;
- Ava ava = new Ava( schemaManager, "OU", "Exemple + Rdn\u00E4 " );
+ Ava ava = new Ava( schemaManager, "OU", "Exemple + Rdn\u002B " );
- if ( !"2.5.4.11=exemple \\+ rdn\u00E4".equals( ava.getNormName() ) )
+ if ( !"2.5.4.11=exemple \\+ rdn\\+".equals( ava.getNormName() ) )
{
errors = "\nAva.getNormName fails '" + ava.getNormName() + "'";
}
@@ -293,12 +293,12 @@ public class AvaTest
errors += "\nAva.getNormType fails '" + ava.getNormType() + "'";
}
- if ( !"exemple + rdn\u00E4".equals( ava.getNormValue().getString() ) )
+ if ( !"exemple + rdn\u002B".equals( ava.getValue().getNormValue().toString() ) )
{
- errors += "\nAva.getNormValue fails '" + ava.getNormValue().getString() + "'";
+ errors += "\nAva.getNormValue fails '" + ava.getValue().getNormValue().toString() + "'";
}
- if ( !"OU=Exemple \\+ Rdn\u00E4\\ ".equals( ava.getName() ) )
+ if ( !"OU=Exemple \\+ Rdn\\+\\ ".equals( ava.getName() ) )
{
errors += "\nAva.getUpName fails '" + ava.getName() + "'";
}
@@ -308,17 +308,17 @@ public class AvaTest
errors += "\nAva.getUpType fails '" + ava.getType() + "'";
}
- if ( !"Exemple + Rdn\u00E4 ".equals( ava.getValue().getString() ) )
+ if ( !"Exemple + Rdn\u002B ".equals( ava.getValue().getString() ) )
{
errors += "\nAva.getUpValue fails '" + ava.getValue().getString() + "'";
}
- if ( !"2.5.4.11=exemple \\+ rdn\u00E4".equals( ava.normalize() ) )
+ if ( !"2.5.4.11=exemple \\+ rdn\\+".equals( ava.normalize() ) )
{
errors += "\nAva.normalize fails '" + ava.normalize() + "'";
}
- if ( !"OU=Exemple \\+ Rdn\u00E4\\ ".equals( ava.toString() ) )
+ if ( !"OU=Exemple \\+ Rdn\\+\\ ".equals( ava.toString() ) )
{
errors += "\nAva.toString fails '" + ava.toString() + "'";
}
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/DnTest.java Tue Oct 13 18:56:51 2015
@@ -417,6 +417,24 @@ public class DnTest
/**
+ * Normalize a Dn with sequence ESC ESC HEX HEX (\\C3\\A4).
+ * This is a corner case for the parser and normalizer.
+ */
+ @Test
+ public void testNormalizeDnEscEscHexHexEscSpecial() throws LdapException
+ {
+ Dn dn = new Dn( "ou = AC\\\\C3\\2B" );
+ assertTrue( Dn.isValid( "ou = AC\\\\C3\\2B" ) );
+ assertEquals( "ou=AC\\\\C3\\+", dn.getNormName() );
+ assertEquals( "ou = AC\\\\C3\\2B", dn.getName() );
+
+ // Check the normalization now
+ Dn ndn = dn.apply( schemaManager );
+ assertEquals( "ou = AC\\\\C3\\2B", ndn.getName() );
+ assertEquals( "2.5.4.11=ac\\\\c3\\+", ndn.getNormName() );
+ }
+
+ /**
* Normalize a Dn with sequence ESC ESC HEX HEX (\\DC).
* This is a corner case for the parser and normalizer.
*/
@@ -2495,38 +2513,38 @@ public class DnTest
assertEquals( " cn = Amos\\,Tori ", dn1.getRdn().getName() );
Ava atav1 = dn1.getRdn().getAva();
assertEquals( "cn", atav1.getType() );
- assertEquals( "Amos,Tori", atav1.getValue().getString() );
+ assertEquals( "Amos\\,Tori", atav1.getValue().getValue() );
// antlr parser: hexstring with trailing spaces
Dn dn3 = new Dn( " cn = #414243 , ou=system " );
assertEquals( " cn = #414243 ", dn3.getRdn().getName() );
Ava atav3 = dn3.getRdn().getAva();
assertEquals( "cn", atav3.getType() );
- assertEquals( "ABC", atav3.getValue().getString() );
- assertTrue( Arrays.equals( Strings.getBytesUtf8( "ABC" ), atav3.getNormValue().getBytes() ) );
+ assertTrue( Arrays.equals( Strings.getBytesUtf8( "ABC" ), (byte[])atav3.getValue().getValue() ) );
+ assertTrue( Arrays.equals( Strings.getBytesUtf8( "ABC" ), atav3.getValue().getBytes() ) );
// antlr parser:
Dn dn4 = new Dn( " cn = \\41\\42\\43 , ou=system " );
assertEquals( " cn = \\41\\42\\43 ", dn4.getRdn().getName() );
Ava atav4 = dn4.getRdn().getAva();
assertEquals( "cn", atav4.getType() );
- assertEquals( "ABC", atav4.getValue().getString() );
- assertEquals( "ABC", atav4.getNormValue().getString() );
+ assertEquals( "\\41\\42\\43", atav4.getValue().getValue() );
+ assertEquals( "ABC", atav4.getValue().getNormValue() );
// antlr parser: quotestring with trailing spaces
Dn dn5 = new Dn( " cn = \"ABC\" , ou=system " );
assertEquals( " cn = \"ABC\" ", dn5.getRdn().getName() );
Ava atav5 = dn5.getRdn().getAva();
assertEquals( "cn", atav5.getType() );
- assertEquals( "\"ABC\"", atav5.getValue().getString() );
- assertEquals( "ABC", atav5.getNormValue().getString() );
+ assertEquals( "\"ABC\"", atav5.getValue() .getValue());
+ assertEquals( "ABC", atav5.getValue().getNormValue() );
// fast parser: string value with trailing spaces
Dn dn2 = new Dn( " cn = Amos Tori , ou=system " );
assertEquals( " cn = Amos Tori ", dn2.getRdn().getName() );
Ava atav2 = dn2.getRdn().getAva();
assertEquals( "cn", atav2.getType() );
- assertEquals( "Amos Tori", atav2.getValue().getString() );
+ assertEquals( "Amos Tori", atav2.getValue().getValue() );
}
@@ -2540,16 +2558,16 @@ public class DnTest
Dn dn1 = new Dn( "ou=A\\ ,ou=system" );
dn1.apply( schemaManager );
assertEquals( "ou=A\\ ,ou=system", dn1.getName() );
- assertEquals( "2.5.4.11=a,2.5.4.11=system", dn1.getNormName() );
+ assertEquals( "2.5.4.11=a\\ ,2.5.4.11=system", dn1.getNormName() );
assertEquals( "ou=A\\ ", dn1.getRdn().getName() );
- assertEquals( "2.5.4.11=a", dn1.getRdn().getNormName() );
+ assertEquals( "2.5.4.11=a\\ ", dn1.getRdn().getNormName() );
Dn dn2 = new Dn( "ou=A\\20,ou=system" );
dn2.apply( schemaManager );
assertEquals( "ou=A\\20,ou=system", dn2.getName() );
- assertEquals( "2.5.4.11=a,2.5.4.11=system", dn2.getNormName() );
+ assertEquals( "2.5.4.11=a\\ ,2.5.4.11=system", dn2.getNormName() );
assertEquals( "ou=A\\20", dn2.getRdn().getName() );
- assertEquals( "2.5.4.11=a", dn2.getRdn().getNormName() );
+ assertEquals( "2.5.4.11=a\\ ", dn2.getRdn().getNormName() );
Dn dn3 = new Dn( "ou=\\ ,ou=system" );
dn3.apply( schemaManager );
@@ -2616,17 +2634,17 @@ public class DnTest
Rdn rdn = dn.getRdn();
assertEquals( "2.5.4.11", rdn.getNormType() );
- assertEquals( "example", rdn.getNormValue().getString() );
+ assertEquals( "example", rdn.getNormValue() );
assertEquals( "2.5.4.11=example", rdn.getNormName() );
assertEquals( "ou", rdn.getType() );
- assertEquals( "Example", rdn.getValue().getString() );
+ assertEquals( "Example", rdn.getValue() );
assertEquals( " ou = Example ", rdn.getName() );
Ava atav = rdn.getAva();
assertEquals( "2.5.4.11=example", atav.getNormName() );
assertEquals( "2.5.4.11", atav.getNormType() );
- assertEquals( "example", atav.getNormValue().getValue() );
+ assertEquals( "example", atav.getValue().getNormValue().toString() );
assertEquals( "ou", atav.getType() );
assertEquals( "Example", atav.getValue().getValue() );
@@ -2646,10 +2664,10 @@ public class DnTest
Rdn rdn = dn.getRdn();
assertEquals( "2.5.4.11", rdn.getNormType() );
- assertEquals( "example", rdn.getNormValue().getString() );
+ assertEquals( "example", rdn.getNormValue() );
assertEquals( "2.5.4.11=example+2.5.4.3=test", rdn.getNormName() );
assertEquals( "ou", rdn.getType() );
- assertEquals( "Example", rdn.getValue().getString() );
+ assertEquals( "Example", rdn.getValue() );
assertEquals( " ou = Example + cn = TEST ", rdn.getName() );
// The first ATAV
@@ -2657,7 +2675,7 @@ public class DnTest
assertEquals( "2.5.4.11=example", atav.getNormName() );
assertEquals( "2.5.4.11", atav.getNormType() );
- assertEquals( "example", atav.getNormValue().getValue() );
+ assertEquals( "example", atav.getValue().getNormValue().toString() );
assertEquals( "ou", atav.getType() );
assertEquals( "Example", atav.getValue().getValue() );
@@ -2669,7 +2687,7 @@ public class DnTest
// The second ATAV
for ( Ava ava : rdn )
{
- if ( "example".equals( ava.getNormValue().getValue() ) )
+ if ( "example".equals( ava.getValue().getNormValue().toString() ) )
{
// Skip the first one
continue;
@@ -2677,7 +2695,7 @@ public class DnTest
assertEquals( "2.5.4.3=test", ava.getNormName() );
assertEquals( "2.5.4.3", ava.getNormType() );
- assertEquals( "test", ava.getNormValue().getValue() );
+ assertEquals( "test", ava.getValue().getNormValue().toString() );
assertEquals( "cn", ava.getType() );
assertEquals( "TEST", ava.getValue().getValue() );
@@ -2697,20 +2715,20 @@ public class DnTest
Rdn rdn = dn.getRdn();
assertEquals( "2.5.4.11", rdn.getNormType() );
- assertEquals( "ex+mple", rdn.getNormValue().getString() );
+ assertEquals( "ex+mple", rdn.getNormValue() );
assertEquals( "2.5.4.11=ex\\+mple", rdn.getNormName() );
assertEquals( "ou", rdn.getType() );
- assertEquals( "Ex+mple", rdn.getValue().getString() );
+ assertEquals( "Ex\\+mple", rdn.getValue() );
assertEquals( " ou = Ex\\+mple ", rdn.getName() );
Ava atav = rdn.getAva();
assertEquals( "2.5.4.11=ex\\+mple", atav.getNormName() );
assertEquals( "2.5.4.11", atav.getNormType() );
- assertEquals( "ex+mple", atav.getNormValue().getValue() );
+ assertEquals( "ex+mple", atav.getValue().getNormValue().toString() );
assertEquals( "ou", atav.getType() );
- assertEquals( "Ex+mple", atav.getValue().getValue() );
+ assertEquals( "Ex\\+mple", atav.getValue().getValue() );
assertEquals( " ou = Ex\\+mple ", atav.getName() );
}
@@ -2734,8 +2752,8 @@ public class DnTest
assertEquals( "OU", rdn.getType() );
assertEquals( "ou", rdn.getNormType() );
- assertEquals( "Ex+mple", rdn.getValue().getString() );
- assertEquals( "Ex+mple", rdn.getNormValue().getString() );
+ assertEquals( "Ex\\+mple", rdn.getValue() );
+ assertEquals( "Ex+mple", rdn.getNormValue() );
// The first ATAV
Ava atav = rdn.getAva();
@@ -2746,15 +2764,15 @@ public class DnTest
assertEquals( "ou", atav.getNormType() );
assertEquals( "OU", atav.getType() );
- assertEquals( "Ex+mple", atav.getValue().getValue() );
- assertEquals( "Ex+mple", atav.getNormValue().getValue() );
+ assertEquals( "Ex\\+mple", atav.getValue().getValue() );
+ assertEquals( "Ex+mple", atav.getValue().getNormValue().toString() );
assertEquals( 2, rdn.size() );
// The second ATAV
for ( Ava ava : rdn )
{
- if ( "Ex+mple".equals( ava.getNormValue().getValue() ) )
+ if ( "Ex+mple".equals( ava.getValue().getNormValue().toString() ) )
{
// Skip the first one
continue;
@@ -2766,8 +2784,8 @@ public class DnTest
assertEquals( "cn", ava.getType() );
assertEquals( "cn", ava.getNormType() );
- assertEquals( "T+ST", ava.getValue().getValue() );
- assertEquals( "T+ST ", ava.getNormValue().getValue() );
+ assertEquals( "T\\+ST\\ ", ava.getValue().getValue() );
+ assertEquals( "T+ST ", ava.getValue().getNormValue().toString() );
}
// ------------------------------------------------------------------
@@ -2775,18 +2793,18 @@ public class DnTest
dn.apply( schemaManager );
assertEquals( " OU = Ex\\+mple + cn = T\\+ST\\ , ou = COM ", dn.getName() );
- assertEquals( "2.5.4.11=ex\\+mple+2.5.4.3=t\\+st,2.5.4.11=com", dn.getNormName() );
+ assertEquals( "2.5.4.11=ex\\+mple+2.5.4.3=t\\+st\\ ,2.5.4.11=com", dn.getNormName() );
// Check the first Rdn
rdn = dn.getRdn();
assertEquals( " OU = Ex\\+mple + cn = T\\+ST\\ ", rdn.getName() );
- assertEquals( "2.5.4.11=ex\\+mple+2.5.4.3=t\\+st", rdn.getNormName() );
+ assertEquals( "2.5.4.11=ex\\+mple+2.5.4.3=t\\+st\\ ", rdn.getNormName() );
assertEquals( "OU", rdn.getType() );
assertEquals( "2.5.4.11", rdn.getNormType() );
- assertEquals( "Ex+mple", rdn.getValue().getString() );
- assertEquals( "ex+mple", rdn.getNormValue().getString() );
+ assertEquals( "Ex\\+mple", rdn.getValue() );
+ assertEquals( "ex+mple", rdn.getNormValue() );
// The first ATAV
atav = rdn.getAva();
@@ -2797,28 +2815,28 @@ public class DnTest
assertEquals( "2.5.4.11", atav.getNormType() );
assertEquals( "OU", atav.getType() );
- assertEquals( "Ex+mple", atav.getValue().getValue() );
- assertEquals( "ex+mple", atav.getNormValue().getValue() );
+ assertEquals( "Ex\\+mple", atav.getValue().getValue() );
+ assertEquals( "ex+mple", atav.getValue().getNormValue().toString() );
assertEquals( 2, rdn.size() );
// The second ATAV
for ( Ava ava : rdn )
{
- if ( "ex+mple".equals( ava.getNormValue().getValue() ) )
+ if ( "ex+mple".equals( ava.getValue().getNormValue().toString() ) )
{
// Skip the first one
continue;
}
assertEquals( " cn = T\\+ST\\ ", ava.getName() );
- assertEquals( "2.5.4.3=t\\+st", ava.getNormName() );
+ assertEquals( "2.5.4.3=t\\+st\\ ", ava.getNormName() );
assertEquals( "cn", ava.getType() );
assertEquals( "2.5.4.3", ava.getNormType() );
- assertEquals( "T+ST", ava.getValue().getValue() );
- assertEquals( "t+st", ava.getNormValue().getValue() );
+ assertEquals( "T\\+ST\\ ", ava.getValue().getValue() );
+ assertEquals( "t+st ", ava.getValue().getNormValue().toString() );
}
}
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java Tue Oct 13 18:56:51 2015
@@ -49,6 +49,34 @@ public class RdnTest
schemaManager = new DefaultSchemaManager();
}
+
+
+ @Test
+ public void testRdnValueSchemaAware() throws LdapException
+ {
+ String errors = null;
+
+ Rdn rdn = new Rdn( schemaManager, "cn= TEST\\ " );
+
+ if ( !"cn= TEST\\ ".equals( rdn.getName() ) )
+ {
+ errors += "\nRdn.getName fails '" + rdn.getName() + "'";
+ }
+
+ if ( !"2.5.4.3=test\\ ".equals( rdn.getNormName() ) )
+ {
+ errors = "\nRdn.getNormName fails '" + rdn.getNormName() + "'";
+ }
+
+ if ( !"test ".equals( rdn.getNormValue( "cn" ) ) )
+ {
+ errors += "\nRdn.getNormValue( 'cn' ) fails '" + ( String ) rdn.getNormValue( "cn" ) + "'";
+ }
+
+ assertEquals( null, errors );
+ }
+
+
@Test
public void testRdnValuesNoSchema() throws LdapException
{
@@ -71,9 +99,9 @@ public class RdnTest
errors += "\nRdn.getNormType fails '" + rdn.getNormType() + "'";
}
- if ( !"Exemple + Rdn\u00E4 ".equals( rdn.getNormValue().getString() ) )
+ if ( !"Exemple + Rdn\u00E4 ".equals( rdn.getNormValue() ) )
{
- errors += "\nRdn.getNormValue fails '" + rdn.getNormValue().getString() + "'";
+ errors += "\nRdn.getNormValue fails '" + rdn.getNormValue() + "'";
}
if ( !"OU".equals( rdn.getType() ) )
@@ -81,14 +109,14 @@ public class RdnTest
errors += "\nRdn.getUpType fails '" + rdn.getType() + "'";
}
- if ( !"Exemple + Rdn\u00E4".equals( rdn.getValue().getString() ) )
+ if ( !"Exemple + Rdn\u00E4 ".equals( rdn.getNormValue() ) )
{
- errors += "\nRdn.getUpValue fails '" + rdn.getValue() + "'";
+ errors += "\nRdn.getNormValue fails '" + rdn.getNormValue() + "'";
}
- if ( !"Exemple + Rdn\u00E4 ".equals( rdn.getValue( "ou" ) ) )
+ if ( !"Exemple + Rdn\u00E4 ".equals( rdn.getNormValue( "ou" ) ) )
{
- errors += "\nRdn.getValue( 'ou' ) fails '" + rdn.getValue( "ou" ) + "'";
+ errors += "\nRdn.getNormValue( 'ou' ) fails '" + rdn.getNormValue( "ou" ) + "'";
}
if ( !"TEST".equals( rdn.getValue( "cn" ) ) )
@@ -117,7 +145,7 @@ public class RdnTest
errors += "\nRdn.getName fails '" + rdn.getName() + "'";
}
- if ( !"2.5.4.11=exemple \\+ rdn\u00E4+2.5.4.3=test" .equals( rdn.getNormName() ) )
+ if ( !"2.5.4.11=exemple \\+ rdn\u00E4\\ +2.5.4.3=test" .equals( rdn.getNormName() ) )
{
errors = "\nRdn.getNormName fails '" + rdn.getNormName() + "'";
}
@@ -127,9 +155,9 @@ public class RdnTest
errors += "\nRdn.getNormType fails '" + rdn.getNormType() + "'";
}
- if ( !"exemple + rdn\u00E4".equals( rdn.getNormValue().getString() ) )
+ if ( !"exemple + rdn\u00E4 ".equals( rdn.getNormValue() ) )
{
- errors += "\nRdn.getNormValue fails '" + rdn.getNormValue().getString() + "'";
+ errors += "\nRdn.getNormValue fails '" + rdn.getNormValue() + "'";
}
if ( !"OU".equals( rdn.getType() ) )
@@ -137,19 +165,19 @@ public class RdnTest
errors += "\nRdn.getUpType fails '" + rdn.getType() + "'";
}
- if ( !"Exemple + Rdn\u00E4".equals( rdn.getValue().getString() ) )
+ if ( !"Exemple \\+ Rdn\\C3\\A4\\ ".equals( rdn.getValue() ) )
{
- errors += "\nRdn.getUpValue fails '" + rdn.getValue().getString() + "'";
+ errors += "\nRdn.getUpValue fails '" + rdn.getValue() + "'";
}
- if ( !"exemple + rdn\u00E4".equals( rdn.getValue( "ou" ) ) )
+ if ( !"exemple + rdn\u00E4 ".equals( rdn.getNormValue( "ou" ) ) )
{
- errors += "\nRdn.getValue( 'ou' ) fails '" + ( String ) rdn.getValue( "ou" ) + "'";
+ errors += "\nRdn.getNormValue( 'ou' ) fails '" + ( String ) rdn.getNormValue( "ou" ) + "'";
}
- if ( !"test".equals( rdn.getValue( "cn" ) ) )
+ if ( !"test".equals( rdn.getNormValue( "cn" ) ) )
{
- errors += "\nRdn.getValue( 'cn' ) fails '" + ( String ) rdn.getValue( "cn" ) + "'";
+ errors += "\nRdn.getNormValue( 'cn' ) fails '" + ( String ) rdn.getNormValue( "cn" ) + "'";
}
if ( !"OU = Exemple \\+ Rdn\\C3\\A4\\ +cn= TEST".equals( rdn.toString() ) )
@@ -170,4 +198,11 @@ public class RdnTest
assertEquals( rdn1, rdn2 );
assertEquals( rdn1.getNormName(), rdn2.getNormName() );
}
+
+
+ @Test
+ public void testRdnEscapedValue() throws Exception
+ {
+ Rdn rdn = new Rdn( schemaManager, "sn=\\46\\65\\72\\72\\79" );
+ }
}
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareAvaSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareAvaSerializationTest.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareAvaSerializationTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareAvaSerializationTest.java Tue Oct 13 18:56:51 2015
@@ -203,7 +203,7 @@ public class SchemaAwareAvaSerialization
catch ( IOException ioe )
{
String message = ioe.getMessage();
- assertEquals( "Cannot serialize an wrong ATAV, the upValue should not be null", message );
+ assertEquals( "Cannot serialize a wrong ATAV, the value should not be null", message );
}
}
@@ -222,7 +222,7 @@ public class SchemaAwareAvaSerialization
catch ( IOException ioe )
{
String message = ioe.getMessage();
- assertEquals( "Cannot serialize an wrong ATAV, the upValue should not be null", message );
+ assertEquals( "Cannot serialize an wrong ATAV, the value should not be null", message );
}
}
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnSerializationTest.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnSerializationTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnSerializationTest.java Tue Oct 13 18:56:51 2015
@@ -157,8 +157,9 @@ public class SchemaAwareRdnSerialization
rdn2.readExternal( in );
assertEquals( rdn1, rdn2 );
- assertEquals( "doe", rdn2.getValue( "cn" ) );
- assertEquals( "Doe", rdn2.getValue().getString() );
+ assertEquals( "Doe", rdn2.getValue( "cn" ) );
+ assertEquals( "doe", rdn2.getNormValue( "cn" ) );
+ assertEquals( "Doe", rdn2.getValue() );
}
@@ -175,8 +176,9 @@ public class SchemaAwareRdnSerialization
assertEquals( pos1, pos2 );
assertEquals( rdn1, rdn2 );
- assertEquals( "doe", rdn2.getValue( "cn" ) );
- assertEquals( "Doe", rdn2.getValue().getString() );
+ assertEquals( "Doe", rdn2.getValue( "cn" ) );
+ assertEquals( "doe", rdn2.getNormValue( "cn" ) );
+ assertEquals( "Doe", rdn2.getValue() );
}
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnTest.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/api/ldap/model/name/SchemaAwareRdnTest.java Tue Oct 13 18:56:51 2015
@@ -316,7 +316,7 @@ public class SchemaAwareRdnTest
rdn = new Rdn( schemaManager, "cn=d" );
- assertEquals( "b", rdnClone.getValue( "Cn" ) );
+ assertEquals( "b", rdnClone.getNormValue( "Cn" ) );
}
@@ -634,7 +634,7 @@ public class SchemaAwareRdnTest
{
Rdn rdn = new Rdn( schemaManager, " cn = b + sn = f + gn = h + l = d " );
- assertEquals( "b", rdn.getNormValue().getString() );
+ assertEquals( "b", rdn.getNormValue() );
}
@@ -891,9 +891,9 @@ public class SchemaAwareRdnTest
Rdn rdn3 = new Rdn( schemaManager, "cn=\\ a b c\\ " );
Rdn rdn4 = new Rdn( schemaManager, "cn=\\ a\\ b\\ c\\ " );
- assertEquals( "2.5.4.3=a b c", rdn3.getNormName() );
+ assertEquals( "2.5.4.3=\\ a b c\\ ", rdn3.getNormName() );
assertEquals( "cn=\\ a b c\\ ", rdn3.getName() );
- assertEquals( "2.5.4.3=a b c", rdn4.getNormName() );
+ assertEquals( "2.5.4.3=\\ a b c\\ ", rdn4.getNormName() );
assertEquals( "cn=\\ a\\ b\\ c\\ ", rdn4.getName() );
assertTrue( rdn3.equals( rdn4 ) );
}
@@ -1063,7 +1063,7 @@ public class SchemaAwareRdnTest
@Test
public void testSimpleRdnNoValueSerialization() throws LdapException, IOException, ClassNotFoundException
{
- Rdn rdn = new Rdn( schemaManager, " CN =" );
+ Rdn rdn = new Rdn( schemaManager, " DC =" );
rdn.normalize();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -1168,10 +1168,10 @@ public class SchemaAwareRdnTest
@Test
public void testRdnWithEmptyValue() throws LdapException
{
- assertTrue( Rdn.isValid( "cn=" ) );
- assertTrue( Rdn.isValid( "cn=\"\"" ) );
- assertEquals( "2.5.4.3=", new Rdn( schemaManager, "cn=\"\"" ).getNormName() );
- assertEquals( "2.5.4.3=", new Rdn( schemaManager, "cn=" ).getNormName() );
+ assertTrue( Rdn.isValid( "dc=" ) );
+ assertTrue( Rdn.isValid( "dc=\"\"" ) );
+ assertEquals( "0.9.2342.19200300.100.1.25=", new Rdn( schemaManager, "dc=" ).getNormName() );
+ assertEquals( "0.9.2342.19200300.100.1.25=", new Rdn( schemaManager, "dc=\"\"" ).getNormName() );
}
Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java Tue Oct 13 18:56:51 2015
@@ -104,8 +104,8 @@ public class LdifAnonymizer
/** The map that stores the anonymized values associated to the original value */
Map<Value<?>, Value<?>> valueMap = new HashMap<Value<?>, Value<?>>();
- /** The map of Attributes we want to anonymize. They are all associated with anonymizers */
- Map<AttributeType, Anonymizer> attributeAnonymizers = new HashMap<AttributeType, Anonymizer>();
+ /** The map of AttributeType'sOID we want to anonymize. They are all associated with anonymizers */
+ Map<String, Anonymizer> attributeAnonymizers = new HashMap<String, Anonymizer>();
/** The list of existing NamingContexts */
Set<Dn> namingContexts = new HashSet<Dn>();
@@ -155,65 +155,65 @@ public class LdifAnonymizer
private void init()
{
// Load the anonymizers
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.CAR_LICENSE_AT ),
+ attributeAnonymizers.put( SchemaConstants.CAR_LICENSE_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.CN_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.DESCRIPTION_AT ),
+ attributeAnonymizers.put( SchemaConstants.CN_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.DESCRIPTION_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.DISPLAY_NAME_AT ),
+ attributeAnonymizers.put( SchemaConstants.DISPLAY_NAME_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.GECOS_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.GID_NUMBER_AT ),
+ attributeAnonymizers.put( SchemaConstants.GECOS_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.GID_NUMBER_AT_OID,
new IntegerAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.GIVENNAME_AT ),
+ attributeAnonymizers.put( SchemaConstants.GIVENNAME_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.HOME_DIRECTORY_AT ),
+ attributeAnonymizers.put( SchemaConstants.HOME_DIRECTORY_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.HOME_PHONE_AT ),
+ attributeAnonymizers.put( SchemaConstants.HOME_PHONE_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.HOME_POSTAL_ADDRESS_AT ),
+ attributeAnonymizers.put( SchemaConstants.HOME_POSTAL_ADDRESS_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.HOST_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.HOUSE_IDENTIFIER_AT ),
+ attributeAnonymizers.put( SchemaConstants.HOST_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.HOUSE_IDENTIFIER_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.JPEG_PHOTO_AT ),
+ attributeAnonymizers.put( SchemaConstants.JPEG_PHOTO_AT_OID,
new BinaryAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.LABELED_URI_AT ),
+ attributeAnonymizers.put( SchemaConstants.LABELED_URI_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.LOCALITY_NAME_AT ),
+ attributeAnonymizers.put( SchemaConstants.LOCALITY_NAME_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.MAIL_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.MANAGER_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.MEMBER_UID_AT ),
+ attributeAnonymizers.put( SchemaConstants.MAIL_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.MANAGER_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.MEMBER_UID_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.MOBILE_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.ORGANIZATION_NAME_AT ),
+ attributeAnonymizers.put( SchemaConstants.MOBILE_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.ORGANIZATION_NAME_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT ),
+ attributeAnonymizers.put( SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.PAGER_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.POSTAL_ADDRESS_AT ),
+ attributeAnonymizers.put( SchemaConstants.PAGER_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.POSTAL_ADDRESS_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.PHOTO_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.SECRETARY_AT ),
+ attributeAnonymizers.put( SchemaConstants.PHOTO_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.SECRETARY_AT_OID,
new StringAnonymizer() );
attributeAnonymizers
- .put( schemaManager.getAttributeType( SchemaConstants.SEE_ALSO_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.SN_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.TELEPHONE_NUMBER_AT ),
+ .put( SchemaConstants.SEE_ALSO_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.SN_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.TELEPHONE_NUMBER_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.UID_AT ), new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.UID_NUMBER_AT ),
+ attributeAnonymizers.put( SchemaConstants.UID_AT_OID, new StringAnonymizer() );
+ attributeAnonymizers.put( SchemaConstants.UID_NUMBER_AT_OID,
new IntegerAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.USER_CERTIFICATE_AT ),
+ attributeAnonymizers.put( SchemaConstants.USER_CERTIFICATE_AT_OID,
new StringAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.USER_PASSWORD_AT ),
+ attributeAnonymizers.put( SchemaConstants.USER_PASSWORD_AT_OID,
new BinaryAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.USER_PKCS12_AT ),
+ attributeAnonymizers.put( SchemaConstants.USER_PKCS12_AT_OID,
new BinaryAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.USER_SMIME_CERTIFICATE_AT ),
+ attributeAnonymizers.put( SchemaConstants.USER_SMIME_CERTIFICATE_AT_OID,
new BinaryAnonymizer() );
- attributeAnonymizers.put( schemaManager.getAttributeType( SchemaConstants.X500_UNIQUE_IDENTIFIER_AT ),
+ attributeAnonymizers.put( SchemaConstants.X500_UNIQUE_IDENTIFIER_AT_OID,
new BinaryAnonymizer() );
}
@@ -233,16 +233,16 @@ public class LdifAnonymizer
{
if ( syntax.getOid().equals( SchemaConstants.INTEGER_SYNTAX ) )
{
- attributeAnonymizers.put( attributeType, new IntegerAnonymizer() );
+ attributeAnonymizers.put( attributeType.getOid(), new IntegerAnonymizer() );
}
else
{
- attributeAnonymizers.put( attributeType, new StringAnonymizer() );
+ attributeAnonymizers.put( attributeType.getOid(), new StringAnonymizer() );
}
}
else
{
- attributeAnonymizers.put( attributeType, new BinaryAnonymizer() );
+ attributeAnonymizers.put( attributeType.getOid(), new BinaryAnonymizer() );
}
}
@@ -428,7 +428,8 @@ public class LdifAnonymizer
}
else
{
- Anonymizer anonymizer = attributeAnonymizers.get( attribute.getAttributeType() );
+ int h = attribute.getAttributeType().hashCode();
+ Anonymizer anonymizer = attributeAnonymizers.get( attribute.getAttributeType().getOid() );
if ( anonymizer == null )
{
Modified: directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g (original)
+++ directory/shared/trunk/ldap/model/src/main/antlr/distinguishedName.g Tue Oct 13 18:56:51 2015
@@ -151,6 +151,7 @@ options {
{
Object value = "";
String rawValue = "";
+ int lastEscapedSpace = -1;
}
}
@@ -351,15 +352,63 @@ attributeTypeAndValue [Rdn rdn] returns
value.rawValue = upValue + value.rawValue;
}
- Object unescapedValue = Rdn.unescapeValue( Strings.trim( (String)value.rawValue ) );
+ int start = 0;
+
+ for ( int pos = 0; pos < value.rawValue.length(); pos++ )
+ {
+ if ( value.rawValue.charAt( pos ) == ' ' )
+ {
+ start++;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ boolean escape = false;
+ int lastEscapedSpace = -1;
+
+ for ( int pos = start; pos< value.rawValue.length(); pos++ )
+ {
+ if ( escape )
+ {
+ escape = false;
+
+ if ( value.rawValue.charAt( pos ) == ' ' )
+ {
+ lastEscapedSpace = pos;
+ }
+ }
+ else if ( value.rawValue.charAt( pos ) == '\\' )
+ {
+ escape = true;
+ }
+ }
+
+ // Remove spaces from the right if needed
+ int pos = value.rawValue.length() - 1;
+
+ while ( ( value.rawValue.charAt( pos ) == ' ' ) && ( pos > lastEscapedSpace ) )
+ {
+ pos--;
+ }
+
+ String trimmedValue = value.rawValue;
+
+ if ( ( start > 0 ) || ( pos + 1 < value.rawValue.length() ) )
+ {
+ trimmedValue = value.rawValue.substring( start, pos + 1 );
+ }
+
+ Object unescapedValue = Rdn.unescapeValue( trimmedValue );
if ( unescapedValue instanceof String )
{
ava = new Ava(
type,
type,
- new StringValue( (String)unescapedValue ),
- new StringValue( (String)value.value ),
+ new StringValue( trimmedValue, (String)unescapedValue ),
upName
);
}
@@ -369,7 +418,6 @@ attributeTypeAndValue [Rdn rdn] returns
type,
type,
new BinaryValue( (byte[])unescapedValue ),
- new StringValue( (String)value.value ),
upName
);
}
@@ -380,7 +428,6 @@ attributeTypeAndValue [Rdn rdn] returns
type,
type,
new BinaryValue( (byte[])value.value ),
- new BinaryValue( (byte[])value.value ),
upName
);
}
@@ -585,7 +632,10 @@ string [UpAndNormValue value]
bb.append( Strings.getBytesUtf8( tmp ) );
}
|
- bytes = pair [value] { bb.append( bytes ); }
+ bytes = pair [value]
+ {
+ bb.append( bytes );
+ }
)
(
tmp = sutf1
@@ -600,10 +650,14 @@ string [UpAndNormValue value]
bb.append( Strings.getBytesUtf8( tmp ) );
}
|
- bytes = pair [value] { bb.append( bytes ); }
+ bytes = pair [value]
+ {
+ bb.append( bytes );
+ }
)*
)
{
+ /*
String string = Strings.utf8ToString( bb.copyOfUsedBytes() );
// trim trailing space characters manually
@@ -618,6 +672,7 @@ string [UpAndNormValue value]
}
value.value = string;
+ */
}
;
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/AbstractValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/AbstractValue.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/AbstractValue.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/AbstractValue.java Tue Oct 13 18:56:51 2015
@@ -47,10 +47,10 @@ public abstract class AbstractValue<T> i
/** reference to the attributeType zssociated with the value */
protected transient AttributeType attributeType;
- /** the wrapped binary value */
- protected T wrappedValue;
+ /** the User Provided value */
+ protected T upValue;
- /** the canonical representation of the wrapped value */
+ /** the canonical representation of the user provided value */
protected T normalizedValue;
/** The computed hashcode. We don't want to compute it each time the hashcode() method is called */
@@ -80,7 +80,7 @@ public abstract class AbstractValue<T> i
*/
public T getReference()
{
- return wrappedValue;
+ return upValue;
}
@@ -123,12 +123,19 @@ public abstract class AbstractValue<T> i
* to the schema
*/
@SuppressWarnings("unchecked")
- protected void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException
+ public void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException
{
+ if ( this.attributeType != null )
+ {
+ // We already have applied an AttributeType, get out
+ LOG.warn( "AttributeType {0} already applied", attributeType.getName() );
+ return;
+ }
+
if ( attributeType == null )
{
// No attributeType : the normalized value and the user provided value are the same
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
return;
}
@@ -145,12 +152,14 @@ public abstract class AbstractValue<T> i
if ( normalizer != null )
{
- if ( wrappedValue != null )
+ if ( upValue != null )
{
boolean isHR = attributeType.getSyntax().isHumanReadable();
+
if ( isHR != isHumanReadable() )
{
+
String message = "The '" + attributeType.getName() + "' AttributeType and values must "
+ "both be String or binary";
LOG.error( message );
@@ -161,11 +170,18 @@ public abstract class AbstractValue<T> i
{
if ( isHumanReadable() )
{
- normalizedValue = ( T ) normalizer.normalize( ( String ) wrappedValue );
+ if ( normalizedValue != null )
+ {
+ normalizedValue = ( T ) normalizer.normalize( ( String ) normalizedValue );
+ }
+ else
+ {
+ normalizedValue = ( T ) normalizer.normalize( ( String ) upValue );
+ }
}
else
{
- normalizedValue = ( T ) normalizer.normalize( new BinaryValue( ( byte[] ) wrappedValue ) )
+ normalizedValue = ( T ) normalizer.normalize( new BinaryValue( ( byte[] ) upValue ) )
.getNormReference();
}
}
@@ -187,7 +203,7 @@ public abstract class AbstractValue<T> i
{
// No MatchingRule, there is nothing we can do but make the normalized value
// to be a reference on the user provided value
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
// and checks that the value syntax is valid
@@ -198,7 +214,7 @@ public abstract class AbstractValue<T> i
// Check the syntax
if ( ( syntax != null ) && ( !isValid( syntax.getSyntaxChecker() ) ) )
{
- String message = I18n.err( I18n.ERR_04473_NOT_VALID_VALUE, wrappedValue, attributeType );
+ String message = I18n.err( I18n.ERR_04473_NOT_VALID_VALUE, upValue, attributeType );
LOG.info( message );
throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, message );
}
@@ -262,7 +278,7 @@ public abstract class AbstractValue<T> i
if ( normalizedValue == null )
{
- return wrappedValue;
+ return upValue;
}
return normalizedValue;
@@ -274,7 +290,7 @@ public abstract class AbstractValue<T> i
*/
public final boolean isNull()
{
- return wrappedValue == null;
+ return upValue == null;
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/BinaryValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/BinaryValue.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/BinaryValue.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/BinaryValue.java Tue Oct 13 18:56:51 2015
@@ -40,7 +40,7 @@ import org.apache.directory.api.util.Str
* A server side schema aware wrapper around a binary attribute value.
* This value wrapper uses schema information to syntax check values,
* and to compare them for equality and ordering. It caches results
- * and invalidates them when the wrapped value changes.
+ * and invalidates them when the user provided value changes.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@@ -51,7 +51,7 @@ public class BinaryValue extends Abstrac
/**
- * Creates a BinaryValue without an initial wrapped value.
+ * Creates a BinaryValue without an initial user provided value.
*
* @param attributeType the schema type associated with this BinaryValue
*/
@@ -76,7 +76,7 @@ public class BinaryValue extends Abstrac
/**
- * Creates a BinaryValue with an initial wrapped binary value.
+ * Creates a BinaryValue with an initial user provided binary value.
*
* @param value the binary value to wrap which may be null, or a zero length byte array
*/
@@ -84,21 +84,21 @@ public class BinaryValue extends Abstrac
{
if ( value != null )
{
- this.wrappedValue = new byte[value.length];
+ this.upValue = new byte[value.length];
this.normalizedValue = new byte[value.length];
- System.arraycopy( value, 0, this.wrappedValue, 0, value.length );
+ System.arraycopy( value, 0, this.upValue, 0, value.length );
System.arraycopy( value, 0, this.normalizedValue, 0, value.length );
}
else
{
- this.wrappedValue = null;
+ this.upValue = null;
this.normalizedValue = null;
}
}
/**
- * Creates a BinaryValue with an initial wrapped binary value.
+ * Creates a BinaryValue with an initial user provided binary value.
*
* @param attributeType the schema type associated with this BinaryValue
* @param value the binary value to wrap which may be null, or a zero length byte array
@@ -114,11 +114,11 @@ public class BinaryValue extends Abstrac
/**
* Gets a direct reference to the normalized representation for the
- * wrapped value of this ServerValue wrapper. Implementations will most
+ * user provided value of this ServerValue wrapper. Implementations will most
* likely leverage the attributeType this value is associated with to
- * determine how to properly normalize the wrapped value.
+ * determine how to properly normalize the user provided value.
*
- * @return the normalized version of the wrapped value
+ * @return the normalized version of the user provided value
*/
public byte[] getNormValue()
{
@@ -256,7 +256,7 @@ public class BinaryValue extends Abstrac
// Shortcut : if we have an AT for both the values, check the
// already normalized values
- if ( Arrays.equals( wrappedValue, other.wrappedValue ) )
+ if ( Arrays.equals( upValue, other.upValue ) )
{
return true;
}
@@ -408,10 +408,10 @@ public class BinaryValue extends Abstrac
System.arraycopy( normalizedValue, 0, clone.normalizedValue, 0, normalizedValue.length );
}
- if ( wrappedValue != null )
+ if ( upValue != null )
{
- clone.wrappedValue = new byte[wrappedValue.length];
- System.arraycopy( wrappedValue, 0, clone.wrappedValue, 0, wrappedValue.length );
+ clone.upValue = new byte[upValue.length];
+ System.arraycopy( upValue, 0, clone.upValue, 0, upValue.length );
}
return clone;
@@ -423,13 +423,13 @@ public class BinaryValue extends Abstrac
*/
public byte[] getValue()
{
- if ( wrappedValue == null )
+ if ( upValue == null )
{
return null;
}
- final byte[] copy = new byte[wrappedValue.length];
- System.arraycopy( wrappedValue, 0, copy, 0, wrappedValue.length );
+ final byte[] copy = new byte[upValue.length];
+ System.arraycopy( upValue, 0, copy, 0, upValue.length );
return copy;
}
@@ -451,15 +451,15 @@ public class BinaryValue extends Abstrac
*/
public int length()
{
- return wrappedValue != null ? wrappedValue.length : 0;
+ return upValue != null ? upValue.length : 0;
}
/**
- * Get the wrapped value as a byte[]. This method returns a copy of
- * the wrapped byte[].
+ * Get the user provided value as a byte[]. This method returns a copy of
+ * the user provided byte[].
*
- * @return the wrapped value as a byte[]
+ * @return the user provided value as a byte[]
*/
public byte[] getBytes()
{
@@ -468,13 +468,13 @@ public class BinaryValue extends Abstrac
/**
- * Get the wrapped value as a String.
+ * Get the user provided value as a String.
*
- * @return the wrapped value as a String
+ * @return the user provided value as a String
*/
public String getString()
{
- return Strings.utf8ToString( wrappedValue );
+ return Strings.utf8ToString( upValue );
}
@@ -527,14 +527,14 @@ public class BinaryValue extends Abstrac
{
throw new IOException( "The serialized value is not a Binary value" );
}
- // Read the wrapped value, if it's not null
- int wrappedLength = in.readInt();
+ // Read the user provided value, if it's not null
+ int upLength = in.readInt();
- if ( wrappedLength >= 0 )
+ if ( upLength >= 0 )
{
- wrappedValue = new byte[wrappedLength];
+ upValue = new byte[upLength];
- in.readFully( wrappedValue );
+ in.readFully( upValue );
}
// Read the isNormalized flag
@@ -562,11 +562,11 @@ public class BinaryValue extends Abstrac
if ( equality == null )
{
- if ( wrappedLength >= 0 )
+ if ( upLength >= 0 )
{
- normalizedValue = new byte[wrappedLength];
+ normalizedValue = new byte[upLength];
- System.arraycopy( wrappedValue, 0, normalizedValue, 0, wrappedLength );
+ System.arraycopy( upValue, 0, normalizedValue, 0, upLength );
}
}
else
@@ -579,34 +579,34 @@ public class BinaryValue extends Abstrac
}
else
{
- if ( wrappedLength >= 0 )
+ if ( upLength >= 0 )
{
- normalizedValue = new byte[wrappedLength];
+ normalizedValue = new byte[upLength];
- System.arraycopy( wrappedValue, 0, normalizedValue, 0, wrappedLength );
+ System.arraycopy( upValue, 0, normalizedValue, 0, upLength );
}
}
}
}
catch ( LdapException le )
{
- // Copy the wrappedValue into the normalizedValue
- if ( wrappedLength >= 0 )
+ // Copy the upValue into the normalizedValue
+ if ( upLength >= 0 )
{
- normalizedValue = new byte[wrappedLength];
+ normalizedValue = new byte[upLength];
- System.arraycopy( wrappedValue, 0, normalizedValue, 0, wrappedLength );
+ System.arraycopy( upValue, 0, normalizedValue, 0, upLength );
}
}
}
else
{
- // Copy the wrappedValue into the normalizedValue
- if ( wrappedLength >= 0 )
+ // Copy the upValue into the normalizedValue
+ if ( upLength >= 0 )
{
- normalizedValue = new byte[wrappedLength];
+ normalizedValue = new byte[upLength];
- System.arraycopy( wrappedValue, 0, normalizedValue, 0, wrappedLength );
+ System.arraycopy( upValue, 0, normalizedValue, 0, upLength );
}
}
}
@@ -624,14 +624,14 @@ public class BinaryValue extends Abstrac
// Write the BINARY flag
out.writeBoolean( BINARY );
- // Write the wrapped value, if it's not null
- if ( wrappedValue != null )
+ // Write the user provided value, if it's not null
+ if ( upValue != null )
{
- out.writeInt( wrappedValue.length );
+ out.writeInt( upValue.length );
- if ( wrappedValue.length > 0 )
+ if ( upValue.length > 0 )
{
- out.write( wrappedValue, 0, wrappedValue.length );
+ out.write( upValue, 0, upValue.length );
}
}
else
@@ -678,22 +678,22 @@ public class BinaryValue extends Abstrac
*/
public String toString()
{
- if ( wrappedValue == null )
+ if ( upValue == null )
{
return "null";
}
- else if ( wrappedValue.length > 16 )
+ else if ( upValue.length > 16 )
{
// Just dump the first 16 bytes...
byte[] copy = new byte[16];
- System.arraycopy( wrappedValue, 0, copy, 0, 16 );
+ System.arraycopy( upValue, 0, copy, 0, 16 );
return Strings.dumpBytes( copy ) + "...";
}
else
{
- return Strings.dumpBytes( wrappedValue );
+ return Strings.dumpBytes( upValue );
}
}
}
\ No newline at end of file
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/StringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/StringValue.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/StringValue.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/StringValue.java Tue Oct 13 18:56:51 2015
@@ -39,7 +39,7 @@ import org.apache.directory.api.util.exc
* A server side schema aware wrapper around a String attribute value.
* This value wrapper uses schema information to syntax check values,
* and to compare them for equality and ordering. It caches results
- * and invalidates them when the wrapped value changes.
+ * and invalidates them when the user provided value changes.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@@ -56,7 +56,7 @@ public class StringValue extends Abstrac
// Constructors
// -----------------------------------------------------------------------
/**
- * Creates a StringValue without an initial wrapped value.
+ * Creates a StringValue without an initial user provided value.
*
* @param attributeType the schema attribute type associated with this StringValue
*/
@@ -82,20 +82,34 @@ public class StringValue extends Abstrac
/**
- * Creates a StringValue with an initial wrapped String value.
+ * Creates a StringValue with an initial user provided String value.
*
* @param value the value to wrap which can be null
*/
public StringValue( String value )
{
- this.wrappedValue = value;
+ this.upValue = value;
this.normalizedValue = value;
bytes = Strings.getBytesUtf8( value );
}
/**
- * Creates a schema aware StringValue with an initial wrapped String value.
+ * Creates a StringValue with an initial user provided String value and a normalized value.
+ *
+ * @param value the user provided value to wrap which can be null
+ * @param normValue the normalized value to wrap which can be null
+ */
+ public StringValue( String value, String normalizedValue )
+ {
+ this.upValue = value;
+ this.normalizedValue = normalizedValue;
+ bytes = Strings.getBytesUtf8( normalizedValue );
+ }
+
+
+ /**
+ * Creates a schema aware StringValue with an initial user provided String value.
*
* @param attributeType the schema type associated with this StringValue
* @param value the value to wrap
@@ -104,7 +118,22 @@ public class StringValue extends Abstrac
*/
public StringValue( AttributeType attributeType, String value ) throws LdapInvalidAttributeValueException
{
- this( value );
+ this( value, value );
+ apply( attributeType );
+ }
+
+
+ /**
+ * Creates a schema aware StringValue with an initial user provided String value.
+ *
+ * @param attributeType the schema type associated with this StringValue
+ * @param value the value to wrap
+ * @throws LdapInvalidAttributeValueException If the added value is invalid accordingly
+ * to the schema
+ */
+ public StringValue( AttributeType attributeType, String value, String normValue ) throws LdapInvalidAttributeValueException
+ {
+ this( value, normValue );
apply( attributeType );
}
@@ -119,7 +148,7 @@ public class StringValue extends Abstrac
{
// The String is immutable, we can safely return the internal
// object without copying it.
- return wrappedValue;
+ return upValue;
}
@@ -231,9 +260,9 @@ public class StringValue extends Abstrac
return 0;
}
- // If the normalized value is null, will default to wrapped
+ // If the normalized value is null, will default to user provided
// which cannot be null at this point.
- // If the normalized value is null, will default to wrapped
+ // If the normalized value is null, will default to user provided
// which cannot be null at this point.
String normalized = getNormValue();
@@ -289,7 +318,7 @@ public class StringValue extends Abstrac
// Shortcut : if we have an AT for both the values, check the
// already normalized values
- if ( wrappedValue.equals( other.wrappedValue ) )
+ if ( upValue.equals( other.upValue ) )
{
return true;
}
@@ -438,13 +467,13 @@ public class StringValue extends Abstrac
*/
public int length()
{
- return wrappedValue != null ? wrappedValue.length() : 0;
+ return upValue != null ? upValue.length() : 0;
}
/**
- * Get the wrapped value as a byte[].
- * @return the wrapped value as a byte[]
+ * Get the user provided value as a byte[].
+ * @return the user provided value as a byte[]
*/
public byte[] getBytes()
{
@@ -453,13 +482,13 @@ public class StringValue extends Abstrac
/**
- * Get the wrapped value as a String.
+ * Get the user provided value as a String.
*
- * @return the wrapped value as a String
+ * @return the user provided value as a String
*/
public String getString()
{
- return wrappedValue != null ? wrappedValue : "";
+ return upValue != null ? upValue : "";
}
@@ -512,11 +541,11 @@ public class StringValue extends Abstrac
throw new IOException( "The serialized value is not a String value" );
}
- // Read the wrapped value, if it's not null
+ // Read the user provided value, if it's not null
if ( in.readBoolean() )
{
- wrappedValue = in.readUTF();
- bytes = Strings.getBytesUtf8( wrappedValue );
+ upValue = in.readUTF();
+ bytes = Strings.getBytesUtf8( upValue );
}
// Read the isNormalized flag
@@ -540,7 +569,7 @@ public class StringValue extends Abstrac
if ( equality == null )
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
else
{
@@ -548,22 +577,22 @@ public class StringValue extends Abstrac
if ( normalizer != null )
{
- normalizedValue = normalizer.normalize( wrappedValue );
+ normalizedValue = normalizer.normalize( upValue );
}
else
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
}
}
catch ( LdapException le )
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
}
else
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
}
@@ -582,17 +611,17 @@ public class StringValue extends Abstrac
public int serialize( byte[] buffer, int pos )
{
// Compute the length
- // The value type, the wrappedValue presence flag,
+ // The value type, the user provided value presence flag,
// the normalizedValue presence flag and the hash length.
int length = 1 + 1 + 1 + 4;
- byte[] wrappedValueBytes = null;
+ byte[] upValueBytes = null;
byte[] normalizedValueBytes = null;
- if ( wrappedValue != null )
+ if ( upValue != null )
{
- wrappedValueBytes = Strings.getBytesUtf8( wrappedValue );
- length += 4 + wrappedValueBytes.length;
+ upValueBytes = Strings.getBytesUtf8( upValue );
+ length += 4 + upValueBytes.length;
}
if ( attributeType != null )
@@ -618,11 +647,11 @@ public class StringValue extends Abstrac
buffer[pos] = Serialize.TRUE;
pos++;
- // Write the wrapped value, if it's not null
- if ( wrappedValue != null )
+ // Write the user provided value, if it's not null
+ if ( upValue != null )
{
buffer[pos++] = Serialize.TRUE;
- pos = Serialize.serialize( wrappedValueBytes, buffer, pos );
+ pos = Serialize.serialize( upValueBytes, buffer, pos );
}
else
{
@@ -685,15 +714,15 @@ public class StringValue extends Abstrac
throw new IOException( "The serialized value is not a String value" );
}
- // Read the wrapped value, if it's not null
+ // Read the user provided value, if it's not null
boolean hasWrappedValue = Serialize.deserializeBoolean( buffer, pos );
pos++;
if ( hasWrappedValue )
{
- byte[] wrappedValueBytes = Serialize.deserializeBytes( buffer, pos );
- pos += 4 + wrappedValueBytes.length;
- wrappedValue = Strings.utf8ToString( wrappedValueBytes );
+ byte[] upValueBytes = Serialize.deserializeBytes( buffer, pos );
+ pos += 4 + upValueBytes.length;
+ upValue = Strings.utf8ToString( upValueBytes );
}
// Read the isNormalized flag
@@ -723,7 +752,7 @@ public class StringValue extends Abstrac
if ( equality == null )
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
else
{
@@ -731,22 +760,22 @@ public class StringValue extends Abstrac
if ( normalizer != null )
{
- normalizedValue = normalizer.normalize( wrappedValue );
+ normalizedValue = normalizer.normalize( upValue );
}
else
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
}
}
catch ( LdapException le )
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
}
else
{
- normalizedValue = wrappedValue;
+ normalizedValue = upValue;
}
}
@@ -766,11 +795,11 @@ public class StringValue extends Abstrac
// Write a boolean for the HR flag
out.writeBoolean( STRING );
- // Write the wrapped value, if it's not null
- if ( wrappedValue != null )
+ // Write the user provided value, if it's not null
+ if ( upValue != null )
{
out.writeBoolean( true );
- out.writeUTF( wrappedValue );
+ out.writeUTF( upValue );
}
else
{
@@ -814,6 +843,6 @@ public class StringValue extends Abstrac
*/
public String toString()
{
- return wrappedValue == null ? "null" : wrappedValue;
+ return upValue == null ? "null" : upValue;
}
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Value.java Tue Oct 13 18:56:51 2015
@@ -79,7 +79,7 @@ public interface Value<T> extends Clonea
/**
- * Get the wrapped value. It will return a copy, not a reference.
+ * Get the User Provided value. It will return a copy, not a reference.
*
* @return a copy of the wrapped value
*/
@@ -96,7 +96,7 @@ public interface Value<T> extends Clonea
/**
- * Get the wrapped value as a String. If the original value
+ * Get the user provided value as a String. If the original value
* is binary, this method will return the value as if it was
* an UTF-8 encoded String.
*
@@ -166,4 +166,12 @@ public interface Value<T> extends Clonea
* @return The length of the interned value
*/
int length();
+
+
+ /**
+ * Apply the AttributeType to this value. Note that this can't be done twice.
+ *
+ * @param attributeType The AttributeType to apply
+ */
+ void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException;
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java Tue Oct 13 18:56:51 2015
@@ -230,6 +230,7 @@ public final class FilterParser
* escaped = '\' HEX HEX
* HEX = '0'-'9' / 'A'-'F' / 'a'-'f'
* unicodeSubset = %x01-27 / %x2B-5B / %x5D-FFFF
+ * @throws LdapInvalidAttributeValueException
*/
private static Value<?> parseAssertionValue( SchemaManager schemaManager, String attribute, byte[] filter,
Position pos ) throws ParseException
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifRevertor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifRevertor.java?rev=1708486&r1=1708485&r2=1708486&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifRevertor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifRevertor.java Tue Oct 13 18:56:51 2015
@@ -359,9 +359,9 @@ public final class LdifRevertor
{
// No need to add something which has already been added
// in the previous modification
- if ( !entry.contains( ava.getNormType(), ava.getNormValue().getString() )
- && !( ava.getNormType().equals( oldRdn.getNormType() ) && ava.getNormValue().getString().equals(
- oldRdn.getNormValue().getString() ) ) )
+ if ( !entry.contains( ava.getNormType(), ava.getValue().getString() )
+ && !( ava.getNormType().equals( oldRdn.getNormType() ) && ava.getValue().getString().equals(
+ oldRdn.getNormValue() ) ) )
{
// Create the modification, which is an Remove
Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
@@ -493,7 +493,7 @@ public final class LdifRevertor
for ( Ava atav : newRdn )
{
if ( !atav.equals( oldRdn.getAva() )
- && ( entry.contains( atav.getNormType(), atav.getNormValue().getString() ) ) )
+ && ( entry.contains( atav.getNormType(), atav.getValue().getString() ) ) )
{
existInEntry = true;
}
@@ -546,7 +546,7 @@ public final class LdifRevertor
{
overlapping = true;
}
- else if ( entry.contains( atav.getNormType(), atav.getNormValue().getString() ) )
+ else if ( entry.contains( atav.getNormType(), atav.getValue().getString() ) )
{
existInEntry = true;
}