Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 67727 invoked from network); 16 Mar 2010 15:58:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Mar 2010 15:58:42 -0000 Received: (qmail 71682 invoked by uid 500); 16 Mar 2010 15:58:42 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 71651 invoked by uid 500); 16 Mar 2010 15:58:42 -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 71644 invoked by uid 99); 16 Mar 2010 15:58:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Mar 2010 15:58:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Tue, 16 Mar 2010 15:58:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3682A2388A43; Tue, 16 Mar 2010 15:58:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r923825 - in /directory/shared/trunk/ldap-schema-manager/src: main/java/org/apache/directory/shared/ldap/schema/manager/impl/ test/java/org/apache/directory/shared/ldap/schema/loader/ldif/ Date: Tue, 16 Mar 2010 15:58:17 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100316155817.3682A2388A43@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Tue Mar 16 15:58:16 2010 New Revision: 923825 URL: http://svn.apache.org/viewvc?rev=923825&view=rev Log: Fixed the Exceptions Modified: directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerAddTest.java directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerDelTest.java directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerEnableDisableLoadTest.java Modified: directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=923825&r1=923824&r2=923825&view=diff ============================================================================== --- directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java (original) +++ directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java Tue Mar 16 15:58:16 2010 @@ -27,13 +27,13 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.naming.NamingException; - import org.apache.directory.shared.i18n.I18n; import org.apache.directory.shared.ldap.NotImplementedException; import org.apache.directory.shared.ldap.constants.MetaSchemaConstants; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.entry.Entry; +import org.apache.directory.shared.ldap.exception.LdapException; +import org.apache.directory.shared.ldap.exception.LdapInvalidDnException; import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException; import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; import org.apache.directory.shared.ldap.message.ResultCodeEnum; @@ -203,7 +203,7 @@ public class DefaultSchemaManager implem } else { - throw new LdapUnwillingToPerformException( I18n.err( I18n.ERR_11001, schemaName ), ResultCodeEnum.UNWILLING_TO_PERFORM ); + throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_11001, schemaName ) ); } } @@ -671,7 +671,7 @@ public class DefaultSchemaManager implem // The dependency has not been loaded. String msg = I18n.err( I18n.ERR_11002, schema.getSchemaName() ); LOG.info( msg ); - Throwable error = new LdapSchemaViolationException( msg, ResultCodeEnum.OTHER ); + Throwable error = new LdapSchemaViolationException( ResultCodeEnum.OTHER, msg ); errors.add( error ); return false; } @@ -1330,7 +1330,7 @@ public class DefaultSchemaManager implem schemaModificationAttributesDN .normalize( getRegistries().getAttributeTypeRegistry().getNormalizerMapping() ); } - catch ( NamingException e ) + catch ( LdapInvalidDnException e ) { throw new RuntimeException( e ); } @@ -1451,7 +1451,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public AttributeType lookupAttributeTypeRegistry( String oid ) throws NamingException + public AttributeType lookupAttributeTypeRegistry( String oid ) throws LdapException { return registries.getAttributeTypeRegistry().lookup( StringTools.toLowerCase( oid ).trim() ); } @@ -1460,7 +1460,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public LdapComparator lookupComparatorRegistry( String oid ) throws NamingException + public LdapComparator lookupComparatorRegistry( String oid ) throws LdapException { return registries.getComparatorRegistry().lookup( oid ); } @@ -1469,7 +1469,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public MatchingRule lookupMatchingRuleRegistry( String oid ) throws NamingException + public MatchingRule lookupMatchingRuleRegistry( String oid ) throws LdapException { return registries.getMatchingRuleRegistry().lookup( StringTools.toLowerCase( oid ).trim() ); } @@ -1478,7 +1478,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public Normalizer lookupNormalizerRegistry( String oid ) throws NamingException + public Normalizer lookupNormalizerRegistry( String oid ) throws LdapException { return registries.getNormalizerRegistry().lookup( oid ); } @@ -1487,7 +1487,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public ObjectClass lookupObjectClassRegistry( String oid ) throws NamingException + public ObjectClass lookupObjectClassRegistry( String oid ) throws LdapException { return registries.getObjectClassRegistry().lookup( StringTools.toLowerCase( oid ).trim() ); } @@ -1496,7 +1496,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public LdapSyntax lookupLdapSyntaxRegistry( String oid ) throws NamingException + public LdapSyntax lookupLdapSyntaxRegistry( String oid ) throws LdapException { return registries.getLdapSyntaxRegistry().lookup( StringTools.toLowerCase( oid ).trim() ); } @@ -1505,7 +1505,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SyntaxChecker lookupSyntaxCheckerRegistry( String oid ) throws NamingException + public SyntaxChecker lookupSyntaxCheckerRegistry( String oid ) throws LdapException { return registries.getSyntaxCheckerRegistry().lookup( oid ); } @@ -1543,7 +1543,7 @@ public class DefaultSchemaManager implem /** * Get the inner SchemaObject if it's not a C/N/SC */ - private SchemaObject getSchemaObject( SchemaObject schemaObject ) throws NamingException + private SchemaObject getSchemaObject( SchemaObject schemaObject ) throws LdapException { if ( schemaObject instanceof LoadableSchemaObject ) { @@ -1597,8 +1597,8 @@ public class DefaultSchemaManager implem else { // We have an invalid SchemaObject, no need to go any further - Throwable error = new LdapUnwillingToPerformException( I18n.err( I18n.ERR_11007, schemaObject.getOid() ), - ResultCodeEnum.UNWILLING_TO_PERFORM ); + Throwable error = new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, + I18n.err( I18n.ERR_11007, schemaObject.getOid() ) ); errors.add( error ); } } @@ -1639,8 +1639,8 @@ public class DefaultSchemaManager implem // The new schemaObject's OID must not already exist if ( checkOidExist( copy ) ) { - Throwable error = new LdapSchemaViolationException( I18n.err( I18n.ERR_11008, schemaObject.getOid() ), - ResultCodeEnum.OTHER ); + Throwable error = new LdapSchemaViolationException( ResultCodeEnum.OTHER, + I18n.err( I18n.ERR_11008, schemaObject.getOid() ) ); errors.add( error ); return false; @@ -1652,8 +1652,8 @@ public class DefaultSchemaManager implem if ( schemaName == null ) { // The schema associated with the SchemzaObject does not exist. This is not valid. - Throwable error = new LdapUnwillingToPerformException( I18n.err( I18n.ERR_11009, schemaObject.getOid(), - copy.getSchemaName() ), ResultCodeEnum.UNWILLING_TO_PERFORM ); + Throwable error = new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_11009, schemaObject.getOid(), + copy.getSchemaName() ) ); errors.add( error ); return false; @@ -1669,7 +1669,7 @@ public class DefaultSchemaManager implem // The SchemaObject must be associated with an existing schema String msg = I18n.err( I18n.ERR_11010, copy.getOid() ); LOG.info( msg ); - Throwable error = new LdapSchemaViolationException( msg, ResultCodeEnum.OTHER ); + Throwable error = new LdapSchemaViolationException( ResultCodeEnum.OTHER, msg ); errors.add( error ); return false; } @@ -1742,8 +1742,8 @@ public class DefaultSchemaManager implem // The new schemaObject's OID must exist if ( !checkOidExist( schemaObject ) ) { - Throwable error = new LdapSchemaViolationException( I18n.err( I18n.ERR_11011, schemaObject.getOid() ), - ResultCodeEnum.OTHER ); + Throwable error = new LdapSchemaViolationException( ResultCodeEnum.OTHER, + I18n.err( I18n.ERR_11011, schemaObject.getOid() ) ); errors.add( error ); return false; } @@ -1758,7 +1758,7 @@ public class DefaultSchemaManager implem { String msg = I18n.err( I18n.ERR_11012, schemaObject.getOid(), StringTools.setToString( referencing ) ); - Throwable error = new LdapSchemaViolationException( msg, ResultCodeEnum.OTHER ); + Throwable error = new LdapSchemaViolationException( ResultCodeEnum.OTHER, msg ); errors.add( error ); return false; } @@ -1774,7 +1774,7 @@ public class DefaultSchemaManager implem // The SchemaObject must be associated with an existing schema String msg = I18n.err( I18n.ERR_11013, schemaObject.getOid() ); LOG.info( msg ); - Throwable error = new LdapSchemaViolationException( msg, ResultCodeEnum.OTHER ); + Throwable error = new LdapSchemaViolationException( ResultCodeEnum.OTHER, msg ); errors.add( error ); return false; } @@ -1870,7 +1870,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterAttributeType( String attributeTypeOid ) throws NamingException + public SchemaObject unregisterAttributeType( String attributeTypeOid ) throws LdapException { return registries.getAttributeTypeRegistry().unregister( attributeTypeOid ); } @@ -1879,7 +1879,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterComparator( String comparatorOid ) throws NamingException + public SchemaObject unregisterComparator( String comparatorOid ) throws LdapException { return registries.getComparatorRegistry().unregister( comparatorOid ); } @@ -1888,7 +1888,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterDitControlRule( String ditControlRuleOid ) throws NamingException + public SchemaObject unregisterDitControlRule( String ditControlRuleOid ) throws LdapException { return registries.getDitContentRuleRegistry().unregister( ditControlRuleOid ); } @@ -1897,7 +1897,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterDitStructureRule( String ditStructureRuleOid ) throws NamingException + public SchemaObject unregisterDitStructureRule( String ditStructureRuleOid ) throws LdapException { return registries.getDitStructureRuleRegistry().unregister( ditStructureRuleOid ); } @@ -1906,7 +1906,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterLdapSyntax( String ldapSyntaxOid ) throws NamingException + public SchemaObject unregisterLdapSyntax( String ldapSyntaxOid ) throws LdapException { return registries.getLdapSyntaxRegistry().unregister( ldapSyntaxOid ); } @@ -1915,7 +1915,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterMatchingRule( String matchingRuleOid ) throws NamingException + public SchemaObject unregisterMatchingRule( String matchingRuleOid ) throws LdapException { return registries.getMatchingRuleRegistry().unregister( matchingRuleOid ); } @@ -1924,7 +1924,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterMatchingRuleUse( String matchingRuleUseOid ) throws NamingException + public SchemaObject unregisterMatchingRuleUse( String matchingRuleUseOid ) throws LdapException { return registries.getMatchingRuleUseRegistry().unregister( matchingRuleUseOid ); } @@ -1933,7 +1933,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterNameForm( String nameFormOid ) throws NamingException + public SchemaObject unregisterNameForm( String nameFormOid ) throws LdapException { return registries.getNameFormRegistry().unregister( nameFormOid ); } @@ -1942,7 +1942,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterNormalizer( String normalizerOid ) throws NamingException + public SchemaObject unregisterNormalizer( String normalizerOid ) throws LdapException { return registries.getNormalizerRegistry().unregister( normalizerOid ); } @@ -1951,7 +1951,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterObjectClass( String objectClassOid ) throws NamingException + public SchemaObject unregisterObjectClass( String objectClassOid ) throws LdapException { return registries.getObjectClassRegistry().unregister( objectClassOid ); } @@ -1960,7 +1960,7 @@ public class DefaultSchemaManager implem /** * {@inheritDoc} */ - public SchemaObject unregisterSyntaxChecker( String syntaxCheckerOid ) throws NamingException + public SchemaObject unregisterSyntaxChecker( String syntaxCheckerOid ) throws LdapException { return registries.getSyntaxCheckerRegistry().unregister( syntaxCheckerOid ); } Modified: directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerAddTest.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerAddTest.java?rev=923825&r1=923824&r2=923825&view=diff ============================================================================== --- directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerAddTest.java (original) +++ directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerAddTest.java Tue Mar 16 15:58:16 2010 @@ -32,10 +32,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.naming.NamingException; -import javax.naming.directory.NoSuchAttributeException; - import org.apache.commons.io.FileUtils; +import org.apache.directory.shared.ldap.exception.LdapException; import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException; import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; import org.apache.directory.shared.ldap.schema.AttributeType; @@ -132,11 +130,7 @@ public class SchemaManagerAddTest return attributeType != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -154,11 +148,7 @@ public class SchemaManagerAddTest return matchingRule != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -176,11 +166,7 @@ public class SchemaManagerAddTest return objectClass != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -198,11 +184,7 @@ public class SchemaManagerAddTest return syntax != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } Modified: directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerDelTest.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerDelTest.java?rev=923825&r1=923824&r2=923825&view=diff ============================================================================== --- directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerDelTest.java (original) +++ directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerDelTest.java Tue Mar 16 15:58:16 2010 @@ -30,10 +30,8 @@ import java.io.File; import java.io.IOException; import java.util.List; -import javax.naming.NamingException; -import javax.naming.directory.NoSuchAttributeException; - import org.apache.commons.io.FileUtils; +import org.apache.directory.shared.ldap.exception.LdapException; import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.LdapComparator; @@ -119,11 +117,7 @@ public class SchemaManagerDelTest return attributeType != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -138,11 +132,7 @@ public class SchemaManagerDelTest return comparator != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -157,11 +147,7 @@ public class SchemaManagerDelTest return normalizer != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -176,11 +162,7 @@ public class SchemaManagerDelTest return matchingRule != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -195,11 +177,7 @@ public class SchemaManagerDelTest return syntax != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } @@ -214,11 +192,7 @@ public class SchemaManagerDelTest return syntaxChecker != null; } - catch ( NoSuchAttributeException nsae ) - { - return false; - } - catch ( NamingException ne ) + catch ( LdapException ne ) { return false; } Modified: directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerEnableDisableLoadTest.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerEnableDisableLoadTest.java?rev=923825&r1=923824&r2=923825&view=diff ============================================================================== --- directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerEnableDisableLoadTest.java (original) +++ directory/shared/trunk/ldap-schema-manager/src/test/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaManagerEnableDisableLoadTest.java Tue Mar 16 15:58:16 2010 @@ -31,9 +31,8 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; -import javax.naming.NamingException; - import org.apache.commons.io.FileUtils; +import org.apache.directory.shared.ldap.exception.LdapException; import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor; import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor; @@ -225,7 +224,7 @@ public class SchemaManagerEnableDisableL schemaManager.lookupAttributeTypeRegistry( "gecos" ); fail(); } - catch ( NamingException ne ) + catch ( LdapException ne ) { // Expected }