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 2010/03/15 20:24:54 UTC
svn commit: r923395 -
/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/
Author: elecharny
Date: Mon Mar 15 19:24:53 2010
New Revision: 923395
URL: http://svn.apache.org/viewvc?rev=923395&view=rev
Log:
o Remove dependence from JNDI exception
o Define a new inheritence scheme
o Renamed some Exceptions
o Injected new exceptions
Note : the trunk won't compile until all the places those exceptions are used are fixed.
Added:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAffectMultipleDsaException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasDereferencingException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapEntryAlreadyExistsException.java
- copied, changed from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameAlreadyBoundException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeTypeException.java
- copied, changed from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeIdentifierException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidDnException.java
- copied, changed from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidNameException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidSearchFilterException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapLoopDetectedException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchObjectException.java
- copied, changed from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameNotFoundException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationErrorException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOtherException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapProtocolErrorException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapUnwillingToPerformException.java
- copied, changed from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationNotSupportedException.java
Removed:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeIdentifierException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidNameException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameAlreadyBoundException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameNotFoundException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNamingException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationNotSupportedException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapSizeLimitExceededException.java
Modified:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAttributeInUseException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationNotSupportedException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapConfigurationException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapContextNotEmptyException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeValueException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoPermissionException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchAttributeException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapReferralException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapSchemaViolationException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapServiceUnavailableException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapTimeLimitExceededException.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/OperationAbandonedException.java
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAffectMultipleDsaException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAffectMultipleDsaException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAffectMultipleDsaException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAffectMultipleDsaException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#AFFECTS_MULTIPLE_DSAS} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapAffectMultipleDsaException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapAffectMultipleDsaException.
+ *
+ * @param message The exception message
+ */
+ public LdapAffectMultipleDsaException( String message )
+ {
+ super( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapAffectMultipleDsaException.
+ */
+ public LdapAffectMultipleDsaException()
+ {
+ super( ResultCodeEnum.AFFECTS_MULTIPLE_DSAS, null );
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasDereferencingException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasDereferencingException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasDereferencingException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasDereferencingException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#ALIAS_DEREFERENCING_PROBLEM} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapAliasDereferencingException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapAliasDereferencingException.
+ *
+ * @param message The exception message
+ */
+ public LdapAliasDereferencingException( String message )
+ {
+ super( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapAliasDereferencingException.
+ */
+ public LdapAliasDereferencingException()
+ {
+ super( ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM, null );
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAliasException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#ALIAS_PROBLEM} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapAliasException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapAliasException.
+ *
+ * @param message The exception message
+ */
+ public LdapAliasException( String message )
+ {
+ super( ResultCodeEnum.ALIAS_PROBLEM, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapAliasException.
+ */
+ public LdapAliasException()
+ {
+ super( ResultCodeEnum.ALIAS_PROBLEM, null );
+ }
+}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAttributeInUseException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAttributeInUseException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAttributeInUseException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAttributeInUseException.java Mon Mar 15 19:24:53 2010
@@ -20,49 +20,37 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.directory.AttributeInUseException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A subclass of AttributeInUseException which holds the LDAP resultCode
+ * A subclass of {@link LdapOperationException} which holds the LDAP resultCode
* associated with the exception.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapAttributeInUseException extends AttributeInUseException implements LdapException
+public class LdapAttributeInUseException extends LdapOperationException
{
- static final long serialVersionUID = 886120483680893537L;
-
-
- /**
- * @see AttributeInUseException#AttributeInUseException()
- */
- public LdapAttributeInUseException()
- {
- super();
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * @see AttributeInUseException#AttributeInUseException(String)
+ * Creates a new instance of LdapAttributeInUseException.
+ *
+ * @param message The exception message
*/
- public LdapAttributeInUseException(String explanation)
+ public LdapAttributeInUseException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS, message );
}
/**
- * @see LdapException#getResultCode()
+ * Creates a new instance of LdapAttributeInUseException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapAttributeInUseException()
{
- return ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS;
+ super( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS, null );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationException.java Mon Mar 15 19:24:53 2010
@@ -20,45 +20,37 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.AuthenticationException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A subclass of {@link AuthenticationException} which associates the
+ * A subclass of {@link LdapOperationException} which associates the
* {@link ResultCodeEnum#INVALIDCREDENTIALS} value with the type.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapAuthenticationException extends AuthenticationException implements LdapException
+public class LdapAuthenticationException extends LdapOperationException
{
- static final long serialVersionUID = 4035795887975350185L;
-
-
- public LdapAuthenticationException(String msg)
- {
- super( msg );
- }
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
-
- public LdapAuthenticationException()
+ /**
+ * Creates a new instance of LdapAuthenticationException.
+ *
+ * @param message The exception message
+ */
+ public LdapAuthenticationException( String message )
{
+ super( ResultCodeEnum.INVALID_CREDENTIALS, message );
}
/**
- * Gets ResultCodeEnum.INVALIDCREDENTIALS every time.
- *
- * @see LdapException#getResultCode()
- * @return ResultCodeEnum.INVALIDCREDENTIALS
+ * Creates a new instance of LdapAuthenticationException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapAuthenticationException()
{
- return ResultCodeEnum.INVALID_CREDENTIALS;
+ super( ResultCodeEnum.INVALID_CREDENTIALS, null );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationNotSupportedException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationNotSupportedException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationNotSupportedException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapAuthenticationNotSupportedException.java Mon Mar 15 19:24:53 2010
@@ -20,88 +20,49 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.AuthenticationNotSupportedException;
-
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A subclass of the {@link AuthenticationNotSupportedException} carrying along
+ * A subclass of the {@link LdapOperationException} carrying along
* an unequivocal ResultCodeEnum value.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapAuthenticationNotSupportedException extends AuthenticationNotSupportedException implements
- LdapException
+public class LdapAuthenticationNotSupportedException extends LdapOperationException
{
- static final long serialVersionUID = 2532733848470791678L;
-
- /** the result code type safe enumeration */
- private final ResultCodeEnum resultCode;
-
-
- // ------------------------------------------------------------------------
- // C O N S T R U C T O R S
- // ------------------------------------------------------------------------
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * Creates an LdapException with the resultCode.
- *
- * @see AuthenticationNotSupportedException#AuthenticationNotSupportedException()
- * @param resultCode
- * the resultCode enumeration
- * @throws IllegalArgumentException
- * if the resultCode is not one of the codes corresponding to an
- * AuthenticationNotSupportedException
+ * Creates a new instance of LdapAuthenticationNotSupportedException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ * @param message The exception message
*/
- public LdapAuthenticationNotSupportedException(ResultCodeEnum resultCode)
+ public LdapAuthenticationNotSupportedException( ResultCodeEnum resultCode, String message )
{
- super();
+ super( message );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
- checkResultCode();
}
/**
- * Sets the resultCode associated with this LdapException.
+ * Creates a new instance of LdapAuthenticationNotSupportedException.
*
- * @see AuthenticationNotSupportedException#AuthenticationNotSupportedException(String)
- * @param resultCode
- * the resultCode enumeration
- * @throws IllegalArgumentException
- * if the resultCode is not one of the codes corresponding to an
- * AuthenticationNotSupportedException
+ * @param resultCode the ResultCodeEnum for this exception
*/
- public LdapAuthenticationNotSupportedException(String explanation, ResultCodeEnum resultCode)
+ public LdapAuthenticationNotSupportedException( ResultCodeEnum resultCode )
{
- super( explanation );
+ super( null );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
- checkResultCode();
}
- // ------------------------------------------------------------------------
- // LdapException methods
- // ------------------------------------------------------------------------
-
- /**
- * @see LdapException#getResultCode()
- */
- public ResultCodeEnum getResultCode()
- {
- return resultCode;
- }
-
-
- // ------------------------------------------------------------------------
- // P R I V A T E M E T H O D S
- // ------------------------------------------------------------------------
-
/**
* Checks to make sure the resultCode value is right for this exception
* type.
@@ -112,14 +73,14 @@ public class LdapAuthenticationNotSuppor
* {@link ResultCodeEnum#AUTHMETHODNOTSUPPORTED},
* {@link ResultCodeEnum#CONFIDENTIALITYREQUIRED}.
*/
- private void checkResultCode()
+ private void checkResultCode( ResultCodeEnum resultCode )
{
switch ( resultCode )
{
case INAPPROPRIATE_AUTHENTICATION :
case CONFIDENTIALITY_REQUIRED :
case AUTH_METHOD_NOT_SUPPORTED :
- break;
+ return;
default:
throw new IllegalArgumentException( I18n.err( I18n.ERR_04140, resultCode ) );
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapConfigurationException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapConfigurationException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapConfigurationException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapConfigurationException.java Mon Mar 15 19:24:53 2010
@@ -20,64 +20,58 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.ConfigurationException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A ConfigurationException which associates a resultCode namely the
+ * A {@link LdapException} which associates a resultCode namely the
* {@link ResultCodeEnum#OTHER} resultCode with the exception.
*
- * @see LdapException
- * @see javax.naming.ConfigurationException
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapConfigurationException extends ConfigurationException implements LdapException
+public class LdapConfigurationException extends LdapOperationException
{
- static final long serialVersionUID = 7062168557099947648L;
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /** The exception cause */
+ private Throwable cause;
/**
- * @see javax.naming.NoPermissionException#NoPermissionException()
+ * Creates a new instance of LdapAuthenticationException.
+ *
+ * @param message The exception message
*/
- public LdapConfigurationException()
+ public LdapConfigurationException( String message )
{
- super();
+ super( message );
}
/**
- * @see javax.naming.NoPermissionException#NoPermissionException( String )
+ * Creates a new instance of LdapAuthenticationException.
*/
- public LdapConfigurationException( String explanation )
+ public LdapConfigurationException()
{
- super( explanation );
+ super( null );
}
-
-
+
+
/**
- * @see javax.naming.NoPermissionException#NoPermissionException( String )
*/
- public LdapConfigurationException( String explanation, Throwable t )
+ public LdapConfigurationException( String message, Throwable cause )
{
- super( explanation );
- super.setRootCause( t );
+ super( message );
+ this.cause = cause;
}
-
-
+
+
/**
- * Always returns
- * {@link org.apache.directory.shared.ldap.message.ResultCodeEnum#OTHER}
- *
- * @see LdapException#getResultCode()
+ * @return Returns the Exception's cause
*/
- public ResultCodeEnum getResultCode()
+ public Throwable getCause()
{
- return ResultCodeEnum.OTHER;
+ return cause;
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapContextNotEmptyException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapContextNotEmptyException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapContextNotEmptyException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapContextNotEmptyException.java Mon Mar 15 19:24:53 2010
@@ -20,8 +20,6 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.ContextNotEmptyException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -31,30 +29,27 @@ import org.apache.directory.shared.ldap.
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapContextNotEmptyException extends ContextNotEmptyException implements LdapException
+public class LdapContextNotEmptyException extends LdapOperationException
{
- static final long serialVersionUID = -2320797162018226278L;
-
-
- public LdapContextNotEmptyException()
- {
- super();
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
- public LdapContextNotEmptyException(String explanation)
+ /**
+ * Creates a new instance of LdapContextNotEmptyException.
+ *
+ * @param message The exception message
+ */
+ public LdapContextNotEmptyException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF, message );
}
/**
- * Gets the LDAP ResultCode for this exception type.
- *
- * @return {@link ResultCodeEnum#NOTALLOWEDONNONLEAF} always
+ * Creates a new instance of LdapContextNotEmptyException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapContextNotEmptyException()
{
- return ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF;
+ super( ResultCodeEnum.NOT_ALLOWED_ON_NON_LEAF, null );
}
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapEntryAlreadyExistsException.java (from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameAlreadyBoundException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapEntryAlreadyExistsException.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapEntryAlreadyExistsException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameAlreadyBoundException.java&r1=923219&r2=923395&rev=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameAlreadyBoundException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapEntryAlreadyExistsException.java Mon Mar 15 19:24:53 2010
@@ -20,47 +20,37 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.NameAlreadyBoundException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A NameAlreadyBoundException which contains LDAP specific information such as
+ * A {@link LdapOperationException} which contains LDAP specific information such as
* a result code.
*
- * @see NameAlreadyBoundException
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapNameAlreadyBoundException extends NameAlreadyBoundException implements LdapException
+public class LdapEntryAlreadyExistsException extends LdapOperationException
{
- static final long serialVersionUID = 5387177233617276618L;
-
-
- public LdapNameAlreadyBoundException()
- {
- super();
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
- public LdapNameAlreadyBoundException(String explanation)
+ /**
+ * Creates a new instance of LdapEntryAlreadyExistsException.
+ *
+ * @param message The exception message
+ */
+ public LdapEntryAlreadyExistsException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.ENTRY_ALREADY_EXISTS, message );
}
/**
- * Always returns ResultCodeEnum.ENTRYALREADYEXISTS.
- *
- * @see LdapException#getResultCode()
- * @return ResultCodeEnum.ENTRYALREADYEXISTS all the time
+ * Creates a new instance of LdapEntryAlreadyExistsException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapEntryAlreadyExistsException()
{
- return ResultCodeEnum.ENTRY_ALREADY_EXISTS;
+ super( ResultCodeEnum.ENTRY_ALREADY_EXISTS, null );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapException.java Mon Mar 15 19:24:53 2010
@@ -20,25 +20,25 @@
package org.apache.directory.shared.ldap.exception;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-
-
/**
- * An interface for exceptions which add LDAP specific information to
+ * An class for exceptions which add LDAP specific information to
* Exceptions.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public interface LdapException
+public class LdapException extends Exception
{
+ /** The serial version UUID */
+ private static final long serialVersionUID = 1L;
+
/**
- * Gets the LDAP result code that would be associated with this exception.
- *
- * @return the LDAP result code corresponding to this exception type.
+ * Creates a new instance of LdapException.
+ *
+ * @param message The exception message
*/
- public ResultCodeEnum getResultCode();
+ public LdapException( String message )
+ {
+ super( message );
+ }
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeTypeException.java (from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeIdentifierException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeTypeException.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeTypeException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeIdentifierException.java&r1=923219&r2=923395&rev=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeIdentifierException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeTypeException.java Mon Mar 15 19:24:53 2010
@@ -20,50 +20,37 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.directory.InvalidAttributeIdentifierException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A subclass of InvalidAttributeIdentifierException which holds the LDAP
+ * A subclass of {@link LdapOperationException} which holds the LDAP
* resultCode associated with the exception. The LDAP result code associated
* with this exception is the undefinedAttributeType result code value of 17.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LdapInvalidAttributeIdentifierException extends InvalidAttributeIdentifierException implements
- LdapException
+public class LdapInvalidAttributeTypeException extends LdapOperationException
{
- static final long serialVersionUID = 886120483680893537L;
-
-
- /**
- * @see javax.naming.directory.InvalidAttributeIdentifierException#InvalidAttributeIdentifierException()
- */
- public LdapInvalidAttributeIdentifierException()
- {
- super();
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * @see javax.naming.directory.InvalidAttributeIdentifierException#InvalidAttributeIdentifierException(String)
+ * Creates a new instance of LdapInvalidAttributeTypeException.
+ *
+ * @param message The exception message
*/
- public LdapInvalidAttributeIdentifierException(String explanation)
+ public LdapInvalidAttributeTypeException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE, message );
}
/**
- * @see LdapException#getResultCode()
+ * Creates a new instance of LdapInvalidAttributeTypeException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapInvalidAttributeTypeException()
{
- return ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE;
+ super( ResultCodeEnum.UNDEFINED_ATTRIBUTE_TYPE, null );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeValueException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeValueException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeValueException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidAttributeValueException.java Mon Mar 15 19:24:53 2010
@@ -20,83 +20,67 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.directory.InvalidAttributeValueException;
-
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * Makes a InvalidAttributeValueException unambiguous with respect to the result
+ * Makes a {@link LdapOperationException} unambiguous with respect to the result
* code it corresponds to by associating an LDAP specific result code with it.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapInvalidAttributeValueException extends InvalidAttributeValueException implements LdapException
+public class LdapInvalidAttributeValueException extends LdapOperationException
{
- static final long serialVersionUID = 5763624876999168014L;
-
- /** the LDAP resultCode this exception is associated with */
- private final ResultCodeEnum resultCode;
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * Creates an Ldap InvalidAttributeValueException using a result code.
- *
- * @param resultCode
- * the LDAP resultCode this exception is associated with
- * @throws IllegalArgumentException
- * if the resultCode argument is not
- * ResultCodeEnum.CONSTRAINTVIOLATION, or
- * ResultCodeEnum.INVALIDATTRIBUTESYNTAX
+ * Creates a new instance of LdapInvalidAttributeValueException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ * @param message The exception message
*/
- public LdapInvalidAttributeValueException(ResultCodeEnum resultCode)
+ public LdapInvalidAttributeValueException( ResultCodeEnum resultCode, String message )
{
- super();
-
- switch ( resultCode )
- {
- case CONSTRAINT_VIOLATION :
- case INVALID_ATTRIBUTE_SYNTAX :
- break;
-
- default:
-
- throw new IllegalArgumentException( I18n.err( I18n.ERR_04141, resultCode ) );
- }
-
+ super( message );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Creates an Ldap InvalidAttributeValueException using a result code and a
- * specific message.
+ * Creates a new instance of LdapInvalidAttributeValueException.
*
- * @param explanation
- * an explanation for the failure
- * @param resultCode
- * the LDAP resultCode this exception is associated with
+ * @param resultCode the ResultCodeEnum for this exception
*/
- public LdapInvalidAttributeValueException(String explanation, ResultCodeEnum resultCode)
+ public LdapInvalidAttributeValueException( ResultCodeEnum resultCode )
{
- super( explanation );
-
+ super( null );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Gets the LDAP resultCode this exception is associated with.
+ * Checks to make sure the resultCode value is right for this exception
+ * type.
*
- * @return the LDAP resultCode this exception is associated with
+ * @throws IllegalArgumentException
+ * if the result code is not one of
+ * {@link ResultCodeEnum#CONSTRAINT_VIOLATION},
+ * {@link ResultCodeEnum#INVALID_ATTRIBUTE_SYNTAX}.
*/
- public ResultCodeEnum getResultCode()
+ private void checkResultCode( ResultCodeEnum resultCode )
{
- return this.resultCode;
+ switch ( resultCode )
+ {
+ case CONSTRAINT_VIOLATION :
+ case INVALID_ATTRIBUTE_SYNTAX :
+
+ default:
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_04140, resultCode ) );
+ }
}
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidDnException.java (from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidNameException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidDnException.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidDnException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidNameException.java&r1=923219&r2=923395&rev=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidNameException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidDnException.java Mon Mar 15 19:24:53 2010
@@ -19,61 +19,67 @@
*/
package org.apache.directory.shared.ldap.exception;
-
-import javax.naming.InvalidNameException;
-
+import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A subclass of InvalidNameException designed to hold an unequivocal LDAP
+ * A subclass of {@link LdapOperationException} designed to hold an unequivocal LDAP
* result code.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapInvalidNameException extends InvalidNameException implements LdapException
+public class LdapInvalidDnException extends LdapOperationException
{
- static final long serialVersionUID = 1922458280238058561L;
-
- /** the LDAP resultCode this exception is associated with */
- private final ResultCodeEnum resultCode;
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * Creates an Eve NamingException.
- *
- * @param resultCode
- * the LDAP resultCode this exception is associated with
+ * Creates a new instance of LdapInvalidDnException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ * @param message The exception message
*/
- public LdapInvalidNameException(ResultCodeEnum resultCode)
+ public LdapInvalidDnException( ResultCodeEnum resultCode, String message )
{
+ super( message );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Creates an Eve NamingException.
+ * Creates a new instance of LdapInvalidDnException.
*
- * @param explanation
- * an explanation for the failure
- * @param resultCode
- * the LDAP resultCode this exception is associated with
+ * @param resultCode the ResultCodeEnum for this exception
*/
- public LdapInvalidNameException(String explanation, ResultCodeEnum resultCode)
+ public LdapInvalidDnException( ResultCodeEnum resultCode )
{
- super( explanation );
+ super( null );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Gets the LDAP resultCode this exception is associated with.
+ * Checks to make sure the resultCode value is right for this exception
+ * type.
*
- * @return the LDAP resultCode this exception is associated with
+ * @throws IllegalArgumentException
+ * if the result code is not one of
+ * {@link ResultCodeEnum#INVALID_DN_SYNTAX},
+ * {@link ResultCodeEnum#NAMING_VIOLATION}.
*/
- public ResultCodeEnum getResultCode()
+ private void checkResultCode( ResultCodeEnum resultCode )
{
- return resultCode;
+ switch ( resultCode )
+ {
+ case INVALID_DN_SYNTAX :
+ case NAMING_VIOLATION :
+
+ default:
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_04140, resultCode ) );
+ }
}
}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidSearchFilterException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidSearchFilterException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidSearchFilterException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapInvalidSearchFilterException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#INAPPROPRIATE_MATCHING} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapInvalidSearchFilterException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapInvalidSearchFilterException.
+ *
+ * @param message The exception message
+ */
+ public LdapInvalidSearchFilterException( String message )
+ {
+ super( ResultCodeEnum.INAPPROPRIATE_MATCHING, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapInvalidSearchFilterException.
+ */
+ public LdapInvalidSearchFilterException()
+ {
+ super( ResultCodeEnum.INAPPROPRIATE_MATCHING, null );
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapLoopDetectedException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapLoopDetectedException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapLoopDetectedException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapLoopDetectedException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#LOOP_DETECT} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapLoopDetectedException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapLoopDetectedException.
+ *
+ * @param message The exception message
+ */
+ public LdapLoopDetectedException( String message )
+ {
+ super( ResultCodeEnum.LOOP_DETECT, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapLoopDetectedException.
+ */
+ public LdapLoopDetectedException()
+ {
+ super( ResultCodeEnum.LOOP_DETECT, null );
+ }
+}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoPermissionException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoPermissionException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoPermissionException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoPermissionException.java Mon Mar 15 19:24:53 2010
@@ -20,54 +20,38 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.NoPermissionException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A NoPermissionException which associates a resultCode namely the
+ * A {@link LdapOperationException} which associates a resultCode namely the
* {@link ResultCodeEnum#INSUFFICIENTACCESSRIGHTS} resultCode with the
* exception.
*
- * @see LdapException
- * @see NoPermissionException
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapNoPermissionException extends NoPermissionException implements LdapException
+public class LdapNoPermissionException extends LdapOperationException
{
- static final long serialVersionUID = -8611970137960601723L;
-
-
- /**
- * @see NoPermissionException#NoPermissionException()
- */
- public LdapNoPermissionException()
- {
- super();
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * @see NoPermissionException#NoPermissionException(String)
+ * Creates a new instance of LdapNoPermissionException.
+ *
+ * @param message The exception message
*/
- public LdapNoPermissionException(String explanation)
+ public LdapNoPermissionException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, message );
}
/**
- * Always returns {@link ResultCodeEnum#INSUFFICIENTACCESSRIGHTS}
- *
- * @see LdapException#getResultCode()
+ * Creates a new instance of LdapNoPermissionException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapNoPermissionException()
{
- return ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS;
+ super( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, null );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchAttributeException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchAttributeException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchAttributeException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchAttributeException.java Mon Mar 15 19:24:53 2010
@@ -20,49 +20,37 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.directory.NoSuchAttributeException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A subclass of NoSuchAttributeException which holds the LDAP resultCode
+ * A subclass of {@link LdapOperationException} which holds the LDAP resultCode
* associated with the exception.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapNoSuchAttributeException extends NoSuchAttributeException implements LdapException
+public class LdapNoSuchAttributeException extends LdapOperationException
{
- static final long serialVersionUID = 886120483680893537L;
-
-
- /**
- * @see javax.naming.directory.NoSuchAttributeException#NoSuchAttributeException()
- */
- public LdapNoSuchAttributeException()
- {
- super();
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * @see javax.naming.directory.NoSuchAttributeException#NoSuchAttributeException(String)
+ * Creates a new instance of LdapNoSuchAttributeException.
+ *
+ * @param message The exception message
*/
- public LdapNoSuchAttributeException(String explanation)
+ public LdapNoSuchAttributeException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.NO_SUCH_ATTRIBUTE, message );
}
/**
- * @see LdapException#getResultCode()
+ * Creates a new instance of LdapNoSuchAttributeException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapNoSuchAttributeException()
{
- return ResultCodeEnum.NO_SUCH_ATTRIBUTE;
+ super( ResultCodeEnum.NO_SUCH_ATTRIBUTE, null );
}
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchObjectException.java (from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameNotFoundException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchObjectException.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchObjectException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameNotFoundException.java&r1=923219&r2=923395&rev=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNameNotFoundException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapNoSuchObjectException.java Mon Mar 15 19:24:53 2010
@@ -20,46 +20,37 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.NameNotFoundException;
-
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * A NameNotFoundException holding LDAP specific information such as the LDAP
+ * A {@link LdapOperationException} holding LDAP specific information such as the LDAP
* ResultCode.
*
- * @see NameNotFoundException
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapNameNotFoundException extends NameNotFoundException implements LdapException
+public class LdapNoSuchObjectException extends LdapOperationException
{
- static final long serialVersionUID = 5162107136594237160L;
-
-
- public LdapNameNotFoundException()
- {
- }
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
- public LdapNameNotFoundException(String explanation)
+ /**
+ * Creates a new instance of LdapNoSuchObjectException.
+ *
+ * @param message The exception message
+ */
+ public LdapNoSuchObjectException( String message )
{
- super( explanation );
+ super( ResultCodeEnum.NO_SUCH_OBJECT, message );
}
/**
- * Gets the ResultCode associated with this exception which will always be
- * ResultCodeEnum.NOSUCHOBJECT.
- *
- * @return ResultCodeEnum.NOSUCHOBJECT
+ * Creates a new instance of LdapNoSuchObjectException.
*/
- public ResultCodeEnum getResultCode()
+ public LdapNoSuchObjectException()
{
- return ResultCodeEnum.NO_SUCH_OBJECT;
+ super( ResultCodeEnum.NO_SUCH_OBJECT, null );
}
}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationErrorException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationErrorException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationErrorException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationErrorException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#OPERATIONS_ERROR} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapOperationErrorException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapOperationErrorException.
+ *
+ * @param message The exception message
+ */
+ public LdapOperationErrorException( String message )
+ {
+ super( ResultCodeEnum.OPERATIONS_ERROR, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapOperationErrorException.
+ */
+ public LdapOperationErrorException()
+ {
+ super( ResultCodeEnum.OPERATIONS_ERROR, null );
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * An class for LDAP operation exceptions which add LDAP specific information to
+ * Exceptions.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 437007 $
+ */
+public class LdapOperationException extends LdapException
+{
+ /** The serial version UUID */
+ private static final long serialVersionUID = 1L;
+
+ /** The operation resultCode */
+ protected ResultCodeEnum resultCode;
+
+ /**
+ * Creates a new instance of LdapOperationException.
+ *
+ * @param resultCode The operation resultCode
+ * @param message The exception message
+ */
+ public LdapOperationException( ResultCodeEnum resultCode, String message )
+ {
+ super( message );
+ this.resultCode = resultCode;
+ }
+
+
+ /**
+ * Creates a new instance of LdapOperationException.
+ *
+ * @param message The exception message
+ */
+ public LdapOperationException( String message )
+ {
+ super( message );
+ }
+
+
+ /**
+ * Gets the LDAP result code that would be associated with this exception.
+ *
+ * @return the LDAP result code corresponding to this exception type.
+ */
+ public ResultCodeEnum getResultCode()
+ {
+ return resultCode;
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOtherException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOtherException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOtherException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOtherException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#OTHER} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapOtherException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapOtherException.
+ *
+ * @param message The exception message
+ */
+ public LdapOtherException( String message )
+ {
+ super( ResultCodeEnum.OTHER, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapOtherException.
+ */
+ public LdapOtherException()
+ {
+ super( ResultCodeEnum.OTHER, null );
+ }
+}
Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapProtocolErrorException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapProtocolErrorException.java?rev=923395&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapProtocolErrorException.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapProtocolErrorException.java Mon Mar 15 19:24:53 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.exception;
+
+
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
+
+/**
+ * A subclass of {@link LdapOperationException} which associates the
+ * {@link ResultCodeEnum#PROTOCOL_ERROR} value with the type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 477298 $
+ */
+public class LdapProtocolErrorException extends LdapOperationException
+{
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
+
+ /**
+ * Creates a new instance of LdapProtocolErrorException.
+ *
+ * @param message The exception message
+ */
+ public LdapProtocolErrorException( String message )
+ {
+ super( ResultCodeEnum.PROTOCOL_ERROR, message );
+ }
+
+
+ /**
+ * Creates a new instance of LdapProtocolErrorException.
+ */
+ public LdapProtocolErrorException()
+ {
+ super( ResultCodeEnum.PROTOCOL_ERROR, null );
+ }
+}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapReferralException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapReferralException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapReferralException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapReferralException.java Mon Mar 15 19:24:53 2010
@@ -34,20 +34,16 @@ import org.apache.directory.shared.ldap.
/**
- * A ReferralException which associates a resultCode namely the
+ * A {@link LdapOperationException} which associates a resultCode namely the
* {@link ResultCodeEnum#REFERRAL} resultCode with the exception.
*
- * @see LdapException
- * @see ReferralException
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapReferralException extends ReferralException implements LdapException
+public class LdapReferralException extends LdapOperationException
{
- static final long serialVersionUID = -8611970137960601723L;
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
private final List<String> refs;
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapSchemaViolationException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapSchemaViolationException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapSchemaViolationException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapSchemaViolationException.java Mon Mar 15 19:24:53 2010
@@ -20,84 +20,69 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.directory.SchemaViolationException;
-
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * Makes a SchemaViolationException unambiguous with respect to the result code
+ * Makes a {@link LdapOperationException} unambiguous with respect to the result code
* it corresponds to by associating an LDAP specific result code with it.
*
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapSchemaViolationException extends SchemaViolationException implements LdapException
+public class LdapSchemaViolationException extends LdapOperationException
{
- static final long serialVersionUID = 5763624876999168014L;
-
- /** the LDAP resultCode this exception is associated with */
- private final ResultCodeEnum resultCode;
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * Creates an Ldap NamingException using a result code.
- *
- * @param resultCode
- * the LDAP resultCode this exception is associated with
- * @throws IllegalArgumentException
- * if the resultCode argument is not
- * ResultCodeEnum.OBJECTCLASSVIOLATION,
- * ResultCodeEnum.NOTALLOWEDONRDN, or
- * ResultCodeEnum.OBJECTCLASSMODSPROHIBITED
+ * Creates a new instance of LdapSchemaViolationException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ * @param message The exception message
*/
- public LdapSchemaViolationException(ResultCodeEnum resultCode)
+ public LdapSchemaViolationException( ResultCodeEnum resultCode, String message )
{
- super();
-
- switch ( resultCode )
- {
- case OBJECT_CLASS_VIOLATION :
- case NOT_ALLOWED_ON_RDN :
- case OBJECT_CLASS_MODS_PROHIBITED :
- break;
-
- default:
-
- throw new IllegalArgumentException( I18n.err( I18n.ERR_04141, resultCode ) );
- }
-
+ super( message );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Creates an Eve NamingException.
+ * Creates a new instance of LdapSchemaViolationException.
*
- * @param explanation
- * an explanation for the failure
- * @param resultCode
- * the LDAP resultCode this exception is associated with
+ * @param resultCode the ResultCodeEnum for this exception
*/
- public LdapSchemaViolationException(String explanation, ResultCodeEnum resultCode)
+ public LdapSchemaViolationException( ResultCodeEnum resultCode )
{
- super( explanation );
-
+ super( null );
+ checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Gets the LDAP resultCode this exception is associated with.
+ * Checks to make sure the resultCode value is right for this exception
+ * type.
*
- * @return the LDAP resultCode this exception is associated with
+ * @throws IllegalArgumentException
+ * if the result code is not one of
+ * {@link ResultCodeEnum#OBJECT_CLASS_VIOLATION},
+ * {@link ResultCodeEnum#NOT_ALLOWED_ON_RDN}.
+ * {@link ResultCodeEnum#OBJECT_CLASS_MODS_PROHIBITED}.
*/
- public ResultCodeEnum getResultCode()
+ private void checkResultCode( ResultCodeEnum resultCode )
{
- return this.resultCode;
+ switch ( resultCode )
+ {
+ case OBJECT_CLASS_VIOLATION :
+ case NOT_ALLOWED_ON_RDN :
+ case OBJECT_CLASS_MODS_PROHIBITED :
+
+ default:
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_04140, resultCode ) );
+ }
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapServiceUnavailableException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapServiceUnavailableException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapServiceUnavailableException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapServiceUnavailableException.java Mon Mar 15 19:24:53 2010
@@ -20,92 +20,68 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.ServiceUnavailableException;
-
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * LDAP specific ServiceUnavailableException that preserves resultCode
+ * LDAP specific {@link LdapOperationException} that preserves resultCode
* resolution.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapServiceUnavailableException extends ServiceUnavailableException implements LdapException
+public class LdapServiceUnavailableException extends LdapOperationException
{
- static final long serialVersionUID = -5058439476235675179L;
-
- /** the LDAP result code to be checked */
- private final ResultCodeEnum resultCode;
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
- * Creates an LDAP specific ServiceUnavailableException that preserves
- * resultCode resolution.
- *
- * @param resultCode
- * the LDAP result code to be checked
- * @throws IllegalArgumentException
- * if the result code is not within the set
- * {@link ResultCodeEnum#SERVICEUNAVAILABLE_CODES}.
+ * Creates a new instance of LdapServiceUnavailableException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ * @param message The exception message
*/
- public LdapServiceUnavailableException(ResultCodeEnum resultCode)
+ public LdapServiceUnavailableException( ResultCodeEnum resultCode, String message )
{
- super();
+ super( message );
checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Creates an LDAP specific ServiceUnavailableException that preserves
- * resultCode resolution.
+ * Creates a new instance of LdapServiceUnavailableException.
*
- * @param explanation
- * the reason for the exception to pass to super
- * @param resultCode
- * the LDAP result code to be checked
- * @throws IllegalArgumentException
- * if the result code is not within the set
- * {@link ResultCodeEnum#SERVICEUNAVAILABLE_CODES}.
+ * @param resultCode the ResultCodeEnum for this exception
*/
- public LdapServiceUnavailableException(String explanation, ResultCodeEnum resultCode)
+ public LdapServiceUnavailableException( ResultCodeEnum resultCode )
{
- super( explanation );
+ super( null );
checkResultCode( resultCode );
this.resultCode = resultCode;
}
/**
- * Checks to see if the LDAP result code is valid for this exception.
+ * Checks to make sure the resultCode value is right for this exception
+ * type.
*
- * @param resultCode
- * the LDAP result code to be checked
* @throws IllegalArgumentException
- * if the result code is not within the set
- * {@link ResultCodeEnum#SERVICEUNAVAILABLE_CODES}.
+ * if the result code is not one of
+ * {@link ResultCodeEnum#BUSY},
+ * {@link ResultCodeEnum#UNAVAILABLE}.
*/
- private void checkResultCode( ResultCodeEnum result )
+ private void checkResultCode( ResultCodeEnum resultCode )
{
- if ( !ResultCodeEnum.getServiceCodes().contains( result ) )
+ switch ( resultCode )
{
- String msg = I18n.err( I18n.ERR_04143, ResultCodeEnum.getSearchCodes() );
- throw new IllegalArgumentException( msg );
+ case BUSY :
+ case UNAVAILABLE :
+
+ default:
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_04140, resultCode ) );
}
}
-
-
- /**
- * Returns one of the resultCodes within the set {@link
- * ResultCodeEnum#SERVICEUNAVAILABLE_CODES}.
- *
- * @see LdapException#getResultCode()
- */
- public final ResultCodeEnum getResultCode()
- {
- return resultCode;
- }
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapTimeLimitExceededException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapTimeLimitExceededException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapTimeLimitExceededException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapTimeLimitExceededException.java Mon Mar 15 19:24:53 2010
@@ -29,17 +29,13 @@ import org.apache.directory.shared.ldap.
* A TiimeLimitExceededException which associates a resultCode namely the
* {@link ResultCodeEnum#SIZELIMITEXCEEDED} resultCode with the exception.
*
- * @see LdapException
- * @see LdapSizeLimitExceededException
- * @see <a
- * href="http://java.sun.com/j2se/1.4.2/docs/guide/jndi/jndi-ldap-gl.html#EXCEPT">
- * LDAP ResultCode to JNDI Exception Mappings</a>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapTimeLimitExceededException extends TimeLimitExceededException implements LdapException
+public class LdapTimeLimitExceededException extends LdapOperationException
{
- static final long serialVersionUID = -8611970137960601723L;
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
/**
@@ -47,26 +43,15 @@ public class LdapTimeLimitExceededExcept
*/
public LdapTimeLimitExceededException()
{
- super();
+ super( ResultCodeEnum.TIME_LIMIT_EXCEEDED, null );
}
/**
* @see TimeLimitExceededException#TimeLimitExceededException(String)
*/
- public LdapTimeLimitExceededException(String explanation)
+ public LdapTimeLimitExceededException( String explanation )
{
- super( explanation );
- }
-
-
- /**
- * Always returns {@link ResultCodeEnum#TIMELIMITEXCEEDED}
- *
- * @see LdapException#getResultCode()
- */
- public ResultCodeEnum getResultCode()
- {
- return ResultCodeEnum.TIME_LIMIT_EXCEEDED;
+ super( ResultCodeEnum.TIME_LIMIT_EXCEEDED, explanation );
}
}
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapUnwillingToPerformException.java (from r923219, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationNotSupportedException.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapUnwillingToPerformException.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapUnwillingToPerformException.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationNotSupportedException.java&r1=923219&r2=923395&rev=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapOperationNotSupportedException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/LdapUnwillingToPerformException.java Mon Mar 15 19:24:53 2010
@@ -20,53 +20,67 @@
package org.apache.directory.shared.ldap.exception;
-import javax.naming.OperationNotSupportedException;
-
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
/**
- * An LDAPException that extends the OperationNotSupportedException
+ * An LDAPException that extends the {@link LdapOperationException}
* carrying with it the corresponding result codes for this condition.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class LdapOperationNotSupportedException extends OperationNotSupportedException implements LdapException
+public class LdapUnwillingToPerformException extends LdapOperationException
{
- private static final long serialVersionUID = 1L;
- private final ResultCodeEnum resultCode;
-
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
- public LdapOperationNotSupportedException( String description, ResultCodeEnum resultCode )
+ /**
+ * Creates a new instance of LdapUnwillingToPerformException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ * @param message The exception message
+ */
+ public LdapUnwillingToPerformException( ResultCodeEnum resultCode, String message )
{
- super( description );
+ super( message );
checkResultCode( resultCode );
this.resultCode = resultCode;
}
-
- public LdapOperationNotSupportedException( ResultCodeEnum resultCode )
+
+ /**
+ * Creates a new instance of LdapUnwillingToPerformException.
+ *
+ * @param resultCode the ResultCodeEnum for this exception
+ */
+ public LdapUnwillingToPerformException( ResultCodeEnum resultCode )
{
+ super( null );
checkResultCode( resultCode );
this.resultCode = resultCode;
}
-
-
+
+
+ /**
+ * Checks to make sure the resultCode value is right for this exception
+ * type.
+ *
+ * @throws IllegalArgumentException
+ * if the result code is not one of
+ * {@link ResultCodeEnum#UNWILLING_TO_PERFORM},
+ * {@link ResultCodeEnum#UNAVAILABLE_CRITICAL_EXTENSION}.
+ */
private void checkResultCode( ResultCodeEnum resultCode )
{
- if ( ! resultCode.equals( ResultCodeEnum.UNWILLING_TO_PERFORM ) &&
- ! resultCode.equals( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION ) )
+ switch ( resultCode )
{
- throw new IllegalArgumentException( I18n.err( I18n.ERR_04142 ) );
+ case UNWILLING_TO_PERFORM :
+ case UNAVAILABLE_CRITICAL_EXTENSION :
+
+ default:
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_04140, resultCode ) );
}
}
-
-
- public ResultCodeEnum getResultCode()
- {
- return resultCode;
- }
-
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/OperationAbandonedException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/OperationAbandonedException.java?rev=923395&r1=923394&r2=923395&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/OperationAbandonedException.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/exception/OperationAbandonedException.java Mon Mar 15 19:24:53 2010
@@ -31,5 +31,6 @@ import javax.naming.NamingException;
*/
public class OperationAbandonedException extends NamingException
{
- private static final long serialVersionUID = -99548684403070989L;
+ /** The serial version UUID */
+ static final long serialVersionUID = 1L;
}