directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1088830 - in /directory/shared/trunk/ldap/model/src: main/java/org/apache/directory/shared/ldap/model/entry/ test/java/org/apache/directory/shared/ldap/model/entry/
Date Tue, 05 Apr 2011 00:09:17 GMT
Author: elecharny
Date: Tue Apr  5 00:09:16 2011
New Revision: 1088830

URL: http://svn.apache.org/viewvc?rev=1088830&view=rev
Log:
o Added a check : the Value must contain the same type of data than the one accepted by the
AT, when we apply the AT
o Fixed the tests accordingly

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java?rev=1088830&r1=1088829&r2=1088830&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
Tue Apr  5 00:09:16 2011
@@ -140,6 +140,16 @@ public abstract class AbstractValue<T> i
             {
                 if ( wrappedValue != 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 );
+                        throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
message );
+                    }
+                        
                     try
                     {
                         if ( isHumanReadable() )

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java?rev=1088830&r1=1088829&r2=1088830&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java
Tue Apr  5 00:09:16 2011
@@ -203,7 +203,7 @@ public class EntryUtils
     /* No protection */ static AttributeType getBytesAttributeType()
     {
         AttributeType attributeType = new AttributeType( "1.2" );
-        LdapSyntax syntax = new LdapSyntax( "1.2.1", "", true );
+        LdapSyntax syntax = new LdapSyntax( "1.2.1", "", false );
 
         syntax.setSyntaxChecker( new SyntaxChecker( "1.2.1" )
         {

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java?rev=1088830&r1=1088829&r2=1088830&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java
Tue Apr  5 00:09:16 2011
@@ -83,7 +83,7 @@ public class StringValueAttributeTypeTes
     @Before
     public void initAT()
     {
-        s = new EntryUtils.S( "1.1.1.1", false );
+        s = new EntryUtils.S( "1.1.1.1", true );
         s.setSyntaxChecker( new OctetStringSyntaxChecker() );
         mr = new EntryUtils.MR( "1.1.2.1" );
         mr.setSyntax( s );

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java?rev=1088830&r1=1088829&r2=1088830&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueTest.java
Tue Apr  5 00:09:16 2011
@@ -66,7 +66,7 @@ public class StringValueTest
     @BeforeClass 
     public static void initAT()
     {
-        s = new EntryUtils.S( "1.1.1.1", false );
+        s = new EntryUtils.S( "1.1.1.1", true );
         s.setSyntaxChecker( new OctetStringSyntaxChecker() );
         mr = new EntryUtils.MR( "1.1.2.1" );
         mr.setSyntax( s );

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java?rev=1088830&r1=1088829&r2=1088830&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/ValueSerializationTest.java
Tue Apr  5 00:09:16 2011
@@ -122,7 +122,7 @@ public class ValueSerializationTest
         atb.setSubstring( mrb );
         atb.setSyntax( sb );
         
-        ss = new EntryUtils.S( "1.1.1.1", false );
+        ss = new EntryUtils.S( "1.1.1.1", true );
         ss.setSyntaxChecker( new OctetStringSyntaxChecker() );
         mrs = new EntryUtils.MR( "1.1.2.1" );
         mrs.setSyntax( ss );



Mime
View raw message