directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r957232 [2/2] - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/ apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/ apacheds/trunk/core/src/main/java/or...
Date Wed, 23 Jun 2010 14:58:04 GMT
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java?rev=957232&r1=957231&r2=957232&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
Wed Jun 23 14:58:04 2010
@@ -26,6 +26,7 @@ import java.util.List;
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -167,7 +168,15 @@ public class FilterNormalizingVisitor im
      */
     private ExprNode visitPresenceNode( PresenceNode node ) throws LdapException
     {
-        node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute()
) );
+        try
+        {
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute()
) );
+        }
+        catch ( LdapNoSuchAttributeException lnsae )
+        {
+            return null;
+        }
+
         return node;
     }
 
@@ -185,12 +194,23 @@ public class FilterNormalizingVisitor im
      */
     private ExprNode visitSimpleNode( SimpleNode node ) throws LdapException
     {
+        
         // still need this check here in case the top level is a leaf node
         // with an undefined attributeType for its attribute
         if ( !ncn.isDefined( node.getAttribute() ) )
         {
             return null;
         }
+        
+        // Check that the AttributeType is valid
+        try
+        {
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute()
) );
+        }
+        catch ( LdapNoSuchAttributeException lnsae )
+        {
+            return null;
+        }
 
         Value<?> normalized = normalizeValue( node.getAttribute(), node.getValue()
);
 
@@ -199,7 +219,6 @@ public class FilterNormalizingVisitor im
             return null;
         }
 
-        node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute()
) );
         node.setValue( normalized );
 
         return node;
@@ -307,7 +326,15 @@ public class FilterNormalizingVisitor im
      */
     private ExprNode visitExtensibleNode( ExtensibleNode node ) throws LdapException
     {
-        node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute()
) );
+        // Check that the AttributeType is valid
+        try
+        {
+            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute()
) );
+        }
+        catch ( LdapNoSuchAttributeException lnsae )
+        {
+            return null;
+        }
 
         return node;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java?rev=957232&r1=957231&r2=957232&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java
Wed Jun 23 14:58:04 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -205,7 +206,14 @@ public class ImmutableAttributeTypeRegis
      */
     public String getOidByName( String name ) throws LdapException
     {
-        return immutableAttributeTypeRegistry.getOidByName( name );
+        try
+        {
+            return immutableAttributeTypeRegistry.getOidByName( name );
+        }
+        catch ( LdapException le )
+        {
+            throw new LdapNoSuchAttributeException( le.getMessage() );
+        }
     }
 
 



Mime
View raw message