Update a number of result codes to make the values more consistent across
operations. Also, eliminate a number of incorrect uses of the
OPERATIONS_ERROR result and replace them with the more correct OTHER result.
OpenDS Issue Number: 1786
| | |
| | | DirectoryServer.getExtendedOperationHandler(requestOID); |
| | | if (handler == null) |
| | | { |
| | | setResultCode(ResultCode.UNAVAILABLE_CRITICAL_EXTENSION); |
| | | setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | appendErrorMessage(ERR_EXTENDED_NO_HANDLER.get( |
| | | String.valueOf(requestOID))); |
| | | break extendedProcessing; |
| | |
| | | } |
| | | catch (RuntimeException e) |
| | | { |
| | | resultCode = ResultCode.OPERATIONS_ERROR; |
| | | resultCode = DirectoryServer.getServerErrorResultCode(); |
| | | messages.add(Message.raw(e.getMessage())); |
| | | } |
| | | } |
| | |
| | | { |
| | | Message message = ERR_COULD_NOT_CLOSE_THE_SOCKET.get(e.toString()); |
| | | logError(message); |
| | | new ConfigChangeResult(ResultCode.OPERATIONS_ERROR, false); |
| | | new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(), |
| | | false); |
| | | } |
| | | catch (InterruptedException e) |
| | | { |
| | | Message message = ERR_COULD_NOT_STOP_LISTEN_THREAD.get(e.toString()); |
| | | logError(message); |
| | | new ConfigChangeResult(ResultCode.OPERATIONS_ERROR, false); |
| | | new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(), |
| | | false); |
| | | } |
| | | } |
| | | |
| | |
| | | LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg); |
| | | } catch (DefinitionDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(rufn, rufn, rufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | // FIXME: should not abort here. Instead, display the |
| | | // errors (if verbose) and apply the changes to the |
| | | // partial managed object. |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(rufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectNotFoundException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(rufn); |
| | | throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg); |
| | |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_CREATE_CE |
| | | .get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectAlreadyExistsException e) { |
| | | // Should never happen. |
| | | throw new IllegalStateException(e); |
| | |
| | | } |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectAlreadyExistsException e) { |
| | | Message msg = ERR_DSCFG_ERROR_CREATE_MOAEE.get(ufn); |
| | | throw new ClientException(LDAPResultCode.ENTRY_ALREADY_EXISTS, msg); |
| | |
| | | } catch (DefinitionDecodingException e) { |
| | | Message pufn = path.getManagedObjectDefinition().getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(pufn, pufn, pufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | Message pufn = path.getManagedObjectDefinition().getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e |
| | | .getMessage()); |
| | |
| | | } catch (DefinitionDecodingException e) { |
| | | Message pufn = path.getManagedObjectDefinition().getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(pufn, pufn, pufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | Message pufn = path.getManagedObjectDefinition().getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_DELETE_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg); |
| | |
| | | throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg); |
| | | } catch (DefinitionDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(ufn, ufn, ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg); |
| | |
| | | } catch (DefinitionDecodingException e) { |
| | | ufn = path.getManagedObjectDefinition().getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(ufn, ufn, ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | ufn = path.getManagedObjectDefinition().getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg); |
| | |
| | | // FIXME: just output this as a warnings (incl. the name) but |
| | | // continue. |
| | | Message msg = ERR_DSCFG_ERROR_LIST_DDE.get(ufn, ufn, ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | // FIXME: just output this as a warnings (incl. the name) but |
| | | // continue. |
| | | Message msg = ERR_DSCFG_ERROR_LIST_MODE.get(ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (AuthorizationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_LIST_AUTHZ.get(ufn); |
| | | throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, |
| | |
| | | msg); |
| | | } catch (DefinitionDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_LIST_DDE.get(ufn, ufn, ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_LIST_MODE.get(ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (ConcurrentModificationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn); |
| | | throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg); |
| | |
| | | Message pufn = path.getManagedObjectDefinition() |
| | | .getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(pufn, pufn, pufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | Message pufn = path.getManagedObjectDefinition() |
| | | .getUserFriendlyName(); |
| | | Message msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, |
| | |
| | | } |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectAlreadyExistsException e) { |
| | | // Should never happen. |
| | | throw new IllegalStateException(e); |
| | |
| | | LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg); |
| | | } catch (DefinitionDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(rufn, rufn, rufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | // FIXME: should not abort here. Instead, display the |
| | | // errors (if verbose) and apply the changes to the |
| | | // partial managed object. |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(rufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectNotFoundException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(rufn); |
| | | throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg); |
| | |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_MODIFY_CE |
| | | .get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectAlreadyExistsException e) { |
| | | // Should never happen. |
| | | throw new IllegalStateException(e); |
| | |
| | | throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg); |
| | | } catch (DefinitionDecodingException e) { |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(ufn, ufn, ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ManagedObjectDecodingException e) { |
| | | // FIXME: should not abort here. Instead, display the errors (if |
| | | // verbose) and apply the changes to the partial managed object. |
| | | Message msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(ufn); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg, e); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg, e); |
| | | } catch (CommunicationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage()); |
| | | throw new ClientException(LDAPResultCode.OPERATIONS_ERROR, msg); |
| | | throw new ClientException(LDAPResultCode.OTHER, msg); |
| | | } catch (ConcurrentModificationException e) { |
| | | Message msg = ERR_DSCFG_ERROR_MODIFY_CME.get(ufn); |
| | | throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg); |
| | |
| | | // passwords. |
| | | Message message = ERR_PWPOLICY_ATTRIBUTE_OPTIONS_NOT_ALLOWED.get( |
| | | passwordAttribute.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | Attribute passwordAttr = attrList.get(0); |
| | |
| | | { |
| | | Message message = ERR_PWPOLICY_ATTRIBUTE_OPTIONS_NOT_ALLOWED.get( |
| | | passwordAttribute.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | LinkedHashSet<AttributeValue> values = passwordAttr.getValues(); |
| | |
| | | |
| | | Message message = ERR_PWPOLICY_MULTIPLE_PW_VALUES_NOT_ALLOWED.get( |
| | | passwordAttribute.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | CopyOnWriteArrayList<PasswordStorageScheme> defaultStorageSchemes = |
| | |
| | | |
| | | Message message = ERR_PWPOLICY_PREENCODED_NOT_ALLOWED.get( |
| | | passwordAttribute.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | | message); |
| | | } |
| | | } |
| | |
| | | |
| | | Message message = ERR_PWPOLICY_PREENCODED_NOT_ALLOWED.get( |
| | | passwordAttribute.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | | message); |
| | | } |
| | | } |
| | |
| | | Message message = ERR_PWPOLICY_VALIDATION_FAILED. |
| | | get(passwordAttribute.getNameOrOID(), |
| | | String.valueOf(invalidReason)); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | | message); |
| | | } |
| | | } |
| | |
| | | localOp.isSynchronizationOperation() || |
| | | m.isInternal())) |
| | | { |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | localOp.appendErrorMessage( |
| | | ERR_MODIFY_ATTR_IS_OBSOLETE.get(String.valueOf(entryDN), |
| | | a.getName())); |
| | |
| | | } |
| | | else |
| | | { |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | | localOp.appendErrorMessage(ERR_ADD_MISSING_RDN_ATTRIBUTE.get( |
| | | String.valueOf(entryDN), |
| | |
| | | } |
| | | else |
| | | { |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | | localOp.appendErrorMessage( |
| | | ERR_ADD_MISSING_RDN_ATTRIBUTE.get( |
| | |
| | | } |
| | | else |
| | | { |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | | localOp.appendErrorMessage( |
| | | ERR_ADD_MISSING_RDN_ATTRIBUTE.get( |
| | |
| | | } |
| | | else |
| | | { |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | | localOp.appendErrorMessage( |
| | | ERR_ADD_MISSING_RDN_ATTRIBUTE.get( |
| | |
| | | ERR_ADD_NO_SUCH_PWPOLICY.get(String.valueOf(entryDN), |
| | | String.valueOf(policyDN))); |
| | | |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | break addProcessing; |
| | | } |
| | | } |
| | |
| | | String.valueOf(entryDN), |
| | | at.getNameOrOID()); |
| | | localOp.appendErrorMessage(message); |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | break addProcessing; |
| | | } |
| | | } |
| | |
| | | String.valueOf(entryDN), |
| | | at.getNameOrOID()); |
| | | localOp.appendErrorMessage(message); |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | break addProcessing; |
| | | } |
| | | } |
| | |
| | | String.valueOf(entryDN), |
| | | oc.getNameOrOID()); |
| | | localOp.appendErrorMessage(message); |
| | | localOp.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | break addProcessing; |
| | | } |
| | | } |
| | |
| | | AttributeType at = newRDN.getAttributeType(i); |
| | | if (at.isObsolete()) |
| | | { |
| | | op.setResultCode(ResultCode.CONSTRAINT_VIOLATION); |
| | | op.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | op.appendErrorMessage(ERR_MODDN_NEWRDN_ATTR_IS_OBSOLETE.get( |
| | | String.valueOf(entryDN), |
| | | at.getNameOrOID())); |