Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 68093 invoked from network); 2 Feb 2011 13:39:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2011 13:39:53 -0000 Received: (qmail 6308 invoked by uid 500); 2 Feb 2011 13:39:53 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 6249 invoked by uid 500); 2 Feb 2011 13:39:51 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 6240 invoked by uid 99); 2 Feb 2011 13:39:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 13:39:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 13:39:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0209C23889E9; Wed, 2 Feb 2011 13:39:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1066462 - in /directory/shared/trunk: ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/ ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/ ldap/src/main/java/org/apache/directory/shared/ldap/m... Date: Wed, 02 Feb 2011 13:39:27 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110202133928.0209C23889E9@eris.apache.org> Author: pamarcelot Date: Wed Feb 2 13:39:26 2011 New Revision: 1066462 URL: http://svn.apache.org/viewvc?rev=1066462&view=rev Log: Updated the LdapSchemaException. o Added a new 'related ID' field o Refactored constructors Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaException.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaExceptionCodes.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java (original) +++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java Wed Feb 2 13:39:26 2011 @@ -1704,9 +1704,10 @@ public class DefaultSchemaManager implem // The new schemaObject's OID must not already exist if ( checkOidExist( copy ) ) { - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, - schemaObject, I18n.err( I18n.ERR_11008, schemaObject.getOid() ) ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_11008, schemaObject.getOid() ) ); + ldapSchemaException.setSourceObject( schemaObject ); + errors.add( ldapSchemaException ); return false; } @@ -1717,9 +1718,13 @@ public class DefaultSchemaManager implem if ( schemaName == null ) { // The schema associated with the SchemaaObject does not exist. This is not valid. - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.NONEXISTENT_SCHEMA, - schemaObject, I18n.err( I18n.ERR_11009, schemaObject.getOid(), copy.getSchemaName() ) ); - errors.add( error ); + + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.NONEXISTENT_SCHEMA, I18n.err( I18n.ERR_11009, schemaObject.getOid(), + copy.getSchemaName() ) ); + ldapSchemaException.setSourceObject( schemaObject ); + ldapSchemaException.setRelatedId( copy.getSchemaName() ); + errors.add( ldapSchemaException ); return false; } Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaException.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaException.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaException.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaException.java Wed Feb 2 13:39:26 2011 @@ -39,10 +39,13 @@ public class LdapSchemaException extends private LdapSchemaExceptionCodes code; /** The 'source' schema object */ - private SchemaObject source; + private SchemaObject sourceObject; /** The 'other' schema object */ - private SchemaObject other; + private SchemaObject otherObject; + + /** The related ID (name or OID) of the exception */ + private String relatedId; /** @@ -57,71 +60,25 @@ public class LdapSchemaException extends /** * Creates a new instance of LdapSchemaException. * - * @param explanation - * The message associated with the exception - */ - public LdapSchemaException( String explanation ) - { - super( explanation ); - } - - - /** - * Creates a new instance of LdapSchemaException. - * * @param code * The code of the exception - * @param source - * The 'source' schema object - * @param other - * The 'other' schema object - * @param explanation - * The message associated with the exception */ - public LdapSchemaException( LdapSchemaExceptionCodes code, SchemaObject source, SchemaObject other, - String explanation ) + public LdapSchemaException( LdapSchemaExceptionCodes code ) { - super( explanation ); + super(); this.code = code; - this.source = source; - this.other = other; } /** * Creates a new instance of LdapSchemaException. * - * @param code - * The code of the exception - * @param source - * The 'source' schema object * @param explanation * The message associated with the exception */ - public LdapSchemaException( LdapSchemaExceptionCodes code, SchemaObject source, String explanation ) + public LdapSchemaException( String explanation ) { super( explanation ); - this.code = code; - this.source = source; - } - - - /** - * Creates a new instance of LdapSchemaException. - * - * @param code - * The code of the exception - * @param source - * The 'source' schema object - * @param other - * The 'other' schema object - */ - public LdapSchemaException( LdapSchemaExceptionCodes code, SchemaObject source, SchemaObject other ) - { - super(); - this.code = code; - this.source = source; - this.other = other; } @@ -130,14 +87,13 @@ public class LdapSchemaException extends * * @param code * The code of the exception - * @param source - * The 'source' schema object + * @param explanation + * The message associated with the exception */ - public LdapSchemaException( LdapSchemaExceptionCodes code, SchemaObject source ) + public LdapSchemaException( LdapSchemaExceptionCodes code, String explanation ) { - super(); + super( explanation ); this.code = code; - this.source = source; } @@ -171,9 +127,9 @@ public class LdapSchemaException extends * @return * the 'source' schema object */ - public SchemaObject getSource() + public SchemaObject getSourceObject() { - return source; + return sourceObject; } @@ -183,9 +139,9 @@ public class LdapSchemaException extends * @param source * the 'source' schema object */ - public void setSource( SchemaObject source ) + public void setSourceObject( SchemaObject source ) { - this.source = source; + this.sourceObject = source; } @@ -195,9 +151,9 @@ public class LdapSchemaException extends * @return * the 'other' schema object */ - public SchemaObject getOther() + public SchemaObject getOtherObject() { - return other; + return otherObject; } @@ -207,8 +163,32 @@ public class LdapSchemaException extends * @param other * the 'other' schema object */ - public void setOther( SchemaObject other ) + public void setOtherObject( SchemaObject other ) + { + this.otherObject = other; + } + + + /** + * Gets the related ID (name or OID) of the exception. + * + * @return + * the related ID (name or OID) + */ + public String getRelatedId() + { + return relatedId; + } + + + /** + * Sets the related ID (name or OID) of the exception. + * + * @param relatedId + * the related ID (name or OID) + */ + public void setRelatedId( String relatedId ) { - this.other = other; + this.relatedId = relatedId; } } Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaExceptionCodes.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaExceptionCodes.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaExceptionCodes.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/exception/LdapSchemaExceptionCodes.java Wed Feb 2 13:39:26 2011 @@ -117,6 +117,7 @@ public enum LdapSchemaExceptionCodes /** Characterizing an OC with a duplicated AT in its may and must ATs list */ OC_DUPLICATE_AT_IN_MAY_AND_MUST, + // Codes for all Schema Objects /** Characterizing a MR with a nonexistent syntax */ Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java Wed Feb 2 13:39:26 2011 @@ -224,9 +224,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04303, superiorOid, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); // Get out now @@ -240,10 +241,10 @@ public class AttributeType extends Abstr { String msg = I18n.err( I18n.ERR_04482_CANNOT_SUBTYPE_COLLECTIVE, currentSuperior, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_CANNOT_SUBTYPE_COLLECTIVE_AT, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_CANNOT_SUBTYPE_COLLECTIVE_AT, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return false; } @@ -284,9 +285,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04304, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_CYCLE_TYPE_HIERARCHY, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_CYCLE_TYPE_HIERARCHY, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); isOk = false; @@ -308,9 +310,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04305, superiorOid, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); // Get out now @@ -343,9 +346,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04306, syntaxOid, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -360,9 +364,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04306, syntaxOid, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_SYNTAX, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -380,9 +385,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04307, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_SYNTAX_OR_SUPERIOR_REQUIRED, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_SYNTAX_OR_SUPERIOR_REQUIRED, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -409,10 +415,9 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04308, equalityOid, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, msg ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -426,10 +431,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04309, equalityOid, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_EQUALITY_MATCHING_RULE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); } } @@ -463,10 +468,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04310, orderingOid, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -480,10 +485,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04311, orderingOid, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_ORDERING_MATCHING_RULE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); } } @@ -518,10 +523,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04312, substringOid, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -535,10 +540,10 @@ public class AttributeType extends Abstr // Not allowed. String msg = I18n.err( I18n.ERR_04313, substringOid, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_NONEXISTENT_SUBSTRING_MATCHING_RULE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -566,9 +571,10 @@ public class AttributeType extends Abstr // This is an error String msg = I18n.err( I18n.ERR_04314, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_MUST_HAVE_SAME_USAGE_THAN_SUPERIOR, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_MUST_HAVE_SAME_USAGE_THAN_SUPERIOR, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); return; } @@ -579,10 +585,10 @@ public class AttributeType extends Abstr // Cannot have a not user modifiable AT which is not an operational AT String msg = I18n.err( I18n.ERR_04315, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_USER_APPLICATIONS_USAGE_MUST_BE_USER_MODIFIABLE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_USER_APPLICATIONS_USAGE_MUST_BE_USER_MODIFIABLE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); } } @@ -604,10 +610,10 @@ public class AttributeType extends Abstr // An AttributeType which is collective must be a USER attributeType String msg = I18n.err( I18n.ERR_04316, getName() ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.AT_COLLECTIVE_MUST_HAVE_USER_APPLICATIONS_USAGE, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_COLLECTIVE_MUST_HAVE_USER_APPLICATIONS_USAGE, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); } @@ -616,9 +622,10 @@ public class AttributeType extends Abstr // A collective attribute must be multi-valued String msg = I18n.err( I18n.ERR_04483_COLLECTIVE_NOT_MULTI_VALUED, getName() ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.AT_COLLECTIVE_CANNOT_BE_SINGLE_VALUED, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.AT_COLLECTIVE_CANNOT_BE_SINGLE_VALUED, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); } } Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java Wed Feb 2 13:39:26 2011 @@ -91,7 +91,7 @@ public class MatchingRule extends Abstra { /** A logger for this class */ private static final Logger LOG = LoggerFactory.getLogger( MatchingRule.class ); - + /** The serialVersionUID */ private static final long serialVersionUID = 1L; @@ -162,9 +162,10 @@ public class MatchingRule extends Abstra // The Syntax is a mandatory element, it must exist. String msg = I18n.err( I18n.ERR_04317 ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.MR_NONEXISTENT_SYNTAX, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.MR_NONEXISTENT_SYNTAX, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); LOG.info( msg ); } Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java Wed Feb 2 13:39:26 2011 @@ -146,10 +146,10 @@ public class ObjectClass extends Abstrac // An ABSTRACT OC can only inherit from ABSTRACT OCs String msg = I18n.err( I18n.ERR_04318, oid, superior.getObjectType(), superior ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.OC_ABSTRACT_MUST_INHERIT_FROM_ABSTRACT_OC, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_ABSTRACT_MUST_INHERIT_FROM_ABSTRACT_OC, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); return; } @@ -161,10 +161,10 @@ public class ObjectClass extends Abstrac // An AUXILIARY OC cannot inherit from STRUCTURAL OCs String msg = I18n.err( I18n.ERR_04319, oid, superior ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.OC_AUXILIARY_CANNOT_INHERIT_FROM_STRUCTURAL_OC, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_AUXILIARY_CANNOT_INHERIT_FROM_STRUCTURAL_OC, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); return; } @@ -176,10 +176,10 @@ public class ObjectClass extends Abstrac // A STRUCTURAL OC cannot inherit from AUXILIARY OCs String msg = I18n.err( I18n.ERR_04320, oid, superior ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.OC_STRUCTURAL_CANNOT_INHERIT_FROM_AUXILIARY_OC, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_STRUCTURAL_CANNOT_INHERIT_FROM_AUXILIARY_OC, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); return; } @@ -193,9 +193,10 @@ public class ObjectClass extends Abstrac // Cannot find the OC String msg = I18n.err( I18n.ERR_04321, oid, superiorName ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_SUPERIOR, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_NONEXISTENT_SUPERIOR, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); return; } } @@ -222,10 +223,10 @@ public class ObjectClass extends Abstrac // Collective Attributes are not allowed in MAY or MUST String msg = I18n.err( I18n.ERR_04485_COLLECTIVE_NOT_ALLOWED_IN_MAY, mayAttributeTypeName, oid ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MAY, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MAY, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } @@ -234,9 +235,10 @@ public class ObjectClass extends Abstrac // Already registered : this is an error String msg = I18n.err( I18n.ERR_04322, oid, mayAttributeTypeName ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } @@ -247,9 +249,10 @@ public class ObjectClass extends Abstrac // Cannot find the AT String msg = I18n.err( I18n.ERR_04323, oid, mayAttributeTypeName ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_MAY_AT, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_NONEXISTENT_MAY_AT, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } } @@ -277,10 +280,10 @@ public class ObjectClass extends Abstrac String msg = I18n.err( I18n.ERR_04484_COLLECTIVE_NOT_ALLOWED_IN_MUST, mustAttributeTypeName, oid ); - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MUST, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MUST, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } @@ -289,9 +292,10 @@ public class ObjectClass extends Abstrac // Already registered : this is an error String msg = I18n.err( I18n.ERR_04324, oid, mustAttributeTypeName ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MUST, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MUST, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } @@ -301,10 +305,11 @@ public class ObjectClass extends Abstrac // Already registered : this is an error String msg = I18n.err( I18n.ERR_04325, oid, mustAttributeTypeName ); - Throwable error = new LdapSchemaException( + LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY_AND_MUST, - this, msg ); - errors.add( error ); + msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } @@ -315,9 +320,10 @@ public class ObjectClass extends Abstrac // Cannot find the AT String msg = I18n.err( I18n.ERR_04326, oid, mustAttributeTypeName ); - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_MUST_AT, - this, msg ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_NONEXISTENT_MUST_AT, msg ); + ldapSchemaException.setSourceObject( this ); + errors.add( ldapSchemaException ); break; } } Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java Wed Feb 2 13:39:26 2011 @@ -26,7 +26,6 @@ import java.util.Map; import org.apache.directory.shared.asn1.util.OID; import org.apache.directory.shared.i18n.I18n; -import org.apache.directory.shared.ldap.model.exception.LdapAttributeInUseException; import org.apache.directory.shared.ldap.model.exception.LdapException; import org.apache.directory.shared.ldap.model.exception.LdapSchemaException; import org.apache.directory.shared.ldap.model.exception.LdapSchemaExceptionCodes; @@ -197,8 +196,10 @@ public abstract class DefaultSchemaObjec { String msg = I18n.err( I18n.ERR_04270, schemaObjectType.name(), oid ); LOG.warn( msg ); - throw new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, - schemaObject, msg ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, msg ); + ldapSchemaException.setSourceObject( schemaObject ); + throw ldapSchemaException; } byName.put( oid, schemaObject ); @@ -215,8 +216,10 @@ public abstract class DefaultSchemaObjec { String msg = I18n.err( I18n.ERR_04271, schemaObjectType.name(), name ); LOG.warn( msg ); - throw new LdapSchemaException( LdapSchemaExceptionCodes.NAME_ALREADY_REGISTERED, - schemaObject, msg ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.NAME_ALREADY_REGISTERED, msg ); + ldapSchemaException.setSourceObject( schemaObject ); + throw ldapSchemaException; } else { Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java?rev=1066462&r1=1066461&r2=1066462&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/schema/registries/Registries.java Wed Feb 2 13:39:26 2011 @@ -1006,17 +1006,19 @@ public class Registries implements Schem catch ( LdapException ne ) { // This MR's syntax has not been loaded into the Registries. - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, - matchingRule, I18n.err( I18n.ERR_04294, matchingRule.getOid() ) ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_04294, matchingRule.getOid() ) ); + ldapSchemaException.setSourceObject( matchingRule ); + errors.add( ldapSchemaException ); } } else { // This is an error. - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, - matchingRule, I18n.err( I18n.ERR_04294, matchingRule.getOid() ) ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_04294, matchingRule.getOid() ) ); + ldapSchemaException.setSourceObject( matchingRule ); + errors.add( ldapSchemaException ); } // Process the Normalizer @@ -1248,10 +1250,11 @@ public class Registries implements Schem if ( musts.contains( may ) ) { // This is not allowed. - Throwable error = new LdapSchemaException( - LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY_AND_MUST, - objectClass, may ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY_AND_MUST ); + ldapSchemaException.setSourceObject( objectClass ); + ldapSchemaException.setOtherObject( may ); + errors.add( ldapSchemaException ); return; } } @@ -1279,9 +1282,11 @@ public class Registries implements Schem // This OC's superior has not been loaded into the Registries. if ( !processed.contains( superiorOid ) ) { - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_SUPERIOR, - objectClass, superiorOid ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_NONEXISTENT_SUPERIOR ); + ldapSchemaException.setSourceObject( objectClass ); + ldapSchemaException.setRelatedId( superiorOid ); + errors.add( ldapSchemaException ); } } @@ -1297,9 +1302,11 @@ public class Registries implements Schem else { // Not allowed : we have a cyle - Throwable error = new LdapSchemaException( LdapSchemaExceptionCodes.OC_CYCLE_CLASS_HIERARCHY, - objectClass, superior ); - errors.add( error ); + LdapSchemaException ldapSchemaException = new LdapSchemaException( + LdapSchemaExceptionCodes.OC_CYCLE_CLASS_HIERARCHY ); + ldapSchemaException.setSourceObject( objectClass ); + ldapSchemaException.setOtherObject( superior ); + errors.add( ldapSchemaException ); return; } }