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 2007/10/06 14:14:09 UTC
svn commit: r582482 -
/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
Author: elecharny
Date: Sat Oct 6 05:14:09 2007
New Revision: 582482
URL: http://svn.apache.org/viewvc?rev=582482&view=rev
Log:
Added a patch to handle cases where we have a missing MatchingRule : a specific exception is thrown instead of a generic one.
Modified:
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java?rev=582482&r1=582481&r2=582482&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java Sat Oct 6 05:14:09 2007
@@ -23,6 +23,7 @@
import javax.naming.NamingException;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
@@ -146,7 +147,19 @@
{
if ( substrOid == null )
{
- return findSubstr( getSuperior() );
+ MatchingRule matchingRule = findSubstr( getSuperior() );
+
+ if ( matchingRule == null )
+ {
+ // We don't have a matching rule for this AT,
+ // let's return an error.
+ String message = "No matching rule defined for attribute " + (names != null ? names[0] : "" ) + "[" + oid + "]";
+ throw new LdapInvalidAttributeValueException( message, ResultCodeEnum.INAPPROPRIATE_MATCHING );
+ }
+ else
+ {
+ return matchingRule;
+ }
}
return registries.getMatchingRuleRegistry().lookup( substrOid );