mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
19.56.2014 d94f6d23898f7515e969517f85b8e626667a1e02
Checkpoint commit for OPENDJ-1536: Rename ErrorResultException to LdapException and remove ErrorResultIOException
1 files deleted
1 files renamed
180 files modified
3254 ■■■■ changed files
opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java 33 ●●●● patch | view | raw | blame | history
opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl 31 ●●●● patch | view | raw | blame | history
opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl 20 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java 15 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/ConfigurationClient.java 7 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/GenericConstraint.java 7 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ClientConstraintHandler.java 15 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java 55 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagementContext.java 43 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java 39 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPManagedObject.java 14 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java 45 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java 43 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java 5 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/Condition.java 7 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/Conditions.java 7 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ContainsCondition.java 7 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/IsPresentCondition.java 5 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/NOTCondition.java 5 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ORCondition.java 5 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java 6 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/CreateSubCommandHandler.java 12 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DeleteSubCommandHandler.java 6 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/GetPropSubCommandHandler.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/ListSubCommandHandler.java 10 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java 10 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SetPropSubCommandHandler.java 8 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandler.java 24 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java 5 ●●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java 27 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java 17 ●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/LDAPClientTest.java 52 ●●●●● patch | view | raw | blame | history
opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/MockConstraint.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/clirr-ignored-api-changes.xml 30 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java 25 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java 64 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java 55 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java 35 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java 18 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java 27 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java 74 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/Connection.java 113 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java 5 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java 12 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java 32 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java 64 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/FutureResult.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/FutureResultImpl.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/FutureResultWrapper.java 51 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java 47 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java 20 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java 39 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java 12 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java 5 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java 3 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java 5 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java 7 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java 12 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java 14 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java 18 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java 14 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java 41 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java 5 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java 23 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java 27 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/AbstractLDAPFutureResultImpl.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java 18 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java 50 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java 46 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java 15 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java 42 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithmTestCase.java 20 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java 29 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java 28 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java 44 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java 16 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java 6 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java 8 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java 10 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java 30 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java 23 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java 8 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java 33 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java 22 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java 6 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java 22 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java 14 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java 26 ●●●● patch | view | raw | blame | history
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java 7 ●●●●● patch | view | raw | blame | history
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java 35 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Controls.java 104 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ExtendedOperations.java 19 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetADChangeNotifications.java 10 ●●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ParseAttributes.java 10 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/PasswordResetForAD.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java 7 ●●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ProxyBackend.java 42 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/RewriterProxy.java 7 ●●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java 11 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java 20 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java 9 ●●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLife.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java 8 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroup.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseGenericControl.java 10 ●●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AddRate.java 8 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java 18 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java 8 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java 14 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java 8 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java 8 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java 21 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java 6 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java 4 ●●●● patch | view | raw | blame | history
opendj-rest2ldap-servlet/src/main/java/org/forgerock/opendj/rest2ldap/servlet/Rest2LDAPAuthnFilter.java 26 ●●●● patch | view | raw | blame | history
opendj-rest2ldap-servlet/src/main/java/org/forgerock/opendj/rest2ldap/servlet/Rest2LDAPContextFactory.java 4 ●●●● patch | view | raw | blame | history
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Context.java 8 ●●●● patch | view | raw | blame | history
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPCollectionResourceProvider.java 30 ●●●● patch | view | raw | blame | history
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ReferenceAttributeMapper.java 19 ●●●● patch | view | raw | blame | history
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java 8 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/AbstractDataProvider.java 8 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/ArchivableDataProvider.java 4 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/DataProvider.java 28 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/DataProviderConnection.java 28 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/ExportableDataProvider.java 4 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/ImportableDataProvider.java 4 ●●●● patch | view | raw | blame | history
opendj-server2x-adapter/src/main/java/org/forgerock/opendj/adapter/server2x/Adapters.java 34 ●●●● patch | view | raw | blame | history
opendj-server2x-adapter/src/main/java/org/forgerock/opendj/adapter/server2x/Converters.java 18 ●●●● patch | view | raw | blame | history
opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java 129 ●●●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Adapters.java 33 ●●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java 16 ●●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java 129 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package com.forgerock.opendj.cli;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.AbstractConnectionWrapper;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -61,8 +61,7 @@
 * {@code rebind} method.
 * <p>
 * If the Bind request fails for some reason (e.g. invalid credentials), then
 * the connection attempt will fail and an {@code ErrorResultException} will be
 * thrown.
 * the connection attempt will fail and an {@link LdapException} will be thrown.
 */
public final class AuthenticatedConnectionFactory implements ConnectionFactory {
@@ -88,13 +87,13 @@
         */
        /** {@inheritDoc} */
        @Override
        public BindResult bind(BindRequest request) throws ErrorResultException {
        public BindResult bind(BindRequest request) throws LdapException {
            throw new UnsupportedOperationException();
        }
        /** {@inheritDoc} */
        @Override
        public BindResult bind(String name, char[] password) throws ErrorResultException {
        public BindResult bind(String name, char[] password) throws LdapException {
            throw new UnsupportedOperationException();
        }
@@ -140,9 +139,9 @@
                            // Save the result.
                            AuthenticatedConnection.this.result = result;
                        }
                    }).onFailure(new FailureHandler<ErrorResultException>() {
                    }).onFailure(new FailureHandler<LdapException>() {
                        @Override
                        public void handleError(final ErrorResultException error) {
                        public void handleError(final LdapException error) {
                            /*
                             * This connection is now unauthenticated so prevent further use.
                             */
@@ -199,7 +198,7 @@
    /** {@inheritDoc} */
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        final Connection connection = parentFactory.getConnection();
        BindResult bindResult = null;
        try {
@@ -219,29 +218,29 @@
    /** {@inheritDoc} */
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        return parentFactory.getConnectionAsync()
            .thenAsync(
                    new AsyncFunction<Connection, BindResult, ErrorResultException>() {
                    new AsyncFunction<Connection, BindResult, LdapException>() {
                        @Override
                        public Promise<BindResult, ErrorResultException> apply(final Connection connection)
                                throws ErrorResultException {
                        public Promise<BindResult, LdapException> apply(final Connection connection)
                                throws LdapException {
                            connectionHolder.set(connection);
                            return connection.bindAsync(request);
                        }
                    }
            ).then(
                    new Function<BindResult, Connection, ErrorResultException>() {
                    new Function<BindResult, Connection, LdapException>() {
                        @Override
                        public Connection apply(BindResult result) throws ErrorResultException {
                        public Connection apply(BindResult result) throws LdapException {
                            // FIXME: should make the result unmodifiable.
                            return new AuthenticatedConnection(connectionHolder.get(), request, result);
                        }
                    },
                    new Function<ErrorResultException, Connection, ErrorResultException>() {
                    new Function<LdapException, Connection, LdapException>() {
                        @Override
                        public Connection apply(ErrorResultException errorResult) throws ErrorResultException {
                        public Connection apply(LdapException errorResult) throws LdapException {
                            closeSilently(connectionHolder.get());
                            throw errorResult;
                        }
opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl
@@ -22,6 +22,7 @@
  !
  !
  !      Copyright 2008-2009 Sun Microsystems, Inc.
  !      Portions Copyright 2014 ForgeRock AS
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://opendj.forgerock.org/admin"
  xmlns:admpp="http://opendj.forgerock.org/admin-preprocessor"
@@ -111,14 +112,14 @@
                       '          If the ', $ufn, ' could not be found on the server.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                       '      throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                       '      ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                       '      ErrorResultException;&#xa;')" />
                       '      LdapException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:call-template name="add-java-comment2">
@@ -129,13 +130,13 @@
                       '@return Returns &lt;true&gt; if the ', $ufn,' exists.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  boolean has',
                       $java-relation-name, '() throws ConcurrentModificationException,&#xa;',
                       '      ErrorResultException;&#xa;')" />
                       '      LdapException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -154,14 +155,14 @@
                       '          If the ', $ufn, ' is not present.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                       '      throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                       '      ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                       '      ErrorResultException;&#xa;')" />
                       '      LdapException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -204,13 +205,13 @@
                       '          If the server refuses to remove the ', $ufn, ' due to some server-side constraint which cannot be satisfied (for example, if it is referenced by another managed object).&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  void remove', $java-relation-name, '()&#xa;',
                         '      throws ManagedObjectNotFoundException, OperationRejectedException,&#xa;',
                         '      ConcurrentModificationException, ErrorResultException;&#xa;')" />
                         '      ConcurrentModificationException, LdapException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:variable name="plural-name"
@@ -233,13 +234,13 @@
                       '@return Returns an array containing the names of the ', $ufpn,'.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  String[] list',
                       $java-relation-plural-name, '() throws ConcurrentModificationException,&#xa;',
                       '      ErrorResultException;&#xa;')" />
                       '      LdapException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -260,14 +261,14 @@
                       '          If the named ', $ufn, ' was not found on the server.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)&#xa;',
                       '      throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                       '      ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                       '      ErrorResultException;&#xa;')" />
                       '      LdapException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -346,13 +347,13 @@
                       '          If the server refuses to remove the ', $ufn, ' due to some server-side constraint which cannot be satisfied (for example, if it is referenced by another managed object).&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws ErrorResultException&#xa;',
                       '@throws LdapException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  void remove', $java-relation-name, '(String name)&#xa;',
                         '      throws ManagedObjectNotFoundException, OperationRejectedException,&#xa;',
                         '      ConcurrentModificationException, ErrorResultException;&#xa;')" />
                         '      ConcurrentModificationException, LdapException;&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
@@ -408,7 +409,7 @@
            org.forgerock.opendj.config.client.ConcurrentModificationException
          </import>
          <import>
            org.forgerock.opendj.ldap.ErrorResultException
            org.forgerock.opendj.ldap.LdapException
          </import>
        </xsl:if>
        <xsl:for-each
opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl
@@ -22,7 +22,7 @@
  !
  !
  !      Copyright 2007-2010 Sun Microsystems, Inc.
  !      Portions copyright 2011 ForgeRock AS.
  !      Portions copyright 2011-2014 ForgeRock AS.
  ! -->
<xsl:stylesheet version="1.0" xmlns:adm="http://opendj.forgerock.org/admin"
  xmlns:admpp="http://opendj.forgerock.org/admin-preprocessor"
@@ -465,7 +465,7 @@
                     '     */&#xa;',
                     '    public void commit() throws ManagedObjectAlreadyExistsException,&#xa;',
                     '        MissingMandatoryPropertiesException, ConcurrentModificationException,&#xa;',
                     '        OperationRejectedException, ErrorResultException {&#xa;',
                     '        OperationRejectedException, LdapException {&#xa;',
                     '      impl.commit();&#xa;',
                     '    }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
@@ -1191,7 +1191,7 @@
                         '    public ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                         '        throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                         '        ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        ErrorResultException {&#xa;',
                         '        LdapException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
@@ -1201,7 +1201,7 @@
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public boolean has', $java-relation-name, '() throws ConcurrentModificationException,&#xa;',
                         '        ErrorResultException {&#xa;',
                         '        LdapException {&#xa;',
                         '      return impl.hasChild(INSTANCE.get', $java-relation-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1214,7 +1214,7 @@
                         '    public ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                         '        throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                         '        ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        ErrorResultException {&#xa;',
                         '        LdapException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1237,7 +1237,7 @@
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, '()&#xa;',
                         '        throws ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        OperationRejectedException, ErrorResultException {&#xa;',
                         '        OperationRejectedException, LdapException {&#xa;',
                         '      impl.removeChild(INSTANCE.get', $java-relation-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
@@ -1254,7 +1254,7 @@
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public String[] list', $java-relation-plural-name, '() throws ConcurrentModificationException,&#xa;',
                         '        ErrorResultException {&#xa;',
                         '        LdapException {&#xa;',
                         '      return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1267,7 +1267,7 @@
                         '    public ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)&#xa;',
                         '        throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                         '        ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        ErrorResultException {&#xa;',
                         '        LdapException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1305,7 +1305,7 @@
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, '(String name)&#xa;',
                         '        throws ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        OperationRejectedException, ErrorResultException {&#xa;',
                         '        OperationRejectedException, LdapException {&#xa;',
                         '      impl.removeChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name);&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
@@ -1923,7 +1923,7 @@
              org.forgerock.opendj.config.ManagedObjectAlreadyExistsException
            </import>
            <import>
              org.forgerock.opendj.ldap.ErrorResultException
              org.forgerock.opendj.ldap.LdapException
            </import>
            <import>
              org.forgerock.opendj.config.client.ConcurrentModificationException
opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config;
@@ -61,7 +62,7 @@
import org.forgerock.opendj.config.server.ServerManagedObjectChangeListener;
import org.forgerock.opendj.config.server.ServerManagementContext;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
/**
@@ -495,7 +496,7 @@
         */
        @Override
        public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            // If all of this managed object's "enabled" properties are true
            // then any referenced managed objects must also be enabled.
            boolean needsEnabling = targetNeedsEnablingCondition.evaluate(context, managedObject);
@@ -547,7 +548,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            // The same constraint applies as for adds.
            return isAddAcceptable(context, managedObject, unacceptableReasons);
        }
@@ -566,7 +567,7 @@
         */
        @Override
        public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            // Any references to the deleted managed object should cause a
            // constraint violation.
            boolean isAcceptable = true;
@@ -593,7 +594,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            // If the modified managed object is disabled and there are some
            // active references then refuse the change.
            if (targetIsEnabledCondition.evaluate(context, managedObject)) {
@@ -630,7 +631,7 @@
        // object using this property.
        private <C1 extends ConfigurationClient> List<ManagedObject<? extends C1>> findReferences(
            ManagementContext context, AbstractManagedObjectDefinition<C1, ?> mod, String name)
                throws ErrorResultException {
                throws LdapException {
            List<ManagedObject<? extends C1>> instances = findInstances(context, mod);
            Iterator<ManagedObject<? extends C1>> i = instances.iterator();
@@ -656,7 +657,7 @@
        // Find all instances of a specific type of managed object.
        @SuppressWarnings("unchecked")
        private <C1 extends ConfigurationClient> List<ManagedObject<? extends C1>> findInstances(
            ManagementContext context, AbstractManagedObjectDefinition<C1, ?> mod) throws ErrorResultException {
            ManagementContext context, AbstractManagedObjectDefinition<C1, ?> mod) throws LdapException {
            List<ManagedObject<? extends C1>> instances = new LinkedList<ManagedObject<? extends C1>>();
            if (mod == RootCfgDefn.getInstance()) {
opendj-config/src/main/java/org/forgerock/opendj/config/ConfigurationClient.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config;
@@ -29,7 +30,7 @@
import org.forgerock.opendj.config.client.ConcurrentModificationException;
import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException;
import org.forgerock.opendj.config.client.OperationRejectedException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * A common base interface for all managed object configuration clients.
@@ -69,10 +70,10 @@
     * @throws OperationRejectedException
     *             If the server refuses to add or modify this configuration due
     *             to some server-side constraint which cannot be satisfied.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
        ConcurrentModificationException, OperationRejectedException, ErrorResultException;
        ConcurrentModificationException, OperationRejectedException, LdapException;
}
opendj-config/src/main/java/org/forgerock/opendj/config/GenericConstraint.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config;
@@ -37,7 +38,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerConstraintHandler;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * A generic constraint which comprises of an underlying condition and a
@@ -61,7 +62,7 @@
         */
        @Override
        public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            if (!condition.evaluate(context, managedObject)) {
                unacceptableReasons.add(getSynopsis());
                return false;
@@ -75,7 +76,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            if (!condition.evaluate(context, managedObject)) {
                unacceptableReasons.add(getSynopsis());
                return false;
opendj-config/src/main/java/org/forgerock/opendj/config/client/ClientConstraintHandler.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.client;
@@ -29,7 +30,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.ManagedObjectPath;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * An interface for performing client-side constraint validation.
@@ -70,11 +71,11 @@
     *            A list of messages to which error messages should be added.
     * @return Returns <code>true</code> if this constraint is satisfied, or
     *         <code>false</code> if it is not.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurs.
     */
    public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
        Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
        Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
        return true;
    }
@@ -97,11 +98,11 @@
     *            A list of messages to which error messages should be added.
     * @return Returns <code>true</code> if this modify is satisfied, or
     *         <code>false</code> if it is not.
      * @throws ErrorResultException
      * @throws LdapException
     *             If an error occurs.
     */
    public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
        Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
        Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
        return true;
    }
@@ -123,11 +124,11 @@
     *            A list of messages to which error messages should be added.
     * @return Returns <code>true</code> if this constraint is satisfied, or
     *         <code>false</code> if it is not.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurs.
     */
    public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
        Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
        Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
        return true;
    }
}
opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2007-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.client;
@@ -44,7 +45,7 @@
import org.forgerock.opendj.config.PropertyProvider;
import org.forgerock.opendj.config.SetRelationDefinition;
import org.forgerock.opendj.config.SingletonRelationDefinition;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * A generic interface for accessing client-side managed objects.
@@ -107,11 +108,11 @@
     *             If this managed object cannot be added or modified due to
     *             some client-side or server-side constraint which cannot be
     *             satisfied.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
            ConcurrentModificationException, OperationRejectedException, ErrorResultException;
            ConcurrentModificationException, OperationRejectedException, LdapException;
    /**
     * Determines whether or not this managed object has been modified since it
@@ -258,13 +259,13 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            InstantiableRelationDefinition<C, S> r, String name) throws
            DefinitionDecodingException, ManagedObjectDecodingException, ManagedObjectNotFoundException,
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
    /**
     * Retrieves an optional child managed object.
@@ -293,13 +294,13 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            OptionalRelationDefinition<C, S> r) throws DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            ErrorResultException;
            LdapException;
    /**
     * Retrieves a singleton child managed object.
@@ -328,13 +329,13 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            SingletonRelationDefinition<C, S> r) throws DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            ErrorResultException;
            LdapException;
    /**
     * Retrieves a set child managed object.
@@ -365,13 +366,13 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            SetRelationDefinition<C, S> r, String name) throws DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            ErrorResultException;
            LdapException;
    /**
     * Creates a client configuration view of this managed object. Modifications
@@ -482,11 +483,11 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If there is any other error.
     */
    <C extends ConfigurationClient, S extends Configuration> boolean hasChild(OptionalRelationDefinition<C, S> r)
            throws ConcurrentModificationException, ErrorResultException;
            throws ConcurrentModificationException, LdapException;
    /**
     * Lists the child managed objects associated with the specified
@@ -507,12 +508,12 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            InstantiableRelationDefinition<C, S> r) throws ConcurrentModificationException,
            ErrorResultException;
            LdapException;
    /**
     * Lists the child managed objects associated with the specified
@@ -534,12 +535,12 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
            throws ConcurrentModificationException, ErrorResultException;
            throws ConcurrentModificationException, LdapException;
    /**
     * Lists the child managed objects associated with the specified set
@@ -558,11 +559,11 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(SetRelationDefinition<C, S> r)
            throws ConcurrentModificationException, ErrorResultException;
            throws ConcurrentModificationException, LdapException;
    /**
     * Lists the child managed objects associated with the specified set
@@ -586,12 +587,12 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(SetRelationDefinition<C, S> r,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
    /**
     * Removes the named instantiable child managed object.
@@ -620,12 +621,12 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> void removeChild(InstantiableRelationDefinition<C, S> r,
            String name) throws ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
    /**
     * Removes an optional child managed object.
@@ -649,12 +650,12 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> void removeChild(OptionalRelationDefinition<C, S> r)
            throws ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
    /**
     * Removes s set child managed object.
@@ -680,12 +681,12 @@
     * @throws ConcurrentModificationException
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    <C extends ConfigurationClient, S extends Configuration> void removeChild(SetRelationDefinition<C, S> r,
        String name) throws ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
    /**
     * Sets a new pending value for the specified property.
opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagementContext.java
@@ -43,7 +43,7 @@
import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.SetRelationDefinition;
import org.forgerock.opendj.config.client.spi.Driver;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * Client management connection context.
@@ -85,13 +85,13 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
            throws ManagedObjectNotFoundException, OperationRejectedException,
            ErrorResultException {
            LdapException {
        return getDriver().deleteManagedObject(parent, rd, name);
    }
@@ -121,12 +121,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws
            ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
            ManagedObjectNotFoundException, OperationRejectedException, LdapException {
        return getDriver().deleteManagedObject(parent, rd);
    }
@@ -157,13 +157,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
            throws ManagedObjectNotFoundException, OperationRejectedException,
            ErrorResultException {
            throws ManagedObjectNotFoundException, OperationRejectedException, LdapException {
        return getDriver().deleteManagedObject(parent, rd, name);
    }
@@ -188,13 +187,13 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    @SuppressWarnings("unchecked")
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
            ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
            ManagedObjectNotFoundException, ErrorResultException {
            ManagedObjectNotFoundException, LdapException {
        // Be careful to handle the root configuration.
        if (path.isEmpty()) {
            return (ManagedObject<C>) getRootConfigurationManagedObject();
@@ -226,11 +225,11 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <P> P getPropertyValue(ManagedObjectPath<?, ?> path, PropertyDefinition<P> pd)
            throws DefinitionDecodingException, ErrorResultException, ManagedObjectNotFoundException {
            throws DefinitionDecodingException, LdapException, ManagedObjectNotFoundException {
        Set<P> values = getPropertyValues(path, pd);
        if (values.isEmpty()) {
            return null;
@@ -262,11 +261,11 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <P> SortedSet<P> getPropertyValues(ManagedObjectPath<?, ?> path, PropertyDefinition<P> pd)
            throws DefinitionDecodingException, ErrorResultException, ManagedObjectNotFoundException {
            throws DefinitionDecodingException, LdapException, ManagedObjectNotFoundException {
        return getDriver().getPropertyValues(path, pd);
    }
@@ -311,12 +310,12 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd) throws
            ManagedObjectNotFoundException, ErrorResultException {
            ManagedObjectNotFoundException, LdapException {
        return listManagedObjects(parent, rd, rd.getChildDefinition());
    }
@@ -343,13 +342,13 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws
            ManagedObjectNotFoundException, ErrorResultException {
            ManagedObjectNotFoundException, LdapException {
        return getDriver().listManagedObjects(parent, rd, d);
    }
@@ -372,12 +371,12 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd) throws
            ManagedObjectNotFoundException, ErrorResultException {
            ManagedObjectNotFoundException, LdapException {
        return getDriver().listManagedObjects(parent, rd, rd.getChildDefinition());
    }
@@ -390,11 +389,11 @@
     *         <code>false</code> otherwise.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
            ErrorResultException {
            LdapException {
        return getDriver().managedObjectExists(path);
    }
opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2014 ForgeRock, AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.config.client.ldap;
@@ -69,8 +69,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchResultReferenceIOException;
@@ -177,7 +176,7 @@
    @Override
    public <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
        ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
        ManagedObjectNotFoundException, ErrorResultException {
        ManagedObjectNotFoundException, LdapException {
        if (!managedObjectExists(path)) {
            throw new ManagedObjectNotFoundException();
        }
@@ -217,7 +216,7 @@
            } else {
                throw new ManagedObjectDecodingException(mo, exceptions);
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
                throw new ManagedObjectNotFoundException();
            }
@@ -232,7 +231,7 @@
    @Override
    public <C extends ConfigurationClient, S extends Configuration, P> SortedSet<P> getPropertyValues(
        ManagedObjectPath<C, S> path, PropertyDefinition<P> propertyDef) throws DefinitionDecodingException,
        ManagedObjectNotFoundException, ErrorResultException {
        ManagedObjectNotFoundException, LdapException {
        // Check that the requested property is from the definition
        // associated with the path.
        AbstractManagedObjectDefinition<C, S> d = path.getManagedObjectDefinition();
@@ -284,7 +283,7 @@
            }
            return values;
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
                throw new ManagedObjectNotFoundException();
            }
@@ -308,7 +307,7 @@
    public <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
        ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
        AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
        ErrorResultException {
        LdapException {
        validateRelationDefinition(parent, rd);
        if (!managedObjectExists(parent)) {
@@ -326,7 +325,7 @@
            for (DN child : listEntries(dn, filter)) {
                children.add(child.rdn().getFirstAVA().getAttributeValue().toString());
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
                // Ignore this
                // It means that the base entry does not exist
@@ -345,7 +344,7 @@
    public <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
        ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
        AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
        ErrorResultException {
        LdapException {
        validateRelationDefinition(parent, rd);
        if (!managedObjectExists(parent)) {
@@ -363,7 +362,7 @@
            for (DN child : listEntries(dn, filter)) {
                children.add(child.rdn().getFirstAVA().getAttributeValue().toString());
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
                // Ignore this
                // It means that the base entry does not exist
@@ -381,7 +380,7 @@
     */
    @Override
    public boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
        ErrorResultException {
        LdapException {
        if (path.isEmpty()) {
            return true;
        }
@@ -401,12 +400,12 @@
     */
    @Override
    protected <C extends ConfigurationClient, S extends Configuration> void deleteManagedObject(
        ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException {
        ManagedObjectPath<C, S> path) throws OperationRejectedException, LdapException {
        // Delete the entry and any subordinate entries.
        DN dn = DNBuilder.create(path, profile);
        try {
            deleteSubtree(dn);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                AbstractManagedObjectDefinition<?, ?> d = path.getManagedObjectDefinition();
                LocalizableMessage m = LocalizableMessage.raw("%s", e.getMessage());
@@ -430,10 +429,10 @@
     * @param dn
     *            The LDAP entry name.
     * @return Returns <code>true</code> if the named LDAP entry exists.
     * @throws ErrorResultException
     * @throws LdapException
     *             if a problem occurs.
     */
    boolean entryExists(DN dn) throws ErrorResultException {
    boolean entryExists(DN dn) throws LdapException {
        try {
            connection.readEntry(dn, "1.1");
            return true;
@@ -524,7 +523,7 @@
    // entry.
    // @Checkstyle:off
    private <C extends ConfigurationClient, S extends Configuration> ManagedObjectDefinition<? extends C, ? extends S>
        getEntryDefinition(AbstractManagedObjectDefinition<C, S> d, DN dn) throws ErrorResultException,
        getEntryDefinition(AbstractManagedObjectDefinition<C, S> d, DN dn) throws LdapException,
        DefinitionDecodingException {
        // @Checkstyle:on
        SearchResultEntry searchResultEntry = connection.readEntry(dn, "objectclass");
@@ -561,7 +560,7 @@
     * Delete a subtree of entries. We cannot use the subtree delete control because it is not supported by the config
     * backend.
     */
    private void deleteSubtree(DN dn) throws ErrorResultException {
    private void deleteSubtree(DN dn) throws LdapException {
        // Delete the children first.
        for (DN child : listEntries(dn, Filter.objectClassPresent())) {
            deleteSubtree(child);
@@ -571,7 +570,7 @@
        connection.delete(dn.toString());
    }
    private Collection<DN> listEntries(DN dn, Filter filter) throws ErrorResultException {
    private Collection<DN> listEntries(DN dn, Filter filter) throws LdapException {
        List<DN> names = new LinkedList<DN>();
        ConnectionEntryReader reader =
                connection.search(dn.toString(), SearchScope.SINGLE_LEVEL, filter.toString());
@@ -579,8 +578,6 @@
            while (reader.hasNext()) {
                names.add(reader.readEntry().getName());
            }
        } catch (ErrorResultIOException e) {
            throw e.getCause();
        } catch (SearchResultReferenceIOException e) {
            // Ignore.
        } finally {
opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPManagedObject.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2007-2009 Sun Microsystems, Inc.
 *      Portions copyright 2014 ForgeRock AS.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.client.ldap;
@@ -56,7 +56,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LinkedAttribute;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.ModificationType;
@@ -135,7 +135,7 @@
     * {@inheritDoc}
     */
    @Override
    protected void addNewManagedObject() throws ErrorResultException, OperationRejectedException,
    protected void addNewManagedObject() throws LdapException, OperationRejectedException,
            ConcurrentModificationException, ManagedObjectAlreadyExistsException {
        // First make sure that the parent managed object still exists.
        ManagedObjectDefinition<?, ?> d = getManagedObjectDefinition();
@@ -180,7 +180,7 @@
                // Create the entry.
                try {
                    driver.getLDAPConnection().add(entry);
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                        LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage());
                        throw new OperationRejectedException(OperationType.CREATE, d.getUserFriendlyName(), m);
@@ -219,7 +219,7 @@
        try {
            // Create the entry.
            driver.getLDAPConnection().add(entry);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            if (e.getResult().getResultCode() == ResultCode.ENTRY_ALREADY_EXISTS) {
                throw new ManagedObjectAlreadyExistsException();
            } else if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
@@ -252,7 +252,7 @@
     */
    @Override
    protected void modifyExistingManagedObject() throws ConcurrentModificationException, OperationRejectedException,
            ErrorResultException {
            LdapException {
        // Build the modify request
        ManagedObjectPath<?, ?> path = getManagedObjectPath();
        DN dn = DNBuilder.create(path, driver.getLDAPProfile());
@@ -273,7 +273,7 @@
        if (!request.getModifications().isEmpty()) {
            try {
                driver.getLDAPConnection().modify(request);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                    LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage());
                    throw new OperationRejectedException(OperationType.MODIFY, d.getUserFriendlyName(), m);
opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.client.spi;
@@ -63,7 +64,7 @@
import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException;
import org.forgerock.opendj.config.client.OperationRejectedException;
import org.forgerock.opendj.config.client.OperationRejectedException.OperationType;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * An abstract managed object implementation.
@@ -89,7 +90,7 @@
        private OperationRejectedException ore = null;
        private ErrorResultException ere = null;
        private LdapException ere = null;
        /**
         * {@inheritDoc}
@@ -170,7 +171,7 @@
                cme = e;
            } catch (OperationRejectedException e) {
                ore = e;
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                ere = e;
            }
        }
@@ -182,7 +183,7 @@
         * @param rd
         *            The relation definition.
         */
        private void createDefaultManagedObjects(RelationDefinition<?, ?> rd) throws ErrorResultException,
        private void createDefaultManagedObjects(RelationDefinition<?, ?> rd) throws LdapException,
            ConcurrentModificationException, MissingMandatoryPropertiesException,
            ManagedObjectAlreadyExistsException, OperationRejectedException {
            rd.accept(this, null);
@@ -256,7 +257,7 @@
     */
    @Override
    public final void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
        ConcurrentModificationException, OperationRejectedException, ErrorResultException {
        ConcurrentModificationException, OperationRejectedException, LdapException {
        // First make sure all mandatory properties are defined.
        List<PropertyException> exceptions = new LinkedList<PropertyException>();
@@ -385,7 +386,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
        InstantiableRelationDefinition<C, S> r, String name) throws DefinitionDecodingException,
        ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
        ErrorResultException {
        LdapException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -398,7 +399,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
        OptionalRelationDefinition<C, S> r) throws DefinitionDecodingException, ManagedObjectDecodingException,
        ManagedObjectNotFoundException, ConcurrentModificationException, ErrorResultException {
        ManagedObjectNotFoundException, ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -411,7 +412,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
        SingletonRelationDefinition<C, S> r) throws DefinitionDecodingException, ManagedObjectDecodingException,
        ManagedObjectNotFoundException, ConcurrentModificationException, ErrorResultException {
        ManagedObjectNotFoundException, ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -425,7 +426,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
        SetRelationDefinition<C, S> r, String name) throws DefinitionDecodingException,
        ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
        ErrorResultException {
        LdapException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -502,7 +503,7 @@
     */
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> boolean hasChild(
        OptionalRelationDefinition<C, S> r) throws ConcurrentModificationException, ErrorResultException {
        OptionalRelationDefinition<C, S> r) throws ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        try {
@@ -525,7 +526,7 @@
     */
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
        InstantiableRelationDefinition<C, S> r) throws ConcurrentModificationException, ErrorResultException {
        InstantiableRelationDefinition<C, S> r) throws ConcurrentModificationException, LdapException {
        return listChildren(r, r.getChildDefinition());
    }
@@ -535,7 +536,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
        InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
            throws ConcurrentModificationException, ErrorResultException {
            throws ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        try {
@@ -550,7 +551,7 @@
     */
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
        SetRelationDefinition<C, S> r) throws ConcurrentModificationException, ErrorResultException {
        SetRelationDefinition<C, S> r) throws ConcurrentModificationException, LdapException {
        return listChildren(r, r.getChildDefinition());
    }
@@ -560,7 +561,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
        SetRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
            throws ConcurrentModificationException, ErrorResultException {
            throws ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        try {
@@ -576,7 +577,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
        InstantiableRelationDefinition<C, S> r, String name) throws ManagedObjectNotFoundException,
        OperationRejectedException, ConcurrentModificationException, ErrorResultException {
        OperationRejectedException, ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        boolean found;
@@ -598,7 +599,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
        OptionalRelationDefinition<C, S> r) throws ManagedObjectNotFoundException, OperationRejectedException,
        ConcurrentModificationException, ErrorResultException {
        ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        boolean found;
@@ -620,7 +621,7 @@
    @Override
    public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
        SetRelationDefinition<C, S> r, String name) throws ManagedObjectNotFoundException,
        OperationRejectedException, ConcurrentModificationException, ErrorResultException {
        OperationRejectedException, ConcurrentModificationException, LdapException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        boolean found;
@@ -706,10 +707,10 @@
     * @throws OperationRejectedException
     *             If the managed object cannot be added due to some client-side
     *             or server-side constraint which cannot be satisfied.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    protected abstract void addNewManagedObject() throws ErrorResultException, OperationRejectedException,
    protected abstract void addNewManagedObject() throws LdapException, OperationRejectedException,
        ConcurrentModificationException, ManagedObjectAlreadyExistsException;
    /**
@@ -757,11 +758,11 @@
     * @throws OperationRejectedException
     *             If the managed object cannot be added due to some client-side
     *             or server-side constraint which cannot be satisfied.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    protected abstract void modifyExistingManagedObject() throws ConcurrentModificationException,
        OperationRejectedException, ErrorResultException;
        OperationRejectedException, LdapException;
    /**
     * Creates a new managed object.
@@ -827,7 +828,7 @@
    }
    // Makes sure that this managed object exists.
    private void ensureThisManagedObjectExists() throws ConcurrentModificationException, ErrorResultException {
    private void ensureThisManagedObjectExists() throws ConcurrentModificationException, LdapException {
        if (!path.isEmpty()) {
            Driver ctx = getDriver();
opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.client.spi;
@@ -65,7 +66,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.client.OperationRejectedException;
import org.forgerock.opendj.config.client.OperationRejectedException.OperationType;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * An abstract management connection context driver which should form the basis
@@ -244,7 +245,7 @@
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (PropertyNotFoundException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
            } catch (ManagedObjectNotFoundException e) {
                throw PropertyException.defaultBehaviorException(pd1, e);
@@ -294,12 +295,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
        ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
            throws ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
            throws ManagedObjectNotFoundException, OperationRejectedException, LdapException {
        validateRelationDefinition(parent, rd);
        ManagedObjectPath<?, ?> child = parent.child(rd, name);
        return doDeleteManagedObject(child);
@@ -331,12 +332,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
        ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws ManagedObjectNotFoundException,
        OperationRejectedException, ErrorResultException {
        OperationRejectedException, LdapException {
        validateRelationDefinition(parent, rd);
        ManagedObjectPath<?, ?> child = parent.child(rd);
        return doDeleteManagedObject(child);
@@ -370,12 +371,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
        ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
            throws ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
            throws ManagedObjectNotFoundException, OperationRejectedException, LdapException {
        validateRelationDefinition(parent, rd);
        ManagedObjectPath<?, ?> child = parent.child(rd, name);
        return doDeleteManagedObject(child);
@@ -403,13 +404,13 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    // @Checkstyle:ignore
    public abstract <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
        ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
        ManagedObjectNotFoundException, ErrorResultException;
        ManagedObjectNotFoundException, LdapException;
    /**
     * Gets the effective values of a property in the named managed object.
@@ -448,12 +449,12 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration, P> SortedSet<P> getPropertyValues(
        ManagedObjectPath<C, S> path, PropertyDefinition<P> pd) throws DefinitionDecodingException,
        ManagedObjectNotFoundException, ErrorResultException;
        ManagedObjectNotFoundException, LdapException;
    /**
     * Gets the root configuration managed object associated with this
@@ -487,13 +488,13 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
        ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
        AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
        ErrorResultException;
        LdapException;
    /**
     * Lists the child managed objects of the named parent managed object which
@@ -518,13 +519,13 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
        ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
        AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws ManagedObjectNotFoundException,
        ErrorResultException;
        LdapException;
    /**
     * Determines whether or not the named managed object exists.
@@ -538,11 +539,11 @@
     *         <code>false</code> otherwise.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    public abstract boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
        ErrorResultException;
        LdapException;
    /**
     * Deletes the named managed object.
@@ -562,11 +563,11 @@
     *             If the managed object cannot be removed due to some
     *             server-side constraint which cannot be satisfied (for
     *             example, if it is referenced by another managed object).
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    protected abstract <C extends ConfigurationClient, S extends Configuration> void deleteManagedObject(
        ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException;
        ManagedObjectPath<C, S> path) throws OperationRejectedException, LdapException;
    /**
     * Gets the default values for the specified property.
@@ -623,7 +624,7 @@
    // constraints are satisfied.
    private <C extends ConfigurationClient, S extends Configuration> boolean doDeleteManagedObject(
        ManagedObjectPath<C, S> path) throws ManagedObjectNotFoundException, OperationRejectedException,
        ErrorResultException {
        LdapException {
        // First make sure that the parent exists.
        if (!managedObjectExists(path.parent())) {
            throw new ManagedObjectNotFoundException();
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -33,7 +34,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
/**
@@ -59,7 +60,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
        for (Condition condition : conditions) {
            if (!condition.evaluate(context, managedObject)) {
                return false;
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/Condition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -30,7 +31,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * An interface for evaluating conditions.
@@ -56,10 +57,10 @@
     * @param managedObject
     *            The client managed object.
     * @return Returns <code>true</code> if this condition is satisfied.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the condition could not be evaluated.
     */
    boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException;
    boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException;
    /**
     * Evaluates this condition against the provided server managed object.
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/Conditions.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -30,7 +31,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * This class consists exclusively of static methods that operate on or return
@@ -46,7 +47,7 @@
        /**
         * {@inheritDoc}
         */
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
            return false;
        }
@@ -74,7 +75,7 @@
        /**
         * {@inheritDoc}
         */
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
            return true;
        }
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ContainsCondition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -33,7 +34,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
/**
@@ -65,7 +66,7 @@
        /**
         * {@inheritDoc}
         */
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
            SortedSet<T> values = managedObject.getPropertyValues(pd);
            return values.contains(value);
        }
@@ -118,7 +119,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
        return impl.evaluate(context, managedObject);
    }
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/IsPresentCondition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -33,7 +34,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
/**
@@ -62,7 +63,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
        SortedSet<?> values = managedObject.getPropertyValues(pd);
        return !values.isEmpty();
    }
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/NOTCondition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -30,7 +31,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
/**
@@ -57,7 +58,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
        return !condition.evaluate(context, managedObject);
    }
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ORCondition.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.conditions;
@@ -33,7 +34,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
/**
@@ -59,7 +60,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws LdapException {
        for (Condition condition : conditions) {
            if (condition.evaluate(context, managedObject)) {
                return true;
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions copyright 2013-2014 ForgeRock AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.config.dsconfig;
@@ -41,7 +41,7 @@
import org.forgerock.opendj.config.ConfigurationFramework;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
/**
@@ -87,7 +87,7 @@
        try {
            final SearchResultEntry entry = connection.readEntry("", "fullVendorVersion");
            return valueOf(entry.getAttribute("fullVendorVersion").firstValueAsString());
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            throw new ConfigException(ERR_CONFIGVERSION_NOT_FOUND.get());
        }
    }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/CreateSubCommandHandler.java
@@ -75,7 +75,7 @@
import org.forgerock.opendj.config.conditions.Condition;
import org.forgerock.opendj.config.conditions.ContainsCondition;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
@@ -614,7 +614,7 @@
        } catch (AuthorizationException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(ufn);
            throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage());
            throw new ClientException(ReturnCode.OTHER, msg);
        }
@@ -721,7 +721,7 @@
                } else {
                    throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, e.getMessageObject(), e);
                }
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                final LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage());
                if (app.isInteractive()) {
                    app.println();
@@ -781,7 +781,7 @@
                    } catch (ConcurrentModificationException e) {
                        LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(irelation.getUserFriendlyName());
                        throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
                    } catch (ErrorResultException e) {
                    } catch (LdapException e) {
                        LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(irelation.getUserFriendlyName(),
                                e.getMessage());
                        throw new ClientException(ReturnCode.APPLICATION_ERROR, msg);
@@ -1057,7 +1057,7 @@
            } else {
                throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
@@ -1092,7 +1092,7 @@
            } catch (ConcurrentModificationException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(ufn);
                throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage());
                throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
            }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DeleteSubCommandHandler.java
@@ -46,7 +46,7 @@
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.client.OperationRejectedException;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
@@ -233,7 +233,7 @@
            } else {
                return MenuResult.success(0);
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
@@ -347,7 +347,7 @@
        } catch (ConcurrentModificationException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_CME.get(ufn);
            throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_CE.get(ufn, e.getMessage());
            throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
        }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/GetPropSubCommandHandler.java
@@ -59,7 +59,7 @@
import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ReturnCode;
@@ -245,7 +245,7 @@
        } catch (ManagedObjectNotFoundException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(ufn);
            throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java
@@ -38,7 +38,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ClientException;
@@ -115,7 +115,7 @@
            try {
                connection = factory.getConnection();
                BuildVersion.checkVersionMismatch(connection);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                if (e.getCause() instanceof SSLException) {
                    throw new ClientException(ReturnCode.CLIENT_SIDE_CONNECT_ERROR,
                            ERR_FAILED_TO_CONNECT_NOT_TRUSTED.get(hostName, String.valueOf(port)));
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/ListSubCommandHandler.java
@@ -51,7 +51,7 @@
import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ClientException;
@@ -239,7 +239,7 @@
            } else {
                throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
@@ -277,7 +277,7 @@
            } catch (ConcurrentModificationException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
                throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
                throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
            }
@@ -307,7 +307,7 @@
            } catch (ConcurrentModificationException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
                throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
                throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
            }
@@ -340,7 +340,7 @@
            } catch (ConcurrentModificationException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
                throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
                throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
            } catch (ManagedObjectNotFoundException e) {
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java
@@ -66,7 +66,7 @@
import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
import com.forgerock.opendj.cli.ClientException;
@@ -125,7 +125,7 @@
                    LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
                    LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn);
                    throw new ClientException(ReturnCode.OTHER, msg, e);
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage());
                    throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
                } catch (ManagedObjectNotFoundException e) {
@@ -402,7 +402,7 @@
            } catch (ManagedObjectNotFoundException e) {
                this.e = new ClientException(ReturnCode.NO_SUCH_OBJECT, e.getMessageObject());
                return MenuResult.cancel();
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                this.e = new ClientException(ReturnCode.APPLICATION_ERROR, LocalizableMessage.raw(e.getMessage()));
                return MenuResult.quit();
            }
@@ -629,7 +629,7 @@
                } catch (ManagedObjectNotFoundException e) {
                    this.e = new ClientException(ReturnCode.NO_SUCH_OBJECT, e.getMessageObject());
                    return MenuResult.cancel();
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    this.e = new ClientException(ReturnCode.APPLICATION_ERROR, LocalizableMessage.raw(e.getMessage()));
                    return MenuResult.quit();
                }
@@ -1420,7 +1420,7 @@
            } catch (ManagedObjectNotFoundException e) {
                this.e = new ClientException(ReturnCode.NO_SUCH_OBJECT, e.getMessageObject());
                return MenuResult.cancel();
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                this.e = new ClientException(ReturnCode.APPLICATION_ERROR, LocalizableMessage.raw(e.getMessage()));
                return MenuResult.quit();
            }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SetPropSubCommandHandler.java
@@ -64,7 +64,7 @@
import org.forgerock.opendj.config.conditions.Condition;
import org.forgerock.opendj.config.conditions.ContainsCondition;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
@@ -336,7 +336,7 @@
                } else {
                    throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, e.getMessageObject(), e);
                }
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage());
                throw new ClientException(ReturnCode.OTHER, msg);
            } catch (ManagedObjectAlreadyExistsException e) {
@@ -513,7 +513,7 @@
        } catch (AuthorizationException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_AUTHZ.get(ufn);
            throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage());
            throw new ClientException(ReturnCode.OTHER, msg);
        }
@@ -661,7 +661,7 @@
            } else {
                throw except;
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            throw new ClientException(ReturnCode.OTHER, LocalizableMessage.raw(e.getLocalizedMessage()));
        }
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandler.java
@@ -70,7 +70,7 @@
import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.ldap.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
@@ -108,7 +108,7 @@
        private AuthorizationException authze;
        private ErrorResultException ere;
        private LdapException ere;
        /** Any CLI exception that was caught when attempting to find the managed object. */
        private ClientException clie;
@@ -188,7 +188,7 @@
                } catch (ConcurrentModificationException e) {
                    cme = e;
                    result = MenuResult.quit();
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    ere = e;
                    result = MenuResult.quit();
                }
@@ -226,7 +226,7 @@
                } catch (ConcurrentModificationException e) {
                    cme = e;
                    result = MenuResult.quit();
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    ere = e;
                    result = MenuResult.quit();
                }
@@ -310,7 +310,7 @@
                } catch (ConcurrentModificationException e) {
                    cme = e;
                    result = MenuResult.quit();
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    ere = e;
                    result = MenuResult.quit();
                }
@@ -348,7 +348,7 @@
                } catch (ConcurrentModificationException e) {
                    cme = e;
                    result = MenuResult.quit();
                } catch (ErrorResultException e) {
                } catch (LdapException e) {
                    ere = e;
                    result = MenuResult.quit();
                }
@@ -382,13 +382,13 @@
         * @throws AuthorizationException
         *             If the server refuses to retrieve the managed object because the client does not have the correct
         *             privileges.
         * @throws ErrorResultException
         * @throws LdapException
         *             If any other error occurs.
         */
        public MenuResult<ManagedObject<?>> find(ConsoleApplication app, ManagementContext context,
                ManagedObjectPath<?, ?> path, List<String> args) throws ClientException, AuthorizationException,
                ConcurrentModificationException, DefinitionDecodingException, ManagedObjectDecodingException,
                ManagedObjectNotFoundException, ErrorResultException {
                ManagedObjectNotFoundException, LdapException {
            this.result = MenuResult.<ManagedObject<?>> success(context.getRootConfigurationManagedObject());
            this.app = app;
            this.args = args;
@@ -826,13 +826,13 @@
     *             privileges.
     * @throws ClientException
     *             If one of the naming arguments referenced a managed object of the wrong type.
     * @throws ErrorResultException
     * @throws LdapException
     *             If any other error occurs.
     */
    protected final MenuResult<ManagedObject<?>> getManagedObject(ConsoleApplication app, ManagementContext context,
            ManagedObjectPath<?, ?> path, List<String> args) throws ClientException, AuthorizationException,
            DefinitionDecodingException, ManagedObjectDecodingException, ConcurrentModificationException,
            ManagedObjectNotFoundException, ErrorResultException {
            ManagedObjectNotFoundException, LdapException {
        ManagedObjectFinder finder = new ManagedObjectFinder();
        return finder.find(app, context, path, args);
    }
@@ -981,7 +981,7 @@
            } else {
                childNames = parent.listChildren((SetRelationDefinition<C, S>) r, d);
            }
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            // FIXME check exceptions
            System.out.println(String.format("An error occured %s", e.getMessage()));
        }
@@ -1021,7 +1021,7 @@
                children.put(childName, childName);
            } catch (ManagedObjectNotFoundException e) {
                // Skip it - the managed object has been concurrently removed.
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                // Add it anyway: maybe the user is trying to fix the problem.
                children.put(childName, childName);
            }
opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config;
@@ -35,7 +36,7 @@
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.client.ConnectionHandlerCfgClient;
import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg;
@@ -384,7 +385,7 @@
         * {@inheritDoc}
         */
        public void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
                ConcurrentModificationException, OperationRejectedException, ErrorResultException {
                ConcurrentModificationException, OperationRejectedException, LdapException {
            impl.commit();
        }
opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config;
@@ -33,7 +34,7 @@
import org.forgerock.opendj.config.client.ManagedObjectDecodingException;
import org.forgerock.opendj.config.client.OperationRejectedException;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.schema.AttributeType;
/**
@@ -153,10 +154,10 @@
     * @throws ConcurrentModificationException
     *             If this Test Parent has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurs
     */
    String[] listTestChildren() throws ConcurrentModificationException, ErrorResultException;
    String[] listTestChildren() throws ConcurrentModificationException, LdapException;
    /**
     * Gets the named Test Child.
@@ -175,11 +176,11 @@
     * @throws ConcurrentModificationException
     *             If this Test Parent has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurs.
     */
    TestChildCfgClient getTestChild(String name) throws DefinitionDecodingException, ManagedObjectDecodingException,
            ManagedObjectNotFoundException, ConcurrentModificationException, ErrorResultException;
            ManagedObjectNotFoundException, ConcurrentModificationException, LdapException;
    /**
     * Creates a new Test Child. The new Test Child will initially not contain
@@ -219,11 +220,11 @@
     * @throws ConcurrentModificationException
     *             If this Test Parent has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *          If an errors occurs.
     */
    void removeTestChild(String name) throws ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
    /**
     * Determines whether or not the Optional Test Child exists.
@@ -232,10 +233,10 @@
     * @throws ConcurrentModificationException
     *             If this Test Parent has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *          If an errors occurs.
     */
    boolean hasOptionalTestChild() throws ConcurrentModificationException, ErrorResultException;
    boolean hasOptionalTestChild() throws ConcurrentModificationException, LdapException;
    /**
     * Gets the Optional Test Child if it is present.
@@ -252,11 +253,11 @@
     * @throws ConcurrentModificationException
     *             If this Test Parent has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an errors occurs.
     */
    TestChildCfgClient getOptionalChild() throws DefinitionDecodingException, ManagedObjectDecodingException,
            ManagedObjectNotFoundException, ConcurrentModificationException, ErrorResultException;
            ManagedObjectNotFoundException, ConcurrentModificationException, LdapException;
    /**
     * Creates a new Optional Test Child. The new Optional Test Child will
@@ -290,10 +291,10 @@
     * @throws ConcurrentModificationException
     *             If this Test Parent has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an errors occurs.
     */
    void removeOptionalTestChild() throws ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
            ConcurrentModificationException, LdapException;
}
opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config;
@@ -40,7 +41,7 @@
import org.forgerock.opendj.config.server.ConfigurationDeleteListener;
import org.forgerock.opendj.config.server.ServerManagedObject;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.schema.AttributeType;
/**
@@ -320,7 +321,7 @@
        /**
         * {@inheritDoc}
         */
        public String[] listTestChildren() throws ConcurrentModificationException, ErrorResultException {
        public String[] listTestChildren() throws ConcurrentModificationException, LdapException {
            return impl.listChildren(INSTANCE.getTestChildrenRelationDefinition());
        }
@@ -329,7 +330,7 @@
         */
        public TestChildCfgClient getTestChild(String name) throws DefinitionDecodingException,
                ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
                ErrorResultException {
                LdapException {
            return impl.getChild(INSTANCE.getTestChildrenRelationDefinition(), name).getConfiguration();
        }
@@ -346,14 +347,14 @@
         * {@inheritDoc}
         */
        public void removeTestChild(String name) throws ManagedObjectNotFoundException,
                ConcurrentModificationException, OperationRejectedException, ErrorResultException {
                ConcurrentModificationException, OperationRejectedException, LdapException {
            impl.removeChild(INSTANCE.getTestChildrenRelationDefinition(), name);
        }
        /**
         * {@inheritDoc}
         */
        public boolean hasOptionalTestChild() throws ConcurrentModificationException, ErrorResultException {
        public boolean hasOptionalTestChild() throws ConcurrentModificationException, LdapException {
            return impl.hasChild(INSTANCE.getOptionalTestChildRelationDefinition());
        }
@@ -362,7 +363,7 @@
         */
        public TestChildCfgClient getOptionalChild() throws DefinitionDecodingException,
                ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
                ErrorResultException {
                LdapException {
            return impl.getChild(INSTANCE.getOptionalTestChildRelationDefinition()).getConfiguration();
        }
@@ -379,7 +380,7 @@
         * {@inheritDoc}
         */
        public void removeOptionalTestChild() throws ManagedObjectNotFoundException, ConcurrentModificationException,
                OperationRejectedException, ErrorResultException {
                OperationRejectedException, LdapException {
            impl.removeChild(INSTANCE.getOptionalTestChildRelationDefinition());
        }
@@ -401,7 +402,7 @@
         * {@inheritDoc}
         */
        public void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
                ConcurrentModificationException, OperationRejectedException, ErrorResultException {
                ConcurrentModificationException, OperationRejectedException, LdapException {
            impl.commit();
        }
opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/LDAPClientTest.java
@@ -51,7 +51,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.MemoryBackend;
import org.forgerock.opendj.ldap.ResultCode;
@@ -193,11 +193,10 @@
        return new Object[][] {
            // result code corresponding to exception thrown, expected
            // exception, expected code result
            { ResultCode.PROTOCOL_ERROR, ErrorResultException.class, ResultCode.PROTOCOL_ERROR },
            { ResultCode.UNAVAILABLE, ErrorResultException.class, ResultCode.UNAVAILABLE },
            { ResultCode.PROTOCOL_ERROR, LdapException.class, ResultCode.PROTOCOL_ERROR },
            { ResultCode.UNAVAILABLE, LdapException.class, ResultCode.UNAVAILABLE },
            { ResultCode.ENTRY_ALREADY_EXISTS, ManagedObjectAlreadyExistsException.class, null },
            { ResultCode.INSUFFICIENT_ACCESS_RIGHTS, ErrorResultException.class,
                ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
            { ResultCode.INSUFFICIENT_ACCESS_RIGHTS, LdapException.class, ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
            { ResultCode.UNWILLING_TO_PERFORM, OperationRejectedException.class, null } };
    }
@@ -211,13 +210,11 @@
        return new Object[][] {
            // result code corresponding to exception thrown, expected
            // exception, expected code result
            { ResultCode.PROTOCOL_ERROR, ErrorResultException.class, ResultCode.PROTOCOL_ERROR },
            { ResultCode.UNAVAILABLE, ErrorResultException.class, ResultCode.UNAVAILABLE },
            { ResultCode.PROTOCOL_ERROR, LdapException.class, ResultCode.PROTOCOL_ERROR },
            { ResultCode.UNAVAILABLE, LdapException.class, ResultCode.UNAVAILABLE },
            { ResultCode.NO_SUCH_OBJECT, ManagedObjectNotFoundException.class, null },
            { ResultCode.INSUFFICIENT_ACCESS_RIGHTS, ErrorResultException.class,
                ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
            { ResultCode.UNWILLING_TO_PERFORM, ErrorResultException.class,
                ResultCode.UNWILLING_TO_PERFORM } };
            { ResultCode.INSUFFICIENT_ACCESS_RIGHTS, LdapException.class, ResultCode.INSUFFICIENT_ACCESS_RIGHTS },
            { ResultCode.UNWILLING_TO_PERFORM, LdapException.class, ResultCode.UNWILLING_TO_PERFORM } };
    }
    @BeforeClass
@@ -273,8 +270,8 @@
        MemoryBackend backend = new MemoryBackend(new LDIFEntryReader(TEST_LDIF));
        Connection c = new AbstractConnectionWrapper<Connection>(newInternalConnection(backend)) {
            @Override
            public Result add(Entry entry) throws ErrorResultException {
                throw ErrorResultException.newErrorResult(resultCodeOfThrownException);
            public Result add(Entry entry) throws LdapException {
                throw LdapException.newErrorResult(resultCodeOfThrownException);
            }
        };
        ManagementContext ctx =
@@ -285,10 +282,9 @@
            parent.setMandatoryReadOnlyAttributeTypeProperty(getAttributeType("description"));
            parent.commit();
        } catch (Exception e) {
            if (expectedExceptionClass.equals(ErrorResultException.class)) {
                assertThat(e).isInstanceOf(ErrorResultException.class);
                assertThat(((ErrorResultException) e).getResult().getResultCode()).isEqualTo(
                        expectedCode);
            if (expectedExceptionClass.equals(LdapException.class)) {
                assertThat(e).isInstanceOf(LdapException.class);
                assertThat(((LdapException) e).getResult().getResultCode()).isEqualTo(expectedCode);
            } else {
                assertThat(e).isInstanceOf(expectedExceptionClass);
            }
@@ -378,11 +374,9 @@
    /**
     * Tests retrieval of a top-level managed object fails when an underlying
     * ErrorResultException occurs.
     * LdapException occurs.
     *
     * @param cause
     *            The ErrorResultException cause of the failure.
     * @param expected
     * @param expectedExceptionClass
     *            The expected client API exception class.
     */
    @Test(dataProvider = "getManagedObjectExceptions")
@@ -392,9 +386,8 @@
        MemoryBackend backend = new MemoryBackend(new LDIFEntryReader(TEST_LDIF));
        Connection c = new AbstractConnectionWrapper<Connection>(newInternalConnection(backend)) {
            @Override
            public SearchResultEntry readEntry(DN name, String... attributeDescriptions)
                    throws ErrorResultException {
                throw ErrorResultException.newErrorResult(resultCodeOfThrownException);
            public SearchResultEntry readEntry(DN name, String... attributeDescriptions) throws LdapException {
                throw LdapException.newErrorResult(resultCodeOfThrownException);
            }
        };
        ManagementContext ctx =
@@ -402,10 +395,9 @@
        try {
            getTestParent(ctx, "test parent 2");
        } catch (Exception e) {
            if (expectedExceptionClass.equals(ErrorResultException.class)) {
                assertThat(e).isInstanceOf(ErrorResultException.class);
                assertThat(((ErrorResultException) e).getResult().getResultCode()).isEqualTo(
                        expectedCode);
            if (expectedExceptionClass.equals(LdapException.class)) {
                assertThat(e).isInstanceOf(LdapException.class);
                assertThat(((LdapException) e).getResult().getResultCode()).isEqualTo(expectedCode);
            } else {
                assertThat(e).isInstanceOf(expectedExceptionClass);
            }
@@ -656,7 +648,7 @@
        final AtomicBoolean isModified = new AtomicBoolean();
        Connection c = new AbstractConnectionWrapper<Connection>(newInternalConnection(backend)) {
            @Override
            public Result modify(ModifyRequest request) throws ErrorResultException {
            public Result modify(ModifyRequest request) throws LdapException {
                isModified.set(true);
                return super.modify(request);
            }
@@ -680,7 +672,7 @@
        final AtomicBoolean isModified = new AtomicBoolean();
        Connection c = new AbstractConnectionWrapper<Connection>(newInternalConnection(backend)) {
            @Override
            public Result modify(ModifyRequest request) throws ErrorResultException {
            public Result modify(ModifyRequest request) throws LdapException {
                isModified.set(true);
                return super.modify(request);
            }
opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/MockConstraint.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.config.client.ldap;
@@ -35,7 +36,7 @@
import org.forgerock.opendj.config.client.ManagedObject;
import org.forgerock.opendj.config.client.ManagementContext;
import org.forgerock.opendj.config.server.ServerConstraintHandler;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * A mock constraint which can be configured to refuse various types of
@@ -53,7 +54,7 @@
         */
        @Override
        public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
                Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            if (!allowAdds) {
                unacceptableReasons.add(LocalizableMessage.raw("Adds not allowed"));
            }
@@ -66,7 +67,7 @@
         */
        @Override
        public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
                Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            if (!allowDeletes) {
                unacceptableReasons.add(LocalizableMessage.raw("Deletes not allowed"));
            }
@@ -79,7 +80,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
                Collection<LocalizableMessage> unacceptableReasons) throws LdapException {
            if (!allowModifies) {
                unacceptableReasons.add(LocalizableMessage.raw("Modifies not allowed"));
            }
opendj-core/clirr-ignored-api-changes.xml
@@ -277,4 +277,34 @@
    <method>org.forgerock.opendj.ldap.FutureResult addSchema*Async(*)</method>
    <justification>OPENDJ-1285 Migrate SDK from Futures to Promises</justification>
  </difference>
  <difference>
    <className>org/forgerock/opendj/ldap/*Exception</className>
    <differenceType>5001</differenceType>
    <to>org/forgerock/opendj/ldap/ErrorResultException</to>
    <justification>OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency</justification>
  </difference>
  <difference>
    <className>org/forgerock/opendj/ldap/*Exception</className>
    <differenceType>5001</differenceType>
    <to>java/util/concurrent/ExecutionException</to>
    <justification>OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency</justification>
  </difference>
  <difference>
    <className>org/forgerock/opendj/ldap/ConnectionEventListener</className>
    <differenceType>7005</differenceType>
    <method>*handleConnectionError(boolean, org.forgerock.opendj.ldap.ErrorResultException)</method>
    <to>*handleConnectionError(boolean, org.forgerock.opendj.ldap.LdapException)</to>
    <justification>OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency</justification>
  </difference>
  <difference>
    <className>org/forgerock/opendj/ldap/ResultHandler</className>
    <differenceType>7012</differenceType>
    <method>*handleError(org.forgerock.opendj.ldap.LdapException)</method>
    <justification>OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency</justification>
  </difference>
  <difference>
    <className>org/forgerock/opendj/ldap/ErrorResult*Exception</className>
    <differenceType>8001</differenceType>
    <justification>OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency</justification>
  </difference>
</differences>
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -40,7 +40,7 @@
import org.forgerock.opendj.ldap.responses.ExtendedResult;
import org.forgerock.opendj.ldap.responses.Result;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
/**
 * An abstract connection whose synchronous methods are implemented in terms of
@@ -57,55 +57,54 @@
    /** {@inheritDoc} */
    @Override
    public Result add(final AddRequest request) throws ErrorResultException {
    public Result add(final AddRequest request) throws LdapException {
        return blockingGetOrThrow(addAsync(request));
    }
    /** {@inheritDoc} */
    @Override
    public BindResult bind(final BindRequest request) throws ErrorResultException {
    public BindResult bind(final BindRequest request) throws LdapException {
        return blockingGetOrThrow(bindAsync(request));
    }
    /** {@inheritDoc} */
    @Override
    public CompareResult compare(final CompareRequest request) throws ErrorResultException {
    public CompareResult compare(final CompareRequest request) throws LdapException {
        return blockingGetOrThrow(compareAsync(request));
    }
    /** {@inheritDoc} */
    @Override
    public Result delete(final DeleteRequest request) throws ErrorResultException {
    public Result delete(final DeleteRequest request) throws LdapException {
        return blockingGetOrThrow(deleteAsync(request));
    }
    /** {@inheritDoc} */
    @Override
    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
            final IntermediateResponseHandler handler) throws ErrorResultException {
            final IntermediateResponseHandler handler) throws LdapException {
        return blockingGetOrThrow(extendedRequestAsync(request, handler));
    }
    /** {@inheritDoc} */
    @Override
    public Result modify(final ModifyRequest request) throws ErrorResultException {
    public Result modify(final ModifyRequest request) throws LdapException {
        return blockingGetOrThrow(modifyAsync(request));
    }
    /** {@inheritDoc} */
    @Override
    public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException {
    public Result modifyDN(final ModifyDNRequest request) throws LdapException {
        return blockingGetOrThrow(modifyDNAsync(request));
    }
    /** {@inheritDoc} */
    @Override
    public Result search(final SearchRequest request, final SearchResultHandler handler)
            throws ErrorResultException {
    public Result search(final SearchRequest request, final SearchResultHandler handler) throws LdapException {
        return blockingGetOrThrow(searchAsync(request, handler));
    }
    private <T extends Result> T blockingGetOrThrow(FutureResult<T> future) throws ErrorResultException {
    private <T extends Result> T blockingGetOrThrow(FutureResult<T> future) throws LdapException {
        try {
            return future.getOrThrow();
        } catch (InterruptedException e) {
@@ -114,7 +113,7 @@
    }
    // Handle thread interruption.
    private ErrorResultException interrupted(InterruptedException e) {
    private LdapException interrupted(InterruptedException e) {
        return newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e);
    }
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -52,7 +52,7 @@
import org.forgerock.util.Reject;
import org.forgerock.util.promise.Function;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -96,7 +96,7 @@
         *         error if provided error is
         *         <code>ResultCode.SIZE_LIMIT_EXCEEDED</code>
         */
        private ErrorResultException filterError(final ErrorResultException error) {
        private LdapException filterError(final LdapException error) {
            if (error.getResult().getResultCode().equals(ResultCode.SIZE_LIMIT_EXCEEDED)) {
                return newErrorResult(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED,
                        ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES_NO_COUNT.get().toString());
@@ -111,10 +111,10 @@
         * method should be called only after search operation is finished.
         *
         * @return The single search result entry.
         * @throws ErrorResultException
         * @throws LdapException
         *             If an error is detected.
         */
        private SearchResultEntry getSingleEntry() throws ErrorResultException {
        private SearchResultEntry getSingleEntry() throws LdapException {
            if (entryCount == 0) {
                // Did not find any entries.
                throw newErrorResult(ResultCode.CLIENT_SIDE_NO_RESULTS_RETURNED,
@@ -142,7 +142,7 @@
                public Object visitChangeRecord(final Connection p, final AddRequest change) {
                    try {
                        return p.add(change);
                    } catch (final ErrorResultException e) {
                    } catch (final LdapException e) {
                        return e;
                    }
                }
@@ -151,7 +151,7 @@
                public Object visitChangeRecord(final Connection p, final DeleteRequest change) {
                    try {
                        return p.delete(change);
                    } catch (final ErrorResultException e) {
                    } catch (final LdapException e) {
                        return e;
                    }
                }
@@ -160,7 +160,7 @@
                public Object visitChangeRecord(final Connection p, final ModifyDNRequest change) {
                    try {
                        return p.modifyDN(change);
                    } catch (final ErrorResultException e) {
                    } catch (final LdapException e) {
                        return e;
                    }
                }
@@ -169,7 +169,7 @@
                public Object visitChangeRecord(final Connection p, final ModifyRequest change) {
                    try {
                        return p.modify(change);
                    } catch (final ErrorResultException e) {
                    } catch (final LdapException e) {
                        return e;
                    }
                }
@@ -183,12 +183,12 @@
    }
    @Override
    public Result add(final Entry entry) throws ErrorResultException {
    public Result add(final Entry entry) throws LdapException {
        return add(Requests.newAddRequest(entry));
    }
    @Override
    public Result add(final String... ldifLines) throws ErrorResultException {
    public Result add(final String... ldifLines) throws LdapException {
        return add(Requests.newAddRequest(ldifLines));
    }
@@ -198,12 +198,12 @@
    }
    @Override
    public Result applyChange(final ChangeRecord request) throws ErrorResultException {
    public Result applyChange(final ChangeRecord request) throws LdapException {
        final Object result = request.accept(SYNC_VISITOR, this);
        if (result instanceof Result) {
            return (Result) result;
        } else {
            throw (ErrorResultException) result;
            throw (LdapException) result;
        }
    }
@@ -242,7 +242,7 @@
    }
    @Override
    public BindResult bind(final String name, final char[] password) throws ErrorResultException {
    public BindResult bind(final String name, final char[] password) throws LdapException {
        return bind(Requests.newSimpleBindRequest(name, password));
    }
@@ -258,7 +258,7 @@
    @Override
    public CompareResult compare(final String name, final String attributeDescription, final String assertionValue)
            throws ErrorResultException {
            throws LdapException {
        return compare(Requests.newCompareRequest(name, attributeDescription, assertionValue));
    }
@@ -268,7 +268,7 @@
    }
    @Override
    public Result delete(final String name) throws ErrorResultException {
    public Result delete(final String name) throws LdapException {
        return delete(Requests.newDeleteRequest(name));
    }
@@ -278,18 +278,18 @@
    }
    @Override
    public Result deleteSubtree(final String name) throws ErrorResultException {
    public Result deleteSubtree(final String name) throws LdapException {
        return delete(Requests.newDeleteRequest(name).addControl(SubtreeDeleteRequestControl.newControl(true)));
    }
    @Override
    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request) throws ErrorResultException {
    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request) throws LdapException {
        return extendedRequest(request, null);
    }
    @Override
    public GenericExtendedResult extendedRequest(final String requestName, final ByteString requestValue)
            throws ErrorResultException {
            throws LdapException {
        return extendedRequest(Requests.newGenericExtendedRequest(requestName, requestValue));
    }
@@ -299,7 +299,7 @@
    }
    @Override
    public Result modify(final String... ldifLines) throws ErrorResultException {
    public Result modify(final String... ldifLines) throws LdapException {
        return modify(Requests.newModifyRequest(ldifLines));
    }
@@ -309,7 +309,7 @@
    }
    @Override
    public Result modifyDN(final String name, final String newRDN) throws ErrorResultException {
    public Result modifyDN(final String name, final String newRDN) throws LdapException {
        return modifyDN(Requests.newModifyDNRequest(name, newRDN));
    }
@@ -320,7 +320,7 @@
    @Override
    public SearchResultEntry readEntry(final DN baseObject, final String... attributeDescriptions)
            throws ErrorResultException {
            throws LdapException {
        final SearchRequest request =
            Requests.newSingleEntrySearchRequest(baseObject, SearchScope.BASE_OBJECT, Filter.objectClassPresent(),
                attributeDescriptions);
@@ -329,7 +329,7 @@
    @Override
    public SearchResultEntry readEntry(final String baseObject, final String... attributeDescriptions)
            throws ErrorResultException {
            throws LdapException {
        return readEntry(DN.valueOf(baseObject), attributeDescriptions);
    }
@@ -351,13 +351,13 @@
    @Override
    public Result search(final SearchRequest request, final Collection<? super SearchResultEntry> entries)
            throws ErrorResultException {
            throws LdapException {
        return search(request, entries, null);
    }
    @Override
    public Result search(final SearchRequest request, final Collection<? super SearchResultEntry> entries,
        final Collection<? super SearchResultReference> references) throws ErrorResultException {
        final Collection<? super SearchResultReference> references) throws LdapException {
        Reject.ifNull(request, entries);
        // FIXME: does this need to be thread safe?
        final SearchResultHandler handler = new SearchResultHandler() {
@@ -391,19 +391,19 @@
    }
    @Override
    public SearchResultEntry searchSingleEntry(final SearchRequest request) throws ErrorResultException {
    public SearchResultEntry searchSingleEntry(final SearchRequest request) throws LdapException {
        final SingleEntryHandler handler = new SingleEntryHandler();
        try {
            search(enforceSingleEntrySearchRequest(request), handler);
            return handler.getSingleEntry();
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            throw handler.filterError(e);
        }
    }
    @Override
    public SearchResultEntry searchSingleEntry(final String baseObject, final SearchScope scope, final String filter,
        final String... attributeDescriptions) throws ErrorResultException {
        final String... attributeDescriptions) throws LdapException {
        final SearchRequest request =
            Requests.newSingleEntrySearchRequest(baseObject, scope, filter, attributeDescriptions);
        return searchSingleEntry(request);
@@ -413,14 +413,14 @@
    public FutureResult<SearchResultEntry> searchSingleEntryAsync(final SearchRequest request) {
        final SingleEntryHandler handler = new SingleEntryHandler();
        return FutureResultWrapper.asFutureResult(searchAsync(enforceSingleEntrySearchRequest(request), handler).then(
            new Function<Result, SearchResultEntry, ErrorResultException>() {
            new Function<Result, SearchResultEntry, LdapException>() {
                @Override
                public SearchResultEntry apply(final Result value) throws ErrorResultException {
                public SearchResultEntry apply(final Result value) throws LdapException {
                    return handler.getSingleEntry();
                }
            }, new Function<ErrorResultException, SearchResultEntry, ErrorResultException>() {
            }, new Function<LdapException, SearchResultEntry, LdapException>() {
                @Override
                public SearchResultEntry apply(final ErrorResultException error) throws ErrorResultException {
                public SearchResultEntry apply(final LdapException error) throws LdapException {
                    throw handler.filterError(error);
                }
            }));
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -92,7 +92,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result add(final AddRequest request) throws ErrorResultException {
    public Result add(final AddRequest request) throws LdapException {
        return connection.add(request);
    }
@@ -102,7 +102,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result add(final Entry entry) throws ErrorResultException {
    public Result add(final Entry entry) throws LdapException {
        return connection.add(entry);
    }
@@ -112,7 +112,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result add(final String... ldifLines) throws ErrorResultException {
    public Result add(final String... ldifLines) throws LdapException {
        return connection.add(ldifLines);
    }
@@ -153,7 +153,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result applyChange(final ChangeRecord request) throws ErrorResultException {
    public Result applyChange(final ChangeRecord request) throws LdapException {
        return connection.applyChange(request);
    }
@@ -184,7 +184,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public BindResult bind(final BindRequest request) throws ErrorResultException {
    public BindResult bind(final BindRequest request) throws LdapException {
        return connection.bind(request);
    }
@@ -194,7 +194,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public BindResult bind(final String name, final char[] password) throws ErrorResultException {
    public BindResult bind(final String name, final char[] password) throws LdapException {
        return connection.bind(name, password);
    }
@@ -245,7 +245,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public CompareResult compare(final CompareRequest request) throws ErrorResultException {
    public CompareResult compare(final CompareRequest request) throws LdapException {
        return connection.compare(request);
    }
@@ -256,7 +256,7 @@
     */
    @Override
    public CompareResult compare(final String name, final String attributeDescription, final String assertionValue)
            throws ErrorResultException {
            throws LdapException {
        return connection.compare(name, attributeDescription, assertionValue);
    }
@@ -287,7 +287,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result delete(final DeleteRequest request) throws ErrorResultException {
    public Result delete(final DeleteRequest request) throws LdapException {
        return connection.delete(request);
    }
@@ -297,7 +297,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result delete(final String name) throws ErrorResultException {
    public Result delete(final String name) throws LdapException {
        return connection.delete(name);
    }
@@ -328,7 +328,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result deleteSubtree(final String name) throws ErrorResultException {
    public Result deleteSubtree(final String name) throws LdapException {
        return connection.deleteSubtree(name);
    }
@@ -338,7 +338,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request) throws ErrorResultException {
    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request) throws LdapException {
        return connection.extendedRequest(request);
    }
@@ -349,7 +349,7 @@
     */
    @Override
    public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
            final IntermediateResponseHandler handler) throws ErrorResultException {
            final IntermediateResponseHandler handler) throws LdapException {
        return connection.extendedRequest(request, handler);
    }
@@ -360,7 +360,7 @@
     */
    @Override
    public GenericExtendedResult extendedRequest(final String requestName, final ByteString requestValue)
            throws ErrorResultException {
            throws LdapException {
        return connection.extendedRequest(requestName, requestValue);
    }
@@ -411,7 +411,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result modify(final ModifyRequest request) throws ErrorResultException {
    public Result modify(final ModifyRequest request) throws LdapException {
        return connection.modify(request);
    }
@@ -421,7 +421,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result modify(final String... ldifLines) throws ErrorResultException {
    public Result modify(final String... ldifLines) throws LdapException {
        return connection.modify(ldifLines);
    }
@@ -452,7 +452,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException {
    public Result modifyDN(final ModifyDNRequest request) throws LdapException {
        return connection.modifyDN(request);
    }
@@ -462,7 +462,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result modifyDN(final String name, final String newRDN) throws ErrorResultException {
    public Result modifyDN(final String name, final String newRDN) throws LdapException {
        return connection.modifyDN(name, newRDN);
    }
@@ -493,8 +493,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public SearchResultEntry readEntry(final DN name, final String... attributeDescriptions)
            throws ErrorResultException {
    public SearchResultEntry readEntry(final DN name, final String... attributeDescriptions) throws LdapException {
        return connection.readEntry(name, attributeDescriptions);
    }
@@ -504,8 +503,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public SearchResultEntry readEntry(final String name, final String... attributeDescriptions)
            throws ErrorResultException {
    public SearchResultEntry readEntry(final String name, final String... attributeDescriptions) throws LdapException {
        return connection.readEntry(name, attributeDescriptions);
    }
@@ -547,7 +545,7 @@
     */
    @Override
    public Result search(final SearchRequest request,
            final Collection<? super SearchResultEntry> entries) throws ErrorResultException {
            final Collection<? super SearchResultEntry> entries) throws LdapException {
        return connection.search(request, entries);
    }
@@ -559,7 +557,7 @@
    @Override
    public Result search(final SearchRequest request,
            final Collection<? super SearchResultEntry> entries,
            final Collection<? super SearchResultReference> references) throws ErrorResultException {
            final Collection<? super SearchResultReference> references) throws LdapException {
        return connection.search(request, entries, references);
    }
@@ -569,8 +567,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public Result search(final SearchRequest request, final SearchResultHandler handler)
            throws ErrorResultException {
    public Result search(final SearchRequest request, final SearchResultHandler handler) throws LdapException {
        return connection.search(request, handler);
    }
@@ -613,7 +610,7 @@
     * The default implementation is to delegate.
     */
    @Override
    public SearchResultEntry searchSingleEntry(final SearchRequest request) throws ErrorResultException {
    public SearchResultEntry searchSingleEntry(final SearchRequest request) throws LdapException {
        return connection.searchSingleEntry(request);
    }
@@ -624,7 +621,7 @@
     */
    @Override
    public SearchResultEntry searchSingleEntry(final String baseObject, final SearchScope scope, final String filter,
            final String... attributeDescriptions) throws ErrorResultException {
            final String... attributeDescriptions) throws LdapException {
        return connection.searchSingleEntry(baseObject, scope, filter, attributeDescriptions);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -42,7 +42,7 @@
import com.forgerock.opendj.util.ReferenceCountedObject;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.util.promise.Promises.*;
import static com.forgerock.opendj.util.StaticUtils.*;
@@ -61,7 +61,7 @@
        private final ConnectionFactory factory;
        private final AtomicBoolean isOperational = new AtomicBoolean(true);
        private volatile Promise<?, ErrorResultException> pendingConnectPromise;
        private volatile Promise<?, LdapException> pendingConnectPromise;
        private final int index;
        private MonitoredConnectionFactory(final ConnectionFactory factory, final int index) {
@@ -76,11 +76,11 @@
        }
        @Override
        public Connection getConnection() throws ErrorResultException {
        public Connection getConnection() throws LdapException {
            final Connection connection;
            try {
                connection = factory.getConnection();
            } catch (ErrorResultException e) {
            } catch (LdapException e) {
                // Attempt failed - try next factory.
                notifyOffline(e);
                final int nextIndex = (index + 1) % monitoredFactories.size();
@@ -93,20 +93,18 @@
        }
        @Override
        public Promise<Connection, ErrorResultException> getConnectionAsync() {
        public Promise<Connection, LdapException> getConnectionAsync() {
            return factory.getConnectionAsync().thenAsync(
                new AsyncFunction<Connection, Connection, ErrorResultException>() {
                new AsyncFunction<Connection, Connection, LdapException>() {
                    @Override
                    public Promise<Connection, ErrorResultException> apply(Connection value)
                            throws ErrorResultException {
                    public Promise<Connection, LdapException> apply(Connection value) throws LdapException {
                        notifyOnline();
                        return newSuccessfulPromise(value);
                    }
                },
                new AsyncFunction<ErrorResultException, Connection, ErrorResultException>() {
                new AsyncFunction<LdapException, Connection, LdapException>() {
                    @Override
                    public Promise<Connection, ErrorResultException> apply(ErrorResultException error)
                            throws ErrorResultException {
                    public Promise<Connection, LdapException> apply(LdapException error) throws LdapException {
                        // Attempt failed - try next factory.
                        notifyOffline(error);
                        final int nextIndex = (index + 1) % monitoredFactories.size();
@@ -121,7 +119,7 @@
         * Handle monitoring connection request failure.
         */
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            notifyOffline(error);
        }
@@ -151,7 +149,7 @@
            }
        }
        private void notifyOffline(final ErrorResultException error) {
        private void notifyOffline(final LdapException error) {
            // Save the error in case the load-balancer is exhausted.
            lastFailure = error;
@@ -234,7 +232,7 @@
        }
        @Override
        public void handleConnectionFactoryOffline(ConnectionFactory factory, ErrorResultException error) {
        public void handleConnectionFactoryOffline(ConnectionFactory factory, LdapException error) {
            // TODO: I18N
            logger.warn(LocalizableMessage.raw("Connection factory '%s' is no longer operational: %s",
                    factory, error.getMessage()));
@@ -250,7 +248,7 @@
     * marked offline. This is used in order to help diagnose problems when the
     * load-balancer has exhausted all of its factories.
     */
    private volatile ErrorResultException lastFailure = null;
    private volatile LdapException lastFailure;
    /**
     * The event listener which should be notified when connection factories go
@@ -308,7 +306,7 @@
    }
    @Override
    public final ConnectionFactory getConnectionFactory() throws ErrorResultException {
    public final ConnectionFactory getConnectionFactory() throws LdapException {
        final int index = getInitialConnectionFactoryIndex();
        return getMonitoredConnectionFactory(index);
    }
@@ -348,8 +346,7 @@
    abstract int getInitialConnectionFactoryIndex();
    // Return the first factory after index which is operational.
    private MonitoredConnectionFactory getMonitoredConnectionFactory(final int initialIndex)
            throws ErrorResultException {
    private MonitoredConnectionFactory getMonitoredConnectionFactory(final int initialIndex) throws LdapException {
        int index = initialIndex;
        final int maxIndex = monitoredFactories.size();
        do {
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java
@@ -82,7 +82,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(add(request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -92,7 +92,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(bind(request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -102,7 +102,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(compare(request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -112,7 +112,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(delete(request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -122,7 +122,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(extendedRequest(request, intermediateResponseHandler));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -132,7 +132,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(modify(request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -142,7 +142,7 @@
            final IntermediateResponseHandler intermediateResponseHandler) {
        try {
            return onSuccess(modifyDN(request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
@@ -152,12 +152,12 @@
            final IntermediateResponseHandler intermediateResponseHandler, final SearchResultHandler entryHandler) {
        try {
            return onSuccess(search(request, entryHandler));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return onFailure(e);
        }
    }
    private <R extends Result> FutureResult<R> onFailure(final ErrorResultException e) {
    private <R extends Result> FutureResult<R> onFailure(final LdapException e) {
        return newFailedFutureResult(e);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -35,7 +36,7 @@
 * {@link ResultCode#ASSERTION_FAILED ASSERTION_FAILED} result code.
 */
@SuppressWarnings("serial")
public class AssertionFailureException extends ErrorResultException {
public class AssertionFailureException extends LdapException {
    AssertionFailureException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticatedConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -46,8 +46,7 @@
 * will result in an {@code UnsupportedOperationException}.
 * <p>
 * If the Bind request fails for some reason (e.g. invalid credentials), then
 * the connection attempt will fail and an {@code ErrorResultException} will be
 * thrown.
 * the connection attempt will fail and an {@link LdapException} will be thrown.
 */
final class AuthenticatedConnectionFactory implements ConnectionFactory {
@@ -72,12 +71,12 @@
        }
        @Override
        public BindResult bind(BindRequest request) throws ErrorResultException {
        public BindResult bind(BindRequest request) throws LdapException {
            throw new UnsupportedOperationException();
        }
        @Override
        public BindResult bind(String name, char[] password) throws ErrorResultException {
        public BindResult bind(String name, char[] password) throws LdapException {
            throw new UnsupportedOperationException();
        }
@@ -120,7 +119,7 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        final Connection connection = parentFactory.getConnection();
        boolean bindSucceeded = false;
        try {
@@ -140,28 +139,28 @@
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        return parentFactory.getConnectionAsync()
            .thenAsync(
                    new AsyncFunction<Connection, BindResult, ErrorResultException>() {
                    new AsyncFunction<Connection, BindResult, LdapException>() {
                        @Override
                        public Promise<BindResult, ErrorResultException> apply(final Connection connection)
                                throws ErrorResultException {
                        public Promise<BindResult, LdapException> apply(final Connection connection)
                                throws LdapException {
                            connectionHolder.set(connection);
                            return connection.bindAsync(request);
                        }
                    }
            ).then(
                    new Function<BindResult, Connection, ErrorResultException>() {
                    new Function<BindResult, Connection, LdapException>() {
                        @Override
                        public Connection apply(BindResult result) throws ErrorResultException {
                        public Connection apply(BindResult result) throws LdapException {
                            return new AuthenticatedConnection(connectionHolder.get());
                        }
                    },
                    new Function<ErrorResultException, Connection, ErrorResultException>() {
                    new Function<LdapException, Connection, LdapException>() {
                        @Override
                        public Connection apply(ErrorResultException error) throws ErrorResultException {
                        public Connection apply(LdapException error) throws LdapException {
                            closeSilently(connectionHolder.get());
                            throw error;
                        }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -46,7 +47,7 @@
 * </ul>
 */
@SuppressWarnings("serial")
public class AuthenticationException extends ErrorResultException {
public class AuthenticationException extends LdapException {
    AuthenticationException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -48,7 +49,7 @@
 * </ul>
 */
@SuppressWarnings("serial")
public class AuthorizationException extends ErrorResultException {
public class AuthorizationException extends LdapException {
    AuthorizationException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -66,7 +66,7 @@
import com.forgerock.opendj.util.ReferenceCountedObject;
import com.forgerock.opendj.util.TimeSource;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.util.promise.Promises.*;
import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -98,9 +98,9 @@
     * This failure handler is invoked when an attempt to add a new connection
     * to the pool ended in error.
     */
    private final class ConnectionFailureHandler implements FailureHandler<ErrorResultException> {
    private final class ConnectionFailureHandler implements FailureHandler<LdapException> {
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            // Connection attempt failed, so decrease the pool size.
            pendingConnectionAttempts.decrementAndGet();
            availableConnections.release();
@@ -141,7 +141,7 @@
     */
    class PooledConnection implements Connection, ConnectionEventListener {
        private final Connection connection;
        private ErrorResultException error = null;
        private LdapException error;
        private final AtomicBoolean isClosed = new AtomicBoolean(false);
        private boolean isDisconnectNotification = false;
        private List<ConnectionEventListener> listeners = null;
@@ -157,17 +157,17 @@
        }
        @Override
        public Result add(final AddRequest request) throws ErrorResultException {
        public Result add(final AddRequest request) throws LdapException {
            return checkState().add(request);
        }
        @Override
        public Result add(final Entry entry) throws ErrorResultException {
        public Result add(final Entry entry) throws LdapException {
            return checkState().add(entry);
        }
        @Override
        public Result add(final String... ldifLines) throws ErrorResultException {
        public Result add(final String... ldifLines) throws LdapException {
            return checkState().add(ldifLines);
        }
@@ -215,7 +215,7 @@
        }
        @Override
        public Result applyChange(final ChangeRecord request) throws ErrorResultException {
        public Result applyChange(final ChangeRecord request) throws LdapException {
            return checkState().applyChange(request);
        }
@@ -231,13 +231,12 @@
        }
        @Override
        public BindResult bind(final BindRequest request) throws ErrorResultException {
        public BindResult bind(final BindRequest request) throws LdapException {
            return checkState().bind(request);
        }
        @Override
        public BindResult bind(final String name, final char[] password)
                throws ErrorResultException {
        public BindResult bind(final String name, final char[] password) throws LdapException {
            return checkState().bind(name, password);
        }
@@ -305,13 +304,13 @@
        }
        @Override
        public CompareResult compare(final CompareRequest request) throws ErrorResultException {
        public CompareResult compare(final CompareRequest request) throws LdapException {
            return checkState().compare(request);
        }
        @Override
        public CompareResult compare(final String name, final String attributeDescription,
                final String assertionValue) throws ErrorResultException {
                final String assertionValue) throws LdapException {
            return checkState().compare(name, attributeDescription, assertionValue);
        }
@@ -327,12 +326,12 @@
        }
        @Override
        public Result delete(final DeleteRequest request) throws ErrorResultException {
        public Result delete(final DeleteRequest request) throws LdapException {
            return checkState().delete(request);
        }
        @Override
        public Result delete(final String name) throws ErrorResultException {
        public Result delete(final String name) throws LdapException {
            return checkState().delete(name);
        }
@@ -348,25 +347,24 @@
        }
        @Override
        public Result deleteSubtree(final String name) throws ErrorResultException {
        public Result deleteSubtree(final String name) throws LdapException {
            return checkState().deleteSubtree(name);
        }
        @Override
        public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request)
                throws ErrorResultException {
        public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request) throws LdapException {
            return checkState().extendedRequest(request);
        }
        @Override
        public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
                final IntermediateResponseHandler handler) throws ErrorResultException {
                final IntermediateResponseHandler handler) throws LdapException {
            return checkState().extendedRequest(request, handler);
        }
        @Override
        public GenericExtendedResult extendedRequest(final String requestName,
                final ByteString requestValue) throws ErrorResultException {
                final ByteString requestValue) throws LdapException {
            return checkState().extendedRequest(requestName, requestValue);
        }
@@ -393,7 +391,7 @@
        }
        @Override
        public void handleConnectionError(final boolean isDisconnectNotification, final ErrorResultException error) {
        public void handleConnectionError(final boolean isDisconnectNotification, final LdapException error) {
            final List<ConnectionEventListener> tmpListeners;
            synchronized (stateLock) {
                tmpListeners = listeners;
@@ -431,12 +429,12 @@
        }
        @Override
        public Result modify(final ModifyRequest request) throws ErrorResultException {
        public Result modify(final ModifyRequest request) throws LdapException {
            return checkState().modify(request);
        }
        @Override
        public Result modify(final String... ldifLines) throws ErrorResultException {
        public Result modify(final String... ldifLines) throws LdapException {
            return checkState().modify(ldifLines);
        }
@@ -452,12 +450,12 @@
        }
        @Override
        public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException {
        public Result modifyDN(final ModifyDNRequest request) throws LdapException {
            return checkState().modifyDN(request);
        }
        @Override
        public Result modifyDN(final String name, final String newRDN) throws ErrorResultException {
        public Result modifyDN(final String name, final String newRDN) throws LdapException {
            return checkState().modifyDN(name, newRDN);
        }
@@ -474,13 +472,13 @@
        @Override
        public SearchResultEntry readEntry(final DN name, final String... attributeDescriptions)
                throws ErrorResultException {
                throws LdapException {
            return checkState().readEntry(name, attributeDescriptions);
        }
        @Override
        public SearchResultEntry readEntry(final String name, final String... attributeDescriptions)
                throws ErrorResultException {
                throws LdapException {
            return checkState().readEntry(name, attributeDescriptions);
        }
@@ -507,19 +505,19 @@
        @Override
        public Result search(final SearchRequest request, final Collection<? super SearchResultEntry> entries)
                throws ErrorResultException {
                throws LdapException {
            return checkState().search(request, entries);
        }
        @Override
        public Result search(final SearchRequest request, final Collection<? super SearchResultEntry> entries,
                final Collection<? super SearchResultReference> references) throws ErrorResultException {
                final Collection<? super SearchResultReference> references) throws LdapException {
            return checkState().search(request, entries, references);
        }
        @Override
        public Result search(final SearchRequest request, final SearchResultHandler handler)
                throws ErrorResultException {
                throws LdapException {
            return checkState().search(request, handler);
        }
@@ -541,13 +539,13 @@
        }
        @Override
        public SearchResultEntry searchSingleEntry(final SearchRequest request) throws ErrorResultException {
        public SearchResultEntry searchSingleEntry(final SearchRequest request) throws LdapException {
            return checkState().searchSingleEntry(request);
        }
        @Override
        public SearchResultEntry searchSingleEntry(final String baseObject, final SearchScope scope,
                final String filter, final String... attributeDescriptions) throws ErrorResultException {
                final String filter, final String... attributeDescriptions) throws LdapException {
            return checkState().searchSingleEntry(baseObject, scope, filter, attributeDescriptions);
        }
@@ -702,7 +700,7 @@
    private final Semaphore availableConnections;
    private final SuccessHandler<Connection> connectionSuccessHandler = new ConnectionSuccessHandler();
    private final FailureHandler<ErrorResultException> connectionFailureHandler = new ConnectionFailureHandler();
    private final FailureHandler<LdapException> connectionFailureHandler = new ConnectionFailureHandler();
    private final int corePoolSize;
    private final ConnectionFactory factory;
    private boolean isClosed = false;
@@ -788,7 +786,7 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        try {
            return getConnectionAsync().getOrThrow();
        } catch (final InterruptedException e) {
@@ -797,7 +795,7 @@
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        // Loop while iterating through stale connections (see OPENDJ-590).
        for (;;) {
            final QueueElement holder;
@@ -912,8 +910,8 @@
                    currentPoolSize(), maxPoolSize));
            if (holder != null) {
                final ErrorResultException e =
                        ErrorResultException.newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
                final LdapException e =
                        LdapException.newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED,
                                ERR_CONNECTION_POOL_CLOSING.get(toString()).toString());
                holder.getWaitingFuture().handleError(e);
opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -40,7 +41,7 @@
 * </ul>
 */
@SuppressWarnings("serial")
public class CancelledResultException extends ErrorResultException {
public class CancelledResultException extends LdapException {
    CancelledResultException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/Connection.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -66,7 +66,7 @@
 * <p>
 * Synchronous methods block until a response is received from the Directory
 * Server, at which point an appropriate {@link Result} object is returned if
 * the operation succeeded, or thrown as an {@link ErrorResultException} if the
 * the operation succeeded, or thrown as an {@link LdapException} if the
 * operation failed.
 * <p>
 * Since synchronous operations block the calling thread, the only way to
@@ -81,7 +81,7 @@
 * non-blocking, returning a {@link FutureResult} or sub-type thereof which can
 * be used for retrieving the result using the {@link FutureResult#get} method.
 * Operation failures, for whatever reason, are signalled by the
 * {@link FutureResult#get()} method throwing an {@link ErrorResultException}.
 * {@link FutureResult#get()} method throwing an {@link LdapException}.
 * <p>
 * In addition to returning a {@code FutureResult}, all asynchronous methods
 * accept a {@link ResultHandler} which will be notified upon completion of the
@@ -135,7 +135,7 @@
 * {@link IllegalStateException} being thrown. Note that, if a fatal error is
 * encountered on the connection, then the application can continue to use the
 * connection. In this case all requests subsequent to the failure will fail
 * with an appropriate {@link ErrorResultException} when their result is
 * with an appropriate {@link LdapException} when their result is
 * retrieved.
 * <p>
 * <h3>Event notification</h3>
@@ -183,7 +183,7 @@
     * @param request
     *            The add request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -194,7 +194,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    Result add(AddRequest request) throws ErrorResultException;
    Result add(AddRequest request) throws LdapException;
    /**
     * Adds the provided entry to the Directory Server.
@@ -209,7 +209,7 @@
     * @param entry
     *            The entry to be added.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -220,7 +220,7 @@
     * @throws NullPointerException
     *             If {@code entry} was {@code null} .
     */
    Result add(Entry entry) throws ErrorResultException;
    Result add(Entry entry) throws LdapException;
    /**
     * Adds an entry to the Directory Server using the provided lines of LDIF.
@@ -236,7 +236,7 @@
     *            Lines of LDIF containing the an LDIF add change record or an
     *            LDIF entry record.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -250,7 +250,7 @@
     * @throws NullPointerException
     *             If {@code ldifLines} was {@code null} .
     */
    Result add(String... ldifLines) throws ErrorResultException;
    Result add(String... ldifLines) throws LdapException;
    /**
     * Asynchronously adds an entry to the Directory Server using the provided
@@ -312,7 +312,7 @@
     * @param request
     *            The change request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -324,7 +324,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    Result applyChange(ChangeRecord request) throws ErrorResultException;
    Result applyChange(ChangeRecord request) throws LdapException;
    /**
     * Asynchronously applies the provided change request to the Directory
@@ -373,7 +373,7 @@
     * @param request
     *            The bind request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -384,7 +384,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    BindResult bind(BindRequest request) throws ErrorResultException;
    BindResult bind(BindRequest request) throws LdapException;
    /**
     * Authenticates to the Directory Server using simple authentication and the
@@ -404,7 +404,7 @@
     *            The password of the Directory object that the client wishes to
     *            bind as, which may be empty.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -418,7 +418,7 @@
     * @throws NullPointerException
     *             If {@code name} or {@code password} was {@code null}.
     */
    BindResult bind(String name, char[] password) throws ErrorResultException;
    BindResult bind(String name, char[] password) throws LdapException;
    /**
     * Asynchronously authenticates to the Directory Server using the provided
@@ -513,7 +513,7 @@
     * @param request
     *            The compare request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -524,7 +524,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    CompareResult compare(CompareRequest request) throws ErrorResultException;
    CompareResult compare(CompareRequest request) throws LdapException;
    /**
     * Compares the named entry in the Directory Server against the provided
@@ -544,7 +544,7 @@
     * @param assertionValue
     *            The assertion value to be compared.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -560,7 +560,7 @@
     *             {@code assertionValue} was {@code null}.
     */
    CompareResult compare(String name, String attributeDescription, String assertionValue)
            throws ErrorResultException;
            throws LdapException;
    /**
     * Asynchronously compares an entry in the Directory Server using the
@@ -608,7 +608,7 @@
     * @param request
     *            The delete request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -619,7 +619,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    Result delete(DeleteRequest request) throws ErrorResultException;
    Result delete(DeleteRequest request) throws LdapException;
    /**
     * Deletes the named entry from the Directory Server.
@@ -634,7 +634,7 @@
     * @param name
     *            The distinguished name of the entry to be deleted.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -648,7 +648,7 @@
     * @throws NullPointerException
     *             If {@code name} was {@code null}.
     */
    Result delete(String name) throws ErrorResultException;
    Result delete(String name) throws LdapException;
    /**
     * Deletes the named entry and all of its subordinates from the Directory
@@ -665,7 +665,7 @@
     *            The distinguished name of the subtree base entry to be
     *            deleted.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -679,7 +679,7 @@
     * @throws NullPointerException
     *             If {@code name} was {@code null}.
     */
    Result deleteSubtree(String name) throws ErrorResultException;
    Result deleteSubtree(String name) throws LdapException;
    /**
     * Asynchronously deletes an entry from the Directory Server using the
@@ -728,7 +728,7 @@
     * @param request
     *            The extended request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -739,8 +739,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request)
            throws ErrorResultException;
    <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request) throws LdapException;
    /**
     * Requests that the Directory Server performs the provided extended
@@ -755,7 +754,7 @@
     *            any intermediate responses as they are received, may be
     *            {@code null}.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -767,7 +766,7 @@
     *             If {@code request} was {@code null}.
     */
    <R extends ExtendedResult> R extendedRequest(ExtendedRequest<R> request, IntermediateResponseHandler handler)
            throws ErrorResultException;
            throws LdapException;
    /**
     * Requests that the Directory Server performs the provided extended
@@ -787,7 +786,7 @@
     *            The content of the extended request in a form defined by the
     *            extended operation, or {@code null} if there is no content.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -798,8 +797,7 @@
     * @throws NullPointerException
     *             If {@code requestName} was {@code null}.
     */
    GenericExtendedResult extendedRequest(String requestName, ByteString requestValue)
            throws ErrorResultException;
    GenericExtendedResult extendedRequest(String requestName, ByteString requestValue) throws LdapException;
    /**
     * Asynchronously performs the provided extended request in the Directory
@@ -873,7 +871,7 @@
     * @param request
     *            The modify request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -884,7 +882,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    Result modify(ModifyRequest request) throws ErrorResultException;
    Result modify(ModifyRequest request) throws LdapException;
    /**
     * Modifies an entry in the Directory Server using the provided lines of
@@ -901,7 +899,7 @@
     *            Lines of LDIF containing the a single LDIF modify change
     *            record.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -915,7 +913,7 @@
     * @throws NullPointerException
     *             If {@code ldifLines} was {@code null} .
     */
    Result modify(String... ldifLines) throws ErrorResultException;
    Result modify(String... ldifLines) throws LdapException;
    /**
     * Asynchronously modifies an entry in the Directory Server using the
@@ -962,7 +960,7 @@
     * @param request
     *            The modify DN request.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -973,7 +971,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    Result modifyDN(ModifyDNRequest request) throws ErrorResultException;
    Result modifyDN(ModifyDNRequest request) throws LdapException;
    /**
     * Renames the named entry in the Directory Server using the provided new
@@ -991,7 +989,7 @@
     * @param newRDN
     *            The new RDN of the entry.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -1005,7 +1003,7 @@
     * @throws NullPointerException
     *             If {@code name} or {@code newRDN} was {@code null}.
     */
    Result modifyDN(String name, String newRDN) throws ErrorResultException;
    Result modifyDN(String name, String newRDN) throws LdapException;
    /**
     * Asynchronously renames an entry in the Directory Server using the
@@ -1068,7 +1066,7 @@
     *            which may be {@code null} or empty indicating that all user
     *            attributes should be returned.
     * @return The single search result entry returned from the search.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1079,8 +1077,7 @@
     * @throws NullPointerException
     *             If the {@code name} was {@code null}.
     */
    SearchResultEntry readEntry(DN name, String... attributeDescriptions)
            throws ErrorResultException;
    SearchResultEntry readEntry(DN name, String... attributeDescriptions) throws LdapException;
    /**
     * Reads the named entry from the Directory Server.
@@ -1102,7 +1099,7 @@
     * @param attributeDescriptions
     *            The names of the attributes to be included with the entry.
     * @return The single search result entry returned from the search.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -1116,8 +1113,7 @@
     * @throws NullPointerException
     *             If the {@code name} was {@code null}.
     */
    SearchResultEntry readEntry(String name, String... attributeDescriptions)
            throws ErrorResultException;
    SearchResultEntry readEntry(String name, String... attributeDescriptions) throws LdapException;
    /**
     * Asynchronously reads the named entry from the Directory Server.
@@ -1211,7 +1207,7 @@
     * @param entries
     *            The collection to which matching entries should be added.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1222,8 +1218,7 @@
     * @throws NullPointerException
     *             If {@code request} or {@code entries} was {@code null}.
     */
    Result search(SearchRequest request, Collection<? super SearchResultEntry> entries)
            throws ErrorResultException;
    Result search(SearchRequest request, Collection<? super SearchResultEntry> entries) throws LdapException;
    /**
     * Searches the Directory Server using the provided search request. Any
@@ -1245,7 +1240,7 @@
     *            The collection to which search result references should be
     *            added, or {@code null} if references are to be discarded.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1257,7 +1252,7 @@
     *             If {@code request} or {@code entries} was {@code null}.
     */
    Result search(SearchRequest request, Collection<? super SearchResultEntry> entries,
            Collection<? super SearchResultReference> references) throws ErrorResultException;
            Collection<? super SearchResultReference> references) throws LdapException;
    /**
     * Searches the Directory Server using the provided search request. Any
@@ -1271,7 +1266,7 @@
     *            search result entries and references as they are received, may
     *            be {@code null}.
     * @return The result of the operation.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1282,7 +1277,7 @@
     * @throws NullPointerException
     *             If {@code request} was {@code null}.
     */
    Result search(SearchRequest request, SearchResultHandler handler) throws ErrorResultException;
    Result search(SearchRequest request, SearchResultHandler handler) throws LdapException;
    /**
     * Searches the Directory Server using the provided search parameters. Any
@@ -1383,7 +1378,7 @@
     * @param request
     *            The search request.
     * @return The single search result entry returned from the search.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1394,7 +1389,7 @@
     * @throws NullPointerException
     *             If the {@code request} was {@code null}.
     */
    SearchResultEntry searchSingleEntry(SearchRequest request) throws ErrorResultException;
    SearchResultEntry searchSingleEntry(SearchRequest request) throws LdapException;
    /**
     * Searches the Directory Server for a single entry using the provided
@@ -1424,7 +1419,7 @@
     * @param attributeDescriptions
     *            The names of the attributes to be included with each entry.
     * @return The single search result entry returned from the search.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws LocalizedIllegalArgumentException
@@ -1441,7 +1436,7 @@
     *             were {@code null}.
     */
    SearchResultEntry searchSingleEntry(String baseObject, SearchScope scope, String filter,
            String... attributeDescriptions) throws ErrorResultException;
            String... attributeDescriptions) throws LdapException;
    /**
     * Asynchronously searches the Directory Server for a single entry using the
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -48,7 +49,7 @@
     * Notifies this connection event listener that a fatal error has occurred
     * and the connection can no longer be used - the server has crashed, for
     * example. The connection implementation makes this notification just
     * before it throws the provided {@link ErrorResultException} to the
     * before it throws the provided {@link LdapException} to the
     * application.
     * <p>
     * <b>Note:</b> disconnect notifications are treated as fatal connection
@@ -63,7 +64,7 @@
     * @param error
     *            The exception that is about to be thrown to the application.
     */
    void handleConnectionError(boolean isDisconnectNotification, ErrorResultException error);
    void handleConnectionError(boolean isDisconnectNotification, LdapException error);
    /**
     * Notifies this connection event listener that the connection has just
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -33,7 +34,7 @@
 * was unsuccessful because of a connection failure.
 */
@SuppressWarnings("serial")
public class ConnectionException extends ErrorResultException {
public class ConnectionException extends LdapException {
    ConnectionException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -82,7 +82,7 @@
     *
     * @return A promise which can be used to retrieve the connection.
     */
    Promise<Connection, ErrorResultException> getConnectionAsync();
    Promise<Connection, LdapException> getConnectionAsync();
    /**
     * Returns a connection to the Directory Server associated with this
@@ -96,8 +96,8 @@
     *
     * @return A connection to the Directory Server associated with this
     *         connection factory.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the connection request failed for some reason.
     */
    Connection getConnection() throws ErrorResultException;
    Connection getConnection() throws LdapException;
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2011-2013 ForgeRock AS
 *      Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -71,7 +71,7 @@
     *             If this connection pool has already been closed.
     */
    @Override
    Promise<Connection, ErrorResultException> getConnectionAsync();
    Promise<Connection, LdapException> getConnectionAsync();
    /**
     * Obtains a connection from this connection pool, potentially opening a new
@@ -81,11 +81,11 @@
     * implementation, return the connection to this pool without closing it.
     *
     * @return A pooled connection.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the connection request failed for some reason.
     * @throws IllegalStateException
     *             If this connection pool has already been closed.
     */
    @Override
    Connection getConnection() throws ErrorResultException;
    Connection getConnection() throws LdapException;
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -51,10 +51,10 @@
     * @param len
     *            The number of bytes from {@code incoming} to be unwrapped.
     * @return A non-{@code null} byte array containing the unwrapped bytes.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code incoming} cannot be successfully unwrapped.
     */
    byte[] unwrap(byte[] incoming, int offset, int len) throws ErrorResultException;
    byte[] unwrap(byte[] incoming, int offset, int len) throws LdapException;
    /**
     * Wraps a byte array to be sent to the peer.
@@ -68,8 +68,8 @@
     * @param len
     *            The number of bytes from {@code outgoing} to be wrapped.
     * @return A non-{@code null} byte array containing the wrapped bytes.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code outgoing} cannot be successfully wrapped.
     */
    byte[] wrap(byte[] outgoing, int offset, int len) throws ErrorResultException;
    byte[] wrap(byte[] outgoing, int offset, int len) throws LdapException;
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -54,7 +54,7 @@
     * Bind will result in an {@code UnsupportedOperationException}.
     * <p>
     * If the Bind request fails for some reason (e.g. invalid credentials),
     * then the connection attempt will fail and an {@code ErrorResultException}
     * then the connection attempt will fail and an {@link LdapException}
     * will be thrown.
     *
     * @param factory
@@ -543,12 +543,12 @@
            }
            @Override
            public Connection getConnection() throws ErrorResultException {
            public Connection getConnection() throws LdapException {
                return factory.getConnection();
            }
            @Override
            public Promise<Connection, ErrorResultException> getConnectionAsync() {
            public Promise<Connection, LdapException> getConnectionAsync() {
                return factory.getConnectionAsync();
            }
@@ -663,12 +663,12 @@
        return new ConnectionFactory() {
            @Override
            public Promise<Connection, ErrorResultException> getConnectionAsync() {
            public Promise<Connection, LdapException> getConnectionAsync() {
                return factory.getConnectionAsync();
            }
            @Override
            public Connection getConnection() throws ErrorResultException {
            public Connection getConnection() throws LdapException {
                return factory.getConnection();
            }
opendj-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -70,7 +70,7 @@
 * </ul>
 */
@SuppressWarnings("serial")
public class ConstraintViolationException extends ErrorResultException {
public class ConstraintViolationException extends LdapException {
    ConstraintViolationException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java
@@ -22,14 +22,14 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static org.forgerock.opendj.ldap.AttributeDescription.objectClass;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import java.util.ArrayList;
import java.util.Collection;
@@ -905,13 +905,12 @@
     * @param change
     *            The modification to be applied to the entry.
     * @return A reference to the updated entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurred while performing the change such as an
     *             attempt to increment a value which is not a number. The entry
     *             will not have been modified.
     */
    public static Entry modifyEntry(final Entry entry, final Modification change)
            throws ErrorResultException {
    public static Entry modifyEntry(final Entry entry, final Modification change) throws LdapException {
        return modifyEntry(entry, change, null);
    }
@@ -930,13 +929,13 @@
     *            added, or {@code null} if conflicting values should not be
     *            saved.
     * @return A reference to the updated entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurred while performing the change such as an
     *             attempt to increment a value which is not a number. The entry
     *             will not have been modified.
     */
    public static Entry modifyEntry(final Entry entry, final Modification change,
            final Collection<? super ByteString> conflictingValues) throws ErrorResultException {
            final Collection<? super ByteString> conflictingValues) throws LdapException {
        return modifyEntry0(entry, change, conflictingValues, true);
    }
@@ -950,14 +949,13 @@
     * @param changes
     *            The modification request to be applied to the entry.
     * @return A reference to the updated entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurred while performing the changes such as an
     *             attempt to add duplicate values, remove values which do not
     *             exist, or increment a value which is not a number. The entry
     *             may have been modified.
     */
    public static Entry modifyEntry(final Entry entry, final ModifyRequest changes)
            throws ErrorResultException {
    public static Entry modifyEntry(final Entry entry, final ModifyRequest changes) throws LdapException {
        final boolean isPermissive = changes.containsControl(PermissiveModifyRequestControl.OID);
        return modifyEntry0(entry, changes.getModifications(), isPermissive);
    }
@@ -971,13 +969,13 @@
     * @param changes
     *            The modification request to be applied to the entry.
     * @return A reference to the updated entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurred while performing the changes such as an
     *             attempt to increment a value which is not a number. The entry
     *             may have been modified.
     */
    public static Entry modifyEntryPermissive(final Entry entry,
            final Collection<Modification> changes) throws ErrorResultException {
            final Collection<Modification> changes) throws LdapException {
        return modifyEntry0(entry, changes, true);
    }
@@ -991,14 +989,14 @@
     * @param changes
     *            The modification request to be applied to the entry.
     * @return A reference to the updated entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurred while performing the changes such as an
     *             attempt to add duplicate values, remove values which do not
     *             exist, or increment a value which is not a number. The entry
     *             may have been modified.
     */
    public static Entry modifyEntryStrict(final Entry entry, final Collection<Modification> changes)
            throws ErrorResultException {
            throws LdapException {
        return modifyEntry0(entry, changes, false);
    }
@@ -1082,7 +1080,7 @@
    }
    private static void incrementAttribute(final Entry entry, final Attribute change)
            throws ErrorResultException {
            throws LdapException {
        // First parse the change.
        final AttributeDescription deltaAd = change.getAttributeDescription();
        if (change.size() != 1) {
@@ -1118,7 +1116,7 @@
    }
    private static Entry modifyEntry0(final Entry entry, final Collection<Modification> changes,
            final boolean isPermissive) throws ErrorResultException {
            final boolean isPermissive) throws LdapException {
        final Collection<ByteString> conflictingValues =
                isPermissive ? null : new ArrayList<ByteString>(0);
        for (final Modification change : changes) {
@@ -1129,7 +1127,7 @@
    private static Entry modifyEntry0(final Entry entry, final Modification change,
            final Collection<? super ByteString> conflictingValues, final boolean isPermissive)
            throws ErrorResultException {
            throws LdapException {
        final ModificationType modType = change.getModificationType();
        if (modType.equals(ModificationType.ADD)) {
            entry.addAttribute(change.getAttribute(), conflictingValues);
opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -46,7 +47,7 @@
 * sub-class.
 */
@SuppressWarnings("serial")
public class EntryNotFoundException extends ErrorResultException {
public class EntryNotFoundException extends LdapException {
    EntryNotFoundException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/ErrorResultIOException.java
File was deleted
opendj-core/src/main/java/org/forgerock/opendj/ldap/FutureResult.java
@@ -35,7 +35,7 @@
 * @param <S>
 *            The type of result returned by this future result.
 */
public interface FutureResult<S> extends Promise<S, ErrorResultException> {
public interface FutureResult<S> extends Promise<S, LdapException> {
    /**
     * Returns the request ID of the request if appropriate.
     *
opendj-core/src/main/java/org/forgerock/opendj/ldap/FutureResultImpl.java
@@ -35,7 +35,7 @@
 * @see Promise
 * @see Promises
 */
public class FutureResultImpl<R> extends PromiseImpl<R, ErrorResultException>
public class FutureResultImpl<R> extends PromiseImpl<R, LdapException>
    implements FutureResult<R>, ResultHandler<R> {
    private final int requestID;
opendj-core/src/main/java/org/forgerock/opendj/ldap/FutureResultWrapper.java
@@ -55,10 +55,10 @@
 */
public final class FutureResultWrapper<R> {
    private static class LdapPromiseWrapper<R> implements FutureResult<R> {
        private final Promise<R, ErrorResultException> wrappedPromise;
        private final Promise<R, LdapException> wrappedPromise;
        private final int requestID;
        LdapPromiseWrapper(Promise<R, ErrorResultException> wrappedPromise, int requestID) {
        LdapPromiseWrapper(Promise<R, LdapException> wrappedPromise, int requestID) {
            this.wrappedPromise = wrappedPromise;
            this.requestID = requestID;
        }
@@ -85,23 +85,23 @@
        }
        @Override
        public R getOrThrow() throws InterruptedException, ErrorResultException {
        public R getOrThrow() throws InterruptedException, LdapException {
            return wrappedPromise.getOrThrow();
        }
        @Override
        public R getOrThrow(long timeout, TimeUnit unit) throws InterruptedException, ErrorResultException,
        public R getOrThrow(long timeout, TimeUnit unit) throws InterruptedException, LdapException,
            TimeoutException {
            return wrappedPromise.getOrThrow(timeout, unit);
        }
        @Override
        public R getOrThrowUninterruptibly() throws ErrorResultException {
        public R getOrThrowUninterruptibly() throws LdapException {
            return wrappedPromise.getOrThrowUninterruptibly();
        }
        @Override
        public R getOrThrowUninterruptibly(long timeout, TimeUnit unit) throws ErrorResultException, TimeoutException {
        public R getOrThrowUninterruptibly(long timeout, TimeUnit unit) throws LdapException, TimeoutException {
            return wrappedPromise.getOrThrowUninterruptibly(timeout, unit);
        }
@@ -116,27 +116,26 @@
        }
        @Override
        public Promise<R, ErrorResultException> onFailure(FailureHandler<? super ErrorResultException> onFailure) {
        public Promise<R, LdapException> onFailure(FailureHandler<? super LdapException> onFailure) {
            wrappedPromise.onFailure(onFailure);
            return this;
        }
        @Override
        public Promise<R, ErrorResultException> onSuccess(SuccessHandler<? super R> onSuccess) {
        public Promise<R, LdapException> onSuccess(SuccessHandler<? super R> onSuccess) {
            wrappedPromise.onSuccess(onSuccess);
            return this;
        }
        @Override
        public Promise<R, ErrorResultException> onSuccessOrFailure(Runnable onSuccessOrFailure) {
        public Promise<R, LdapException> onSuccessOrFailure(Runnable onSuccessOrFailure) {
            wrappedPromise.onSuccessOrFailure(onSuccessOrFailure);
            return this;
        }
        @Override
        // @Checkstyle:ignore
        public <VOUT> Promise<VOUT, ErrorResultException> then(
                Function<? super R, VOUT, ErrorResultException> onSuccess) {
        public <VOUT> Promise<VOUT, LdapException> then(Function<? super R, VOUT, LdapException> onSuccess) {
            return new LdapPromiseWrapper<VOUT>(wrappedPromise.then(onSuccess), getRequestID());
        }
@@ -144,33 +143,32 @@
        @Override
        // @Checkstyle:ignore
        public <VOUT, EOUT extends Exception> Promise<VOUT, EOUT> then(Function<? super R, VOUT, EOUT> onSuccess,
                Function<? super ErrorResultException, VOUT, EOUT> onFailure) {
                Function<? super LdapException, VOUT, EOUT> onFailure) {
            return new LdapPromiseWrapper(wrappedPromise.then(onSuccess, onFailure), getRequestID());
        }
        @Override
        public Promise<R, ErrorResultException> then(SuccessHandler<? super R> onSuccess) {
        public Promise<R, LdapException> then(SuccessHandler<? super R> onSuccess) {
            wrappedPromise.then(onSuccess);
            return this;
        }
        @Override
        public Promise<R, ErrorResultException> then(SuccessHandler<? super R> onSuccess,
            FailureHandler<? super ErrorResultException> onFailure) {
        public Promise<R, LdapException> then(SuccessHandler<? super R> onSuccess,
            FailureHandler<? super LdapException> onFailure) {
            wrappedPromise.then(onSuccess, onFailure);
            return this;
        }
        @Override
        public Promise<R, ErrorResultException> thenAlways(Runnable onSuccessOrFailure) {
        public Promise<R, LdapException> thenAlways(Runnable onSuccessOrFailure) {
            wrappedPromise.thenAlways(onSuccessOrFailure);
            return this;
        }
        @Override
        // @Checkstyle:ignore
        public <VOUT> Promise<VOUT, ErrorResultException> thenAsync(
                AsyncFunction<? super R, VOUT, ErrorResultException> onSuccess) {
        public <VOUT> Promise<VOUT, LdapException> thenAsync(AsyncFunction<? super R, VOUT, LdapException> onSuccess) {
            return new LdapPromiseWrapper<VOUT>(wrappedPromise.thenAsync(onSuccess), getRequestID());
        }
@@ -179,7 +177,7 @@
        // @Checkstyle:ignore
        public <VOUT, EOUT extends Exception> Promise<VOUT, EOUT> thenAsync(
                AsyncFunction<? super R, VOUT, EOUT> onSuccess,
                AsyncFunction<? super ErrorResultException, VOUT, EOUT> onFailure) {
                AsyncFunction<? super LdapException, VOUT, EOUT> onFailure) {
            return new LdapPromiseWrapper(wrappedPromise.thenAsync(onSuccess, onFailure), getRequestID());
        }
    }
@@ -198,7 +196,7 @@
     *         has already succeeded with the provided result.
     */
    public static <R> FutureResult<R> newSuccessfulFutureResult(final R result) {
        return new LdapPromiseWrapper<R>(Promises.<R, ErrorResultException> newSuccessfulPromise(result), -1);
        return new LdapPromiseWrapper<R>(Promises.<R, LdapException> newSuccessfulPromise(result), -1);
    }
    /**
@@ -218,7 +216,7 @@
     *         has already succeeded with the provided result.
     */
    public static <R> FutureResult<R> newSuccessfulFutureResult(final R result, int requestID) {
        return new LdapPromiseWrapper<R>(Promises.<R, ErrorResultException> newSuccessfulPromise(result), requestID);
        return new LdapPromiseWrapper<R>(Promises.<R, LdapException> newSuccessfulPromise(result), requestID);
    }
    /**
@@ -235,8 +233,8 @@
     * @return A {@link FutureResult} representing an asynchronous task which
     *         has already failed with the provided error.
     */
    public static <R, E extends ErrorResultException> FutureResult<R> newFailedFutureResult(final E error) {
        return new LdapPromiseWrapper<R>(Promises.<R, ErrorResultException> newFailedPromise(error), -1);
    public static <R, E extends LdapException> FutureResult<R> newFailedFutureResult(final E error) {
        return new LdapPromiseWrapper<R>(Promises.<R, LdapException> newFailedPromise(error), -1);
    }
    /**
@@ -256,9 +254,8 @@
     * @return A {@link FutureResult} representing an asynchronous task which
     *         has already failed with the provided error.
     */
    public static <R, E extends ErrorResultException> FutureResult<R> newFailedFutureResult(final E error,
            int requestID) {
        return new LdapPromiseWrapper<R>(Promises.<R, ErrorResultException> newFailedPromise(error), requestID);
    public static <R, E extends LdapException> FutureResult<R> newFailedFutureResult(final E error, int requestID) {
        return new LdapPromiseWrapper<R>(Promises.<R, LdapException> newFailedPromise(error), requestID);
    }
    /**
@@ -272,7 +269,7 @@
     * @return A {@link FutureResult} representing the same asynchronous task as
     *         the {@link Promise} provided.
     */
    public static <R> FutureResult<R> asFutureResult(Promise<R, ErrorResultException> wrappedPromise) {
    public static <R> FutureResult<R> asFutureResult(Promise<R, LdapException> wrappedPromise) {
        return new LdapPromiseWrapper<R>(wrappedPromise, -1);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -71,7 +71,7 @@
import com.forgerock.opendj.util.ReferenceCountedObject;
import com.forgerock.opendj.util.TimeSource;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static com.forgerock.opendj.ldap.CoreMessages.*;
import static com.forgerock.opendj.util.StaticUtils.*;
@@ -115,7 +115,7 @@
    private final class ConnectionFutureResultImpl implements Runnable {
        private Connection connection;
        private Connection heartBeatConnection;
        private ErrorResultException heartBeatError;
        private LdapException heartBeatError;
        /**
         * Due to a potential race between the heart beat timing out and the
@@ -124,14 +124,14 @@
         */
        private final AtomicBoolean isComplete = new AtomicBoolean();
        private final Function<Result, Connection, ErrorResultException> futureSearchSuccess;
        private final Function<ErrorResultException, Connection, ErrorResultException> futureSearchError;
        private final Function<Result, Connection, LdapException> futureSearchSuccess;
        private final Function<LdapException, Connection, LdapException> futureSearchError;
        private ConnectionFutureResultImpl() {
            this.futureSearchSuccess = new Function<Result, Connection, ErrorResultException>() {
            this.futureSearchSuccess = new Function<Result, Connection, LdapException>() {
                @Override
                public Connection apply(Result result) throws ErrorResultException {
                public Connection apply(Result result) throws LdapException {
                    if (isComplete.compareAndSet(false, true)) {
                        heartBeatConnection = adaptConnection(connection);
                    }
@@ -140,9 +140,9 @@
                }
            };
            this.futureSearchError = new Function<ErrorResultException, Connection, ErrorResultException>() {
            this.futureSearchError = new Function<LdapException, Connection, LdapException>() {
                @Override
                public Connection apply(ErrorResultException error) throws ErrorResultException {
                public Connection apply(LdapException error) throws LdapException {
                    manageError(error);
                    throw heartBeatError;
                }
@@ -154,7 +154,7 @@
            manageError(newHeartBeatTimeoutError());
        }
        private void manageError(ErrorResultException error) {
        private void manageError(LdapException error) {
            if (isComplete.compareAndSet(false, true)) {
                // Ensure that the connection is closed.
                if (connection != null) {
@@ -184,7 +184,7 @@
            private final AtomicBoolean completed = new AtomicBoolean();
            @Override
            public void handleError(final ErrorResultException error) {
            public void handleError(final LdapException error) {
                if (tryComplete()) {
                    timestamp(error);
                }
@@ -249,7 +249,7 @@
            protected abstract FutureResult<R> dispatch();
            @Override
            protected final ErrorResultException tryCancel(final boolean mayInterruptIfRunning) {
            protected final LdapException tryCancel(final boolean mayInterruptIfRunning) {
                if (innerFuture != null) {
                    innerFuture.cancel(mayInterruptIfRunning);
                }
@@ -524,8 +524,7 @@
        }
        @Override
        public void handleConnectionError(final boolean isDisconnectNotification,
                final ErrorResultException error) {
        public void handleConnectionError(final boolean isDisconnectNotification, final LdapException error) {
            if (state.notifyConnectionError(isDisconnectNotification, error)) {
                failPendingResults(error);
            }
@@ -616,7 +615,7 @@
            return state.getConnectionError() == null;
        }
        private void failPendingResults(final ErrorResultException error) {
        private void failPendingResults(final LdapException error) {
            /*
             * Peek instead of pool because notification is responsible for
             * removing the element from the queue.
@@ -704,9 +703,9 @@
                                timestamp(result);
                                releaseHeartBeatLock();
                            }
                        }).onFailure(new FailureHandler<ErrorResultException>() {
                        }).onFailure(new FailureHandler<LdapException>() {
                            @Override
                            public void handleError(ErrorResultException error) {
                            public void handleError(LdapException error) {
                                /*
                                 * Connection failure will be handled by
                                 * connection event listener. Ignore
@@ -1049,7 +1048,7 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        /*
         * Immediately send a heart beat in order to determine if the connected
         * server is responding.
@@ -1078,7 +1077,7 @@
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        acquireScheduler(); // Protect scheduler.
        // Create a future responsible for chaining the initial heartbeat
@@ -1087,9 +1086,9 @@
        // Request a connection and return the future representing the
        // heartbeat.
        return factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, ErrorResultException>() {
        return factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(final Connection connectionResult) {
            public Promise<Result, LdapException> apply(final Connection connectionResult) {
                // Save the connection for later once the heart beat completes.
                compositeFuture.connection = connectionResult;
                scheduler.get().schedule(compositeFuture, timeoutMS, TimeUnit.MILLISECONDS);
@@ -1126,9 +1125,9 @@
        return (FutureResult<R>) future.onSuccess(resultHandler).onFailure(resultHandler);
    }
    private ErrorResultException adaptHeartBeatError(final Exception error) {
    private LdapException adaptHeartBeatError(final Exception error) {
        if (error instanceof ConnectionException) {
            return (ErrorResultException) error;
            return (LdapException) error;
        } else if (error instanceof TimeoutResultException || error instanceof TimeoutException) {
            return newHeartBeatTimeoutError();
        } else if (error instanceof InterruptedException) {
@@ -1147,7 +1146,7 @@
        return tmp;
    }
    private ErrorResultException newHeartBeatTimeoutError() {
    private LdapException newHeartBeatTimeoutError() {
        return newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN, HBCF_HEARTBEAT_TIMEOUT
                .get(timeoutMS));
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -68,17 +68,17 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        final ServerConnection<Integer> serverConnection = factory.handleAccept(clientContext);
        return new InternalConnection(serverConnection);
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        final ServerConnection<Integer> serverConnection;
        try {
            serverConnection = factory.handleAccept(clientContext);
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return newFailedFutureResult(e);
        }
opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -97,12 +97,12 @@
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        return impl.getConnectionAsync();
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        return impl.getConnection();
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java
File was renamed from opendj-core/src/main/java/org/forgerock/opendj/ldap/ErrorResultException.java
@@ -22,12 +22,12 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS.
 *      Portions copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import java.util.concurrent.ExecutionException;
import java.io.IOException;
import org.forgerock.opendj.ldap.responses.Responses;
import org.forgerock.opendj.ldap.responses.Result;
@@ -38,7 +38,7 @@
 * application specific exceptions.
 */
@SuppressWarnings("serial")
public class ErrorResultException extends ExecutionException {
public class LdapException extends IOException {
    /**
     * Creates a new error result exception with the provided result code and an
@@ -52,7 +52,7 @@
     * @throws NullPointerException
     *             If {@code resultCode} was {@code null}.
     */
    public static ErrorResultException newErrorResult(ResultCode resultCode) {
    public static LdapException newErrorResult(ResultCode resultCode) {
        return newErrorResult(resultCode, null, null);
    }
@@ -71,7 +71,7 @@
     * @throws NullPointerException
     *             If {@code resultCode} was {@code null}.
     */
    public static ErrorResultException newErrorResult(ResultCode resultCode,
    public static LdapException newErrorResult(ResultCode resultCode,
            CharSequence diagnosticMessage) {
        return newErrorResult(resultCode, diagnosticMessage, null);
    }
@@ -91,7 +91,7 @@
     * @throws NullPointerException
     *             If {@code resultCode} was {@code null}.
     */
    public static ErrorResultException newErrorResult(ResultCode resultCode, Throwable cause) {
    public static LdapException newErrorResult(ResultCode resultCode, Throwable cause) {
        return newErrorResult(resultCode, null, cause);
    }
@@ -113,7 +113,7 @@
     * @throws NullPointerException
     *             If {@code resultCode} was {@code null}.
     */
    public static ErrorResultException newErrorResult(ResultCode resultCode,
    public static LdapException newErrorResult(ResultCode resultCode,
            CharSequence diagnosticMessage, Throwable cause) {
        final Result result = Responses.newResult(resultCode);
        if (diagnosticMessage != null) {
@@ -136,7 +136,7 @@
     * @throws NullPointerException
     *             If {@code result} was {@code null}.
     */
    public static ErrorResultException newErrorResult(final Result result) {
    public static LdapException newErrorResult(final Result result) {
        if (!result.getResultCode().isExceptional()) {
            throw new IllegalArgumentException("Attempted to wrap a successful result: " + result);
        }
@@ -182,7 +182,7 @@
            return new TimeoutResultException(result);
        }
        return new ErrorResultException(result);
        return new LdapException(result);
    }
    private static String getMessage(final Result result) {
@@ -201,7 +201,7 @@
     * @param result
     *            The error result.
     */
    protected ErrorResultException(final Result result) {
    protected LdapException(final Result result) {
        super(getMessage(result), result.getCause());
        this.result = result;
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -51,17 +51,17 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        return algorithm.getConnectionFactory().getConnection();
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        final ConnectionFactory factory;
        try {
            factory = algorithm.getConnectionFactory();
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return newFailedPromise(e);
        }
opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2013 ForgeRock AS.
 *      Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -49,7 +49,7 @@
     * @param error
     *            The last error that occurred.
     */
    void handleConnectionFactoryOffline(ConnectionFactory factory, ErrorResultException error);
    void handleConnectionFactoryOffline(ConnectionFactory factory, LdapException error);
    /**
     * Invoked when the load-balancer detects that a previously offline
opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -49,8 +49,8 @@
     * next connection request.
     *
     * @return The connection factory.
     * @throws ErrorResultException
     * @throws LdapException
     *             If no connection factories are available for use.
     */
    ConnectionFactory getConnectionFactory() throws ErrorResultException;
    ConnectionFactory getConnectionFactory() throws LdapException;
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java
@@ -26,7 +26,7 @@
import static org.forgerock.opendj.ldap.Attributes.singletonAttribute;
import static org.forgerock.opendj.ldap.Entries.modifyEntry;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import static org.forgerock.opendj.ldap.responses.Responses.newBindResult;
import static org.forgerock.opendj.ldap.responses.Responses.newCompareResult;
import static org.forgerock.opendj.ldap.responses.Responses.newResult;
@@ -247,7 +247,7 @@
                }
            }
            resultHandler.handleResult(getResult(request, null, request));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
    }
@@ -288,7 +288,7 @@
             */
            resultHandler.handleError(newErrorResult(ResultCode.INVALID_CREDENTIALS,
                    "Unknown user"));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
    }
@@ -309,7 +309,7 @@
            }
            resultHandler.handleResult(getCompareResult(request, entry, entry.containsAttribute(
                    assertion, null)));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
    }
@@ -339,7 +339,7 @@
            resultHandler.handleResult(getResult(request, entry, null));
        } catch (final DecodeException e) {
            resultHandler.handleError(newErrorResult(ResultCode.PROTOCOL_ERROR, e));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
    }
@@ -367,7 +367,7 @@
                entries.put(dn, modifyEntry(newEntry, request));
            }
            resultHandler.handleResult(getResult(request, entry, newEntry));
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
    }
@@ -406,9 +406,8 @@
                throw newErrorResult(ResultCode.PROTOCOL_ERROR, "Search request contains an unsupported search scope");
            }
        } catch (DecodeException e) {
            resultHandler.handleError(ErrorResultException.newErrorResult(ResultCode.PROTOCOL_ERROR, e.getMessage(),
                e));
        } catch (final ErrorResultException e) {
            resultHandler.handleError(LdapException.newErrorResult(ResultCode.PROTOCOL_ERROR, e.getMessage(), e));
        } catch (final LdapException e) {
            resultHandler.handleError(e);
        }
    }
@@ -446,9 +445,8 @@
                        final Entry entry = reader.readEntry();
                        final DN dn = entry.getName();
                        if (!overwrite && entries.containsKey(dn)) {
                            throw new ErrorResultIOException(newErrorResult(
                                    ResultCode.ENTRY_ALREADY_EXISTS, "Attempted to add the entry '"
                                            + dn.toString() + "' multiple times"));
                            throw newErrorResult(ResultCode.ENTRY_ALREADY_EXISTS,
                                    "Attempted to add the entry '" + dn + "' multiple times");
                        } else {
                            entries.put(dn, entry);
                        }
@@ -485,13 +483,13 @@
     * @throws CancelledResultException
     *           If a cancellation request has been received and processing of
     *           the request should be aborted if possible.
     * @throws ErrorResultException
     * @throws LdapException
     *           If the request is unsuccessful.
     */
    private void searchWithSubordinates(final RequestContext requestContext, final SearchResultHandler entryHandler,
            final ResultHandler<Result> resultHandler, final DN dn, final Matcher matcher,
            final AttributeFilter attributeFilter, final int sizeLimit, SearchScope scope,
            SimplePagedResultsControl pagedResults) throws CancelledResultException, ErrorResultException {
            SimplePagedResultsControl pagedResults) throws CancelledResultException, LdapException {
        final int pageSize = pagedResults != null ? pagedResults.getSize() : 0;
        final int offset = (pagedResults != null && !pagedResults.getCookie().isEmpty())
                ? Integer.valueOf(pagedResults.getCookie().toString()) : 0;
@@ -543,7 +541,7 @@
    }
    private <R extends Result> R addResultControls(final Request request, final Entry before,
            final Entry after, final R result) throws ErrorResultException {
            final Entry after, final R result) throws LdapException {
        try {
            // Add pre-read response control if requested.
            final PreReadRequestControl preRead =
@@ -579,12 +577,12 @@
    }
    private BindResult getBindResult(final BindRequest request, final Entry before,
            final Entry after) throws ErrorResultException {
            final Entry after) throws LdapException {
        return addResultControls(request, before, after, newBindResult(ResultCode.SUCCESS));
    }
    private CompareResult getCompareResult(final CompareRequest request, final Entry entry,
            final boolean compareResult) throws ErrorResultException {
            final boolean compareResult) throws LdapException {
        return addResultControls(
                request,
                entry,
@@ -592,7 +590,7 @@
                newCompareResult(compareResult ? ResultCode.COMPARE_TRUE : ResultCode.COMPARE_FALSE));
    }
    private Entry getRequiredEntry(final Request request, final DN dn) throws ErrorResultException {
    private Entry getRequiredEntry(final Request request, final DN dn) throws LdapException {
        final Entry entry = entries.get(dn);
        if (entry == null) {
            noSuchObject(dn);
@@ -616,12 +614,11 @@
        return entry;
    }
    private Result getResult(final Request request, final Entry before, final Entry after)
            throws ErrorResultException {
    private Result getResult(final Request request, final Entry before, final Entry after) throws LdapException {
        return addResultControls(request, before, after, newResult(ResultCode.SUCCESS));
    }
    private void noSuchObject(final DN dn) throws ErrorResultException {
    private void noSuchObject(final DN dn) throws LdapException {
        throw newErrorResult(ResultCode.NO_SUCH_OBJECT, "The entry '" + dn.toString()
                + "' does not exist");
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -37,7 +38,7 @@
 * CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED} error result codes.
 */
@SuppressWarnings("serial")
public class MultipleEntriesFoundException extends ErrorResultException {
public class MultipleEntriesFoundException extends LdapException {
    MultipleEntriesFoundException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2011 ForgeRock AS
 *      Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -48,9 +48,9 @@
     *            of the client's connection.
     * @return A {@code RequestHandler} which will be used to handle requests
     *         from a client connection.
     * @throws ErrorResultException
     * @throws LdapException
     *             If this request handler factory cannot accept the client
     *             connection.
     */
    RequestHandler<R> handleAccept(C clientContext) throws ErrorResultException;
    RequestHandler<R> handleAccept(C clientContext) throws LdapException;
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java
@@ -33,7 +33,7 @@
import static com.forgerock.opendj.ldap.CoreMessages.INFO_CANCELED_BY_SERVER_DISCONNECT;
import static com.forgerock.opendj.ldap.CoreMessages.INFO_CLIENT_CONNECTION_CLOSING;
import static com.forgerock.opendj.ldap.CoreMessages.WARN_CLIENT_DUPLICATE_MESSAGE_ID;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import java.util.Iterator;
import java.util.LinkedList;
@@ -103,7 +103,7 @@
                final R cancelResult =
                        request.getResultDecoder().newExtendedErrorResult(ResultCode.TOO_LATE, "",
                                "");
                resultHandler.handleError(ErrorResultException.newErrorResult(cancelResult));
                resultHandler.handleError(LdapException.newErrorResult(cancelResult));
            }
        }
@@ -238,7 +238,7 @@
         * {@inheritDoc}
         */
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            if (clientConnection.removePendingRequest(this)) {
                if (setResult(error.getResult())) {
                    /*
@@ -370,8 +370,7 @@
                    cancelResultHandler.handleResult(result);
                } else {
                    final Result result = Responses.newGenericExtendedResult(ResultCode.TOO_LATE);
                    cancelResultHandler.handleError(ErrorResultException
                            .newErrorResult(result));
                    cancelResultHandler.handleError(LdapException.newErrorResult(result));
                }
            }
        }
@@ -807,8 +806,7 @@
     * {@inheritDoc}
     */
    @Override
    public ServerConnection<Integer> handleAccept(final C clientContext)
            throws ErrorResultException {
    public ServerConnection<Integer> handleAccept(final C clientContext) throws LdapException {
        return adaptRequestHandler(factory.handleAccept(clientContext));
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/ResultHandler.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -49,7 +49,7 @@
 * @param <S>
 *            The type of result handled by this result handler.
 */
public interface ResultHandler<S> extends SuccessHandler<S>, FailureHandler<ErrorResultException> {
public interface ResultHandler<S> extends SuccessHandler<S>, FailureHandler<LdapException> {
    /**
     * Invoked when the asynchronous operation has failed.
     *
@@ -57,7 +57,7 @@
     *            The error result exception indicating why the asynchronous
     *            operation has failed.
     */
    void handleError(ErrorResultException error);
    void handleError(LdapException error);
    /**
     * Invoked when the asynchronous operation has completed successfully.
opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -153,7 +153,7 @@
    public static FutureResult<RootDSE> readRootDSEAsync(final Connection connection,
            final ResultHandler<? super RootDSE> handler) {
        return FutureResultWrapper.asFutureResult(connection.searchSingleEntryAsync(SEARCH_REQUEST).then(
            new Function<SearchResultEntry, RootDSE, ErrorResultException>() {
            new Function<SearchResultEntry, RootDSE, LdapException>() {
                @Override
                public RootDSE apply(SearchResultEntry result) {
                    return valueOf(result);
@@ -173,7 +173,7 @@
     *            A connection to the Directory Server whose Root DSE is to be
     *            read.
     * @return The Directory Server's Root DSE.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -184,7 +184,7 @@
     * @throws NullPointerException
     *             If the {@code connection} was {@code null}.
     */
    public static RootDSE readRootDSE(final Connection connection) throws ErrorResultException {
    public static RootDSE readRootDSE(final Connection connection) throws LdapException {
        final Entry entry = connection.searchSingleEntry(SEARCH_REQUEST);
        return valueOf(entry);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -56,9 +57,9 @@
     *            of the client's connection.
     * @return A {@code ServerConnection} which will be used to handle requests
     *         from a client connection.
     * @throws ErrorResultException
     * @throws LdapException
     *             If this server connection factory cannot accept the client
     *             connection.
     */
    ServerConnection<R> handleAccept(C clientContext) throws ErrorResultException;
    ServerConnection<R> handleAccept(C clientContext) throws LdapException;
}
opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -33,7 +34,7 @@
 * was aborted because it did not complete in the required time out period.
 */
@SuppressWarnings("serial")
public class TimeoutResultException extends ErrorResultException {
public class TimeoutResultException extends LdapException {
    TimeoutResultException(final Result result) {
        super(result);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -48,7 +49,7 @@
 *
 * try {
 *     connection.bind(DN, password);
 * } catch (ErrorResultException e) {
 * } catch (LdapException e) {
 *     Result result = e.getResult();
 *     try {
 *         PasswordExpiredResponseControl control =
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.controls;
@@ -62,7 +63,7 @@
 *         // Password policy warning, use control.getWarningType(),
 *         // and control.getWarningValue().
 *     }
 * } catch (ErrorResultException e) {
 * } catch (LdapException e) {
 *     Result result = e.getResult();
 *     try {
 *         PasswordPolicyResponseControl control =
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -65,7 +65,7 @@
 *         // Password policy warning, use control.getWarningType(),
 *         // and control.getWarningValue().
 *     }
 * } catch (ErrorResultException e) {
 * } catch (LdapException e) {
 *     Result result = e.getResult();
 *     try {
 *         PasswordPolicyResponseControl control =
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -99,7 +99,7 @@
 * private static class MySearchResultHandler implements SearchResultHandler {
 *
 *     {@literal @}Override
 *     public void handleErrorResult(ErrorResultException error) {
 *     public void handleErrorResult(LdapException error) {
 *         // Ignore.
 *     }
 *
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -94,7 +94,7 @@
 * private static class MySearchResultHandler implements SearchResultHandler {
 *
 *     {@literal @}Override
 *     public void handleErrorResult(ErrorResultException error) {
 *     public void handleErrorResult(LdapException error) {
 *         // Ignore.
 *     }
 *
opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.controls;
@@ -92,7 +92,7 @@
 * private static class MySearchResultHandler implements SearchResultHandler {
 *
 *     {@literal @}Override
 *     public void handleErrorResult(ErrorResultException error) {
 *     public void handleErrorResult(LdapException error) {
 *         // Ignore.
 *     }
 *
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java
@@ -22,11 +22,12 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * An abstract unmodifiable Bind request which can be used as the basis for
@@ -43,7 +44,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return impl.createBindClient(serverName);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -65,7 +65,7 @@
    AnonymousSASLBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication mechanism identifier for this SASL bind
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java
@@ -22,12 +22,13 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.responses.BindResult;
/**
@@ -57,11 +58,11 @@
     *            The bind result to be evaluated.
     * @return {@code true} if authentication has completed successfully, of
     *         {@code false} if additional steps are required.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the evaluation failed for some reason and authentication
     *             cannot continue.
     */
    boolean evaluateResult(BindResult result) throws ErrorResultException;
    boolean evaluateResult(BindResult result) throws LdapException;
    /**
     * Returns a connection security layer, but only if this bind client has
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java
@@ -22,13 +22,13 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.responses.BindResult;
@@ -59,7 +59,7 @@
     * Default implementation does nothing and always returns {@code true}.
     */
    @Override
    public boolean evaluateResult(final BindResult result) throws ErrorResultException {
    public boolean evaluateResult(final BindResult result) throws LdapException {
        return true;
    }
@@ -83,8 +83,7 @@
     * Default implementation just returns the copy of the bytes.
     */
    @Override
    public byte[] unwrap(final byte[] incoming, final int offset, final int len)
            throws ErrorResultException {
    public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws LdapException {
        final byte[] copy = new byte[len];
        System.arraycopy(incoming, offset, copy, 0, len);
        return copy;
@@ -94,8 +93,7 @@
     * Default implementation just returns the copy of the bytes.
     */
    @Override
    public byte[] wrap(final byte[] outgoing, final int offset, final int len)
            throws ErrorResultException {
    public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws LdapException {
        final byte[] copy = new byte[len];
        System.arraycopy(outgoing, offset, copy, 0, len);
        return copy;
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -65,10 +65,10 @@
     *            The non-null fully-qualified host name of the server to
     *            authenticate to.
     * @return The new bind client.
     * @throws ErrorResultException
     * @throws LdapException
     *             If an error occurred while creating the bind client context.
     */
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication mechanism identifier for this generic bind
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -32,7 +32,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -66,7 +66,7 @@
    CRAMMD5SASLBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication ID of the user. The authentication ID usually
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java
@@ -22,13 +22,13 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
@@ -38,7 +38,7 @@
import javax.security.sasl.SaslException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.BindResult;
import org.forgerock.opendj.ldap.responses.Responses;
@@ -57,7 +57,7 @@
        private final SaslClient saslClient;
        private Client(final CRAMMD5SASLBindRequestImpl initialBindRequest, final String serverName)
                throws ErrorResultException {
                throws LdapException {
            super(initialBindRequest);
            this.authenticationID = initialBindRequest.getAuthenticationID();
@@ -87,7 +87,7 @@
        }
        @Override
        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
        public boolean evaluateResult(final BindResult result) throws LdapException {
            if (saslClient.isComplete()) {
                return true;
            }
@@ -100,7 +100,7 @@
            } catch (final SaslException e) {
                // FIXME: I18N need to have a better error message.
                // FIXME: Is this the best result code?
                throw ErrorResultException.newErrorResult(Responses.newResult(
                throw LdapException.newErrorResult(Responses.newResult(
                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
                        "An error occurred during multi-stage authentication").setCause(e));
            }
@@ -133,7 +133,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return new Client(this, serverName);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -33,7 +33,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -180,7 +180,7 @@
    DigestMD5SASLBindRequest addQOP(String... qopValues);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns a map containing the provided additional authentication
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -30,7 +30,7 @@
import static com.forgerock.opendj.ldap.CoreMessages.ERR_SASL_PROTOCOL_ERROR;
import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -49,7 +49,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.BindResult;
import org.forgerock.util.Reject;
@@ -69,7 +69,7 @@
        private final SaslClient saslClient;
        private Client(final DigestMD5SASLBindRequestImpl initialBindRequest,
                final String serverName) throws ErrorResultException {
                final String serverName) throws LdapException {
            super(initialBindRequest);
            this.authenticationID = initialBindRequest.getAuthenticationID();
@@ -147,7 +147,7 @@
        }
        @Override
        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
        public boolean evaluateResult(final BindResult result) throws LdapException {
            if (saslClient.isComplete()) {
                return true;
            }
@@ -176,8 +176,7 @@
        }
        @Override
        public byte[] unwrap(final byte[] incoming, final int offset, final int len)
                throws ErrorResultException {
        public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws LdapException {
            try {
                return saslClient.unwrap(incoming, offset, len);
            } catch (final SaslException e) {
@@ -188,8 +187,7 @@
        }
        @Override
        public byte[] wrap(final byte[] outgoing, final int offset, final int len)
                throws ErrorResultException {
        public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws LdapException {
            try {
                return saslClient.wrap(outgoing, offset, len);
            } catch (final SaslException e) {
@@ -274,7 +272,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return new Client(this, serverName);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -32,7 +32,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -65,7 +65,7 @@
    ExternalSASLBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication mechanism identifier for this SASL bind
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java
@@ -22,19 +22,19 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslClient;
import javax.security.sasl.SaslException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.BindResult;
import org.forgerock.opendj.ldap.responses.Responses;
@@ -48,7 +48,7 @@
        private final SaslClient saslClient;
        private Client(final ExternalSASLBindRequestImpl initialBindRequest, final String serverName)
                throws ErrorResultException {
                throws LdapException {
            super(initialBindRequest);
            try {
@@ -76,7 +76,7 @@
        }
        @Override
        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
        public boolean evaluateResult(final BindResult result) throws LdapException {
            if (saslClient.isComplete()) {
                return true;
            }
@@ -89,7 +89,7 @@
            } catch (final SaslException e) {
                // FIXME: I18N need to have a better error message.
                // FIXME: Is this the best result code?
                throw ErrorResultException.newErrorResult(Responses.newResult(
                throw LdapException.newErrorResult(Responses.newResult(
                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
                        "An error occurred during multi-stage authentication").setCause(e));
            }
@@ -108,7 +108,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return new Client(this, serverName);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -35,7 +35,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -128,7 +128,7 @@
    GSSAPISASLBindRequest addQOP(String... qopValues);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns a map containing the provided additional authentication
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -32,7 +32,7 @@
import static com.forgerock.opendj.ldap.CoreMessages.ERR_SASL_PROTOCOL_ERROR;
import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@@ -51,7 +51,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.BindResult;
import org.forgerock.opendj.ldap.responses.Responses;
@@ -70,12 +70,11 @@
        implements GSSAPISASLBindRequest {
    private final static class Client extends SASLBindClientImpl {
        private static Subject kerberos5Login(final String authenticationID,
                final ByteString password, final String realm, final String kdc)
                throws ErrorResultException {
                final ByteString password, final String realm, final String kdc) throws LdapException {
            if (authenticationID == null) {
                // FIXME: I18N need to have a better error message.
                // FIXME: Is this the best result code?
                throw ErrorResultException.newErrorResult(Responses.newResult(
                throw LdapException.newErrorResult(Responses.newResult(
                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
                        "No authentication ID specified for GSSAPI SASL authentication"));
            }
@@ -83,7 +82,7 @@
            if (password == null) {
                // FIXME: I18N need to have a better error message.
                // FIXME: Is this the best result code?
                throw ErrorResultException.newErrorResult(Responses.newResult(
                throw LdapException.newErrorResult(Responses.newResult(
                        ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
                        "No password specified for GSSAPI SASL authentication"));
            }
@@ -114,7 +113,7 @@
                final LocalizableMessage message =
                        ERR_LDAPAUTH_GSSAPI_LOCAL_AUTHENTICATION_FAILED.get(StaticUtils
                                .getExceptionMessage(e));
                throw ErrorResultException.newErrorResult(Responses.newResult(
                throw LdapException.newErrorResult(Responses.newResult(
                        ResultCode.CLIENT_SIDE_LOCAL_ERROR)
                        .setDiagnosticMessage(message.toString()).setCause(e));
            }
@@ -125,7 +124,7 @@
        private final PrivilegedExceptionAction<Boolean> evaluateAction =
                new PrivilegedExceptionAction<Boolean>() {
                    @Override
                    public Boolean run() throws ErrorResultException {
                    public Boolean run() throws LdapException {
                        if (saslClient.isComplete()) {
                            return true;
                        }
@@ -138,7 +137,7 @@
                        } catch (final SaslException e) {
                            // FIXME: I18N need to have a better error message.
                            // FIXME: Is this the best result code?
                            throw ErrorResultException.newErrorResult(Responses.newResult(
                            throw LdapException.newErrorResult(Responses.newResult(
                                    ResultCode.CLIENT_SIDE_LOCAL_ERROR).setDiagnosticMessage(
                                    "An error occurred during multi-stage authentication")
                                    .setCause(e));
@@ -152,7 +151,7 @@
        private final Subject subject;
        private Client(final GSSAPISASLBindRequestImpl initialBindRequest, final String serverName)
                throws ErrorResultException {
                throws LdapException {
            super(initialBindRequest);
            this.authorizationID = initialBindRequest.getAuthorizationID();
@@ -169,7 +168,7 @@
                this.saslClient =
                        Subject.doAs(subject, new PrivilegedExceptionAction<SaslClient>() {
                            @Override
                            public SaslClient run() throws ErrorResultException {
                            public SaslClient run() throws LdapException {
                                /*
                                 * Create property map containing all the
                                 * parameters.
@@ -221,8 +220,8 @@
                            }
                        });
            } catch (final PrivilegedActionException e) {
                if (e.getCause() instanceof ErrorResultException) {
                    throw (ErrorResultException) e.getCause();
                if (e.getCause() instanceof LdapException) {
                    throw (LdapException) e.getCause();
                } else {
                    // This should not happen. Must be a bug.
                    final LocalizableMessage msg =
@@ -243,13 +242,13 @@
        }
        @Override
        public boolean evaluateResult(final BindResult result) throws ErrorResultException {
        public boolean evaluateResult(final BindResult result) throws LdapException {
            this.lastResult = result;
            try {
                return Subject.doAs(subject, evaluateAction);
            } catch (final PrivilegedActionException e) {
                if (e.getCause() instanceof ErrorResultException) {
                    throw (ErrorResultException) e.getCause();
                if (e.getCause() instanceof LdapException) {
                    throw (LdapException) e.getCause();
                } else {
                    // This should not happen. Must be a bug.
                    final LocalizableMessage msg =
@@ -271,8 +270,7 @@
        }
        @Override
        public byte[] unwrap(final byte[] incoming, final int offset, final int len)
                throws ErrorResultException {
        public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws LdapException {
            try {
                return saslClient.unwrap(incoming, offset, len);
            } catch (final SaslException e) {
@@ -283,8 +281,7 @@
        }
        @Override
        public byte[] wrap(final byte[] outgoing, final int offset, final int len)
                throws ErrorResultException {
        public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws LdapException {
            try {
                return saslClient.wrap(outgoing, offset, len);
            } catch (final SaslException e) {
@@ -365,7 +362,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return new Client(this, serverName);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -48,7 +48,7 @@
    GenericBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    @Override
    byte getAuthenticationType();
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -30,7 +30,7 @@
import static com.forgerock.opendj.util.StaticUtils.copyOfBytes;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
@@ -72,7 +72,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        if (bindClient == null) {
            return new BindClientImpl(this).setNextAuthenticationValue(authenticationValue);
        } else {
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -32,7 +32,7 @@
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -74,7 +74,7 @@
    PlainSASLBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication ID of the user. The authentication ID usually
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java
@@ -22,12 +22,12 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
@@ -37,7 +37,7 @@
import javax.security.sasl.SaslException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.BindResult;
import org.forgerock.util.Reject;
@@ -55,7 +55,7 @@
        private final SaslClient saslClient;
        private Client(final PlainSASLBindRequestImpl initialBindRequest, final String serverName)
                throws ErrorResultException {
                throws LdapException {
            super(initialBindRequest);
            this.authenticationID = initialBindRequest.getAuthenticationID();
@@ -121,7 +121,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return new Client(this, serverName);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -30,7 +31,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -50,7 +51,7 @@
    SASLBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication mechanism identifier for this SASL bind
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.controls.ControlDecoder;
@@ -73,7 +73,7 @@
    SimpleBindRequest addControl(Control control);
    @Override
    BindClient createBindClient(String serverName) throws ErrorResultException;
    BindClient createBindClient(String serverName) throws LdapException;
    /**
     * Returns the authentication mechanism identifier for this simple bind
opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java
@@ -22,13 +22,13 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.requests;
import org.forgerock.opendj.io.LDAP;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import com.forgerock.opendj.util.StaticUtils;
import org.forgerock.util.Reject;
@@ -53,7 +53,7 @@
    }
    @Override
    public BindClient createBindClient(final String serverName) throws ErrorResultException {
    public BindClient createBindClient(final String serverName) throws LdapException {
        return new BindClientImpl(this).setNextAuthenticationValue(password);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java
@@ -22,16 +22,16 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.responses;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ResultHandler;
import org.forgerock.opendj.ldap.requests.ExtendedRequest;
@@ -68,7 +68,7 @@
        return new ResultHandler<S>() {
            @Override
            public void handleError(final ErrorResultException error) {
            public void handleError(final LdapException error) {
                final Result result = error.getResult();
                final R adaptedResult =
                        request.getResultDecoder().newExtendedErrorResult(result.getResultCode(),
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2014 Manuel Gaupp
 */
package org.forgerock.opendj.ldap.schema;
@@ -44,7 +44,7 @@
import org.forgerock.opendj.ldap.Entries;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.LinkedAttribute;
import org.forgerock.opendj.ldap.RDN;
@@ -968,7 +968,7 @@
     * @param name
     *            The distinguished name of the subschema sub-entry.
     * @return The schema from the Directory Server.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -979,8 +979,7 @@
     * @throws NullPointerException
     *             If the {@code connection} or {@code name} was {@code null}.
     */
    public static Schema readSchema(final Connection connection, final DN name)
            throws ErrorResultException {
    public static Schema readSchema(final Connection connection, final DN name) throws LdapException {
        return new SchemaBuilder().addSchema(connection, name, true).toSchema();
    }
@@ -1010,9 +1009,9 @@
    public static FutureResult<Schema> readSchemaAsync(final Connection connection, final DN name) {
        final SchemaBuilder builder = new SchemaBuilder();
        return asFutureResult(builder.addSchemaAsync(connection, name, true).then(
                new Function<SchemaBuilder, Schema, ErrorResultException>() {
                new Function<SchemaBuilder, Schema, LdapException>() {
                    @Override
                    public Schema apply(SchemaBuilder builder) throws ErrorResultException {
                    public Schema apply(SchemaBuilder builder) throws LdapException {
                        return builder.toSchema();
                    }
                }));
@@ -1039,7 +1038,7 @@
     *            located.
     * @return The schema from the Directory Server which applies to the named
     *         entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1051,7 +1050,7 @@
     *             If the {@code connection} or {@code name} was {@code null}.
     */
    public static Schema readSchemaForEntry(final Connection connection, final DN name)
            throws ErrorResultException {
            throws LdapException {
        return new SchemaBuilder().addSchemaForEntry(connection, name, true).toSchema();
    }
@@ -1087,10 +1086,10 @@
    public static FutureResult<Schema> readSchemaForEntryAsync(final Connection connection, final DN name) {
        final SchemaBuilder builder = new SchemaBuilder();
        return asFutureResult(builder.addSchemaForEntryAsync(connection, name, true).then(
            new Function<SchemaBuilder, Schema, ErrorResultException>() {
            new Function<SchemaBuilder, Schema, LdapException>() {
                @Override
                public Schema apply(SchemaBuilder builder) throws ErrorResultException {
                public Schema apply(SchemaBuilder builder) throws LdapException {
                    return builder.toSchema();
                }
            }));
@@ -2316,7 +2315,7 @@
        try {
            parentEntry =
                    policy.checkDITStructureRulesEntryResolver().getEntry(entry.getName().parent());
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            if (ruleWarnings != null) {
                final LocalizableMessage message =
                        ERR_ENTRY_SCHEMA_DSR_PARENT_NOT_FOUND.get(entry.getName().toString(), e
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2014 Manuel Gaupp
 */
@@ -50,7 +50,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.ResultCode;
@@ -66,7 +66,7 @@
import com.forgerock.opendj.util.StaticUtils;
import com.forgerock.opendj.util.SubstringReader;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.FutureResultWrapper.*;
import static org.forgerock.opendj.ldap.schema.Schema.*;
import static org.forgerock.opendj.ldap.schema.SchemaConstants.*;
@@ -109,8 +109,7 @@
                SUBSCHEMA_ATTRS);
    }
    private static DN getSubschemaSubentryDN(final DN name, final Entry entry)
            throws ErrorResultException {
    private static DN getSubschemaSubentryDN(final DN name, final Entry entry) throws LdapException {
        final Attribute subentryAttr = entry.getAttribute(ATTR_SUBSCHEMA_SUBENTRY);
        if (subentryAttr == null || subentryAttr.isEmpty()) {
@@ -1786,7 +1785,7 @@
     *            {@code true} if existing schema elements with the same
     *            conflicting OIDs should be overwritten.
     * @return A reference to this schema builder.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -1798,7 +1797,7 @@
     *             If the {@code connection} or {@code name} was {@code null}.
     */
    public SchemaBuilder addSchema(final Connection connection, final DN name,
            final boolean overwrite) throws ErrorResultException {
            final boolean overwrite) throws LdapException {
        // The call to addSchema will perform copyOnWrite.
        final SearchRequest request = getReadSchemaSearchRequest(name);
        final Entry entry = connection.searchSingleEntry(request);
@@ -1972,9 +1971,9 @@
        final SearchRequest request = getReadSchemaSearchRequest(name);
        return asFutureResult(connection.searchSingleEntryAsync(request).then(
                new Function<SearchResultEntry, SchemaBuilder, ErrorResultException>() {
                new Function<SearchResultEntry, SchemaBuilder, LdapException>() {
                    @Override
                    public SchemaBuilder apply(SearchResultEntry result) throws ErrorResultException {
                    public SchemaBuilder apply(SearchResultEntry result) throws LdapException {
                        addSchema(result, overwrite);
                        return SchemaBuilder.this;
                    }
@@ -2003,7 +2002,7 @@
     *            {@code true} if existing schema elements with the same
     *            conflicting OIDs should be overwritten.
     * @return A reference to this schema builder.
     * @throws ErrorResultException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws UnsupportedOperationException
@@ -2015,7 +2014,7 @@
     *             If the {@code connection} or {@code name} was {@code null}.
     */
    public SchemaBuilder addSchemaForEntry(final Connection connection, final DN name,
            final boolean overwrite) throws ErrorResultException {
            final boolean overwrite) throws LdapException {
        // The call to addSchema will perform copyOnWrite.
        final SearchRequest request = getReadSchemaForEntrySearchRequest(name);
        final Entry entry = connection.searchSingleEntry(request);
@@ -2060,10 +2059,10 @@
        final SearchRequest request = getReadSchemaForEntrySearchRequest(name);
        return asFutureResult(connection.searchSingleEntryAsync(request).thenAsync(
                new AsyncFunction<SearchResultEntry, SchemaBuilder, ErrorResultException>() {
                new AsyncFunction<SearchResultEntry, SchemaBuilder, LdapException>() {
                    @Override
                    public Promise<SchemaBuilder, ErrorResultException> apply(SearchResultEntry result)
                            throws ErrorResultException {
                    public Promise<SchemaBuilder, LdapException> apply(SearchResultEntry result)
                            throws LdapException {
                        final DN subschemaDN = getSubschemaSubentryDN(name, result);
                        return addSchemaAsync(connection, subschemaDN, overwrite);
                    }
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java
@@ -21,14 +21,14 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2011-2013 ForgeRock AS
 *      Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
/**
 * This class provides various schema validation policy options for controlling
@@ -46,10 +46,10 @@
         * @param dn
         *            The name of the entry to be returned.
         * @return The named entry.
         * @throws ErrorResultException
         * @throws LdapException
         *             If the entry could not be retrieved.
         */
        Entry getEntry(DN dn) throws ErrorResultException;
        Entry getEntry(DN dn) throws LdapException;
    }
    /**
opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/AbstractLDAPFutureResultImpl.java
@@ -22,13 +22,13 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.spi;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResultImpl;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.ResultCode;
@@ -87,7 +87,7 @@
    /** {@inheritDoc} */
    @Override
    protected final ErrorResultException tryCancel(final boolean mayInterruptIfRunning) {
    protected final LdapException tryCancel(final boolean mayInterruptIfRunning) {
        /*
         * No other operations can be performed while a bind or startTLS
         * operations is active. Therefore it is not possible to cancel bind or
@@ -104,7 +104,7 @@
         * this future has already been changed.
         */
        connection.abandonAsync(Requests.newAbandonRequest(getRequestID()));
        return ErrorResultException.newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED);
        return LdapException.newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED);
    }
@@ -175,7 +175,7 @@
     */
    public final void setResultOrError(final S result) {
        if (result.getResultCode().isExceptional()) {
            handleError(ErrorResultException.newErrorResult(result));
            handleError(LdapException.newErrorResult(result));
        } else {
            handleResult(result);
        }
opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013 ForgeRock AS.
 *      Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.spi;
@@ -29,7 +29,7 @@
import java.util.List;
import org.forgerock.opendj.ldap.ConnectionEventListener;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.responses.ExtendedResult;
/**
@@ -49,7 +49,7 @@
 * All methods are synchronized and container classes may also synchronize on
 * the state where needed. The state transition methods,
 * {@link #notifyConnectionClosed()} and
 * {@link #notifyConnectionError(boolean, ErrorResultException)}, correspond to
 * {@link #notifyConnectionError(boolean, LdapException)}, correspond to
 * methods in the {@link ConnectionEventListener} interface except that they
 * return a boolean indicating whether the transition was successful or not.
 */
@@ -107,7 +107,7 @@
            @Override
            boolean notifyConnectionError(final ConnectionState cs,
                    final boolean isDisconnectNotification, final ErrorResultException error) {
                    final boolean isDisconnectNotification, final LdapException error) {
                // Transition from valid to error state.
                cs.failedDueToDisconnect = isDisconnectNotification;
                cs.connectionError = error;
@@ -236,7 +236,7 @@
        }
        boolean notifyConnectionError(final ConnectionState cs,
                final boolean isDisconnectNotification, final ErrorResultException error) {
                final boolean isDisconnectNotification, final LdapException error) {
            return false;
        }
@@ -250,7 +250,7 @@
     * Non-{@code null} once the connection has failed due to a connection
     * error. Volatile so that it can be read without synchronization.
     */
    private volatile ErrorResultException connectionError = null;
    private volatile LdapException connectionError;
    /**
     * {@code true} if the connection has failed due to a disconnect
@@ -301,7 +301,7 @@
     * @return The error that caused the connection to fail, or {@code null} if
     *         the connection has not failed.
     */
    public ErrorResultException getConnectionError() {
    public LdapException getConnectionError() {
        return connectionError;
    }
@@ -353,10 +353,10 @@
     * @return {@code true} if the state changed to error, or {@code false} if
     *         the state was already error or closed.
     * @see ConnectionEventListener#handleConnectionError(boolean,
     *      ErrorResultException)
     *      LdapException)
     */
    public synchronized boolean notifyConnectionError(final boolean isDisconnectNotification,
            final ErrorResultException error) {
            final LdapException error) {
        return state.notifyConnectionError(this, isDisconnectNotification, error);
    }
opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldif;
@@ -30,8 +30,7 @@
import java.io.IOException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.DeleteRequest;
import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
@@ -48,7 +47,7 @@
 * All update requests are performed synchronously, blocking until an update
 * result is received. If an update result indicates that an update request has
 * failed for some reason then the error result is propagated to the caller
 * using an {@code ErrorResultIOException}.
 * using an {@code LdapException}.
 * <p>
 * <b>Note:</b> comments are not supported by connection change record writers.
 * Attempts to write comments will be ignored.
@@ -94,20 +93,15 @@
     * @param change
     *            The {@code AddRequest} to be written.
     * @return A reference to this connection change record writer.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws NullPointerException
     *             If {@code change} was {@code null}.
     */
    public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change)
            throws ErrorResultIOException {
    public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change) throws LdapException {
        Reject.ifNull(change);
        try {
            connection.add(change);
        } catch (final ErrorResultException e) {
            throw new ErrorResultIOException(e);
        }
        return this;
    }
@@ -118,14 +112,13 @@
     * @param change
     *            The change record to be written.
     * @return A reference to this connection change record writer.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws NullPointerException
     *             If {@code change} was {@code null}.
     */
    public ConnectionChangeRecordWriter writeChangeRecord(final ChangeRecord change)
            throws ErrorResultIOException {
    public ConnectionChangeRecordWriter writeChangeRecord(final ChangeRecord change) throws LdapException {
        Reject.ifNull(change);
        final IOException e = change.accept(ChangeRecordVisitorWriter.getInstance(), this);
@@ -133,7 +126,7 @@
            if (e != null) {
                throw e;
            }
        } catch (final ErrorResultIOException e1) {
        } catch (final LdapException e1) {
            throw e1;
        } catch (final IOException e1) {
            // Should not happen.
@@ -149,20 +142,15 @@
     * @param change
     *            The {@code DeleteRequest} to be written.
     * @return A reference to this connection change record writer.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws NullPointerException
     *             If {@code change} was {@code null}.
     */
    public ConnectionChangeRecordWriter writeChangeRecord(final DeleteRequest change)
            throws ErrorResultIOException {
    public ConnectionChangeRecordWriter writeChangeRecord(final DeleteRequest change) throws LdapException {
        Reject.ifNull(change);
        try {
            connection.delete(change);
        } catch (final ErrorResultException e) {
            throw new ErrorResultIOException(e);
        }
        return this;
    }
@@ -173,20 +161,15 @@
     * @param change
     *            The {@code ModifyDNRequest} to be written.
     * @return A reference to this connection change record writer.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws NullPointerException
     *             If {@code change} was {@code null}.
     */
    public ConnectionChangeRecordWriter writeChangeRecord(final ModifyDNRequest change)
            throws ErrorResultIOException {
    public ConnectionChangeRecordWriter writeChangeRecord(final ModifyDNRequest change) throws LdapException {
        Reject.ifNull(change);
        try {
            connection.modifyDN(change);
        } catch (final ErrorResultException e) {
            throw new ErrorResultIOException(e);
        }
        return this;
    }
@@ -197,20 +180,15 @@
     * @param change
     *            The {@code ModifyRequest} to be written.
     * @return A reference to this connection change record writer.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws NullPointerException
     *             If {@code change} was {@code null}.
     */
    public ConnectionChangeRecordWriter writeChangeRecord(final ModifyRequest change)
            throws ErrorResultIOException {
    public ConnectionChangeRecordWriter writeChangeRecord(final ModifyRequest change) throws LdapException {
        Reject.ifNull(change);
        try {
            connection.modify(change);
        } catch (final ErrorResultException e) {
            throw new ErrorResultIOException(e);
        }
        return this;
    }
opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldif;
@@ -33,8 +33,7 @@
import java.util.concurrent.TimeUnit;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ResultHandler;
@@ -48,7 +47,7 @@
import org.forgerock.opendj.ldap.responses.SearchResultReference;
import org.forgerock.util.Reject;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
/**
 * A {@code ConnectionEntryReader} is a bridge from {@code Connection}s to
@@ -59,7 +58,7 @@
 * The Search operation is performed synchronously, blocking until a search
 * result entry is received. If a search result indicates that the search
 * operation has failed for some reason then the error result is propagated to
 * the caller using an {@code ErrorResultIOException}. If a search result
 * the caller using an {@code LdapException}. If a search result
 * reference is returned then it is propagated to the caller using a
 * {@code SearchResultReferenceIOException}.
 * <p>
@@ -137,7 +136,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            try {
                responses.put(error.getResult());
            } catch (final InterruptedException e) {
@@ -230,7 +229,7 @@
     * {@inheritDoc}
     */
    @Override
    public boolean hasNext() throws ErrorResultIOException {
    public boolean hasNext() throws LdapException {
        // Poll for the next response if needed.
        final Response r = getNextResponse();
        if (!(r instanceof Result)) {
@@ -244,7 +243,7 @@
            return false;
        }
        throw new ErrorResultIOException(newErrorResult(result));
        throw newErrorResult(result);
    }
    /**
@@ -254,7 +253,7 @@
     *
     * @return {@code true} if the next search result is an entry, or
     *         {@code false} if it is a reference.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If there are no more search result entries or references and
     *             the search result code indicates that the search operation
     *             failed for some reason.
@@ -263,8 +262,8 @@
     *             the search result code indicates that the search operation
     *             succeeded.
     */
    public boolean isEntry() throws ErrorResultIOException {
        // Throws ErrorResultIOException if search returned error.
    public boolean isEntry() throws LdapException {
        // Throws LdapException if search returned error.
        if (!hasNext()) {
            // Search has completed successfully.
            throw new NoSuchElementException();
@@ -288,7 +287,7 @@
     *
     * @return {@code true} if the next search result is a reference, or
     *         {@code false} if it is an entry.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If there are no more search result entries or references and
     *             the search result code indicates that the search operation
     *             failed for some reason.
@@ -297,7 +296,7 @@
     *             the search result code indicates that the search operation
     *             succeeded.
     */
    public boolean isReference() throws ErrorResultIOException {
    public boolean isReference() throws LdapException {
        return !isEntry();
    }
@@ -313,7 +312,7 @@
     *             This connection entry reader may still contain remaining
     *             search results and references which can be retrieved using
     *             additional calls to this method.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If there are no more search result entries or references and
     *             the search result code indicates that the search operation
     *             failed for some reason.
@@ -323,8 +322,7 @@
     *             succeeded.
     */
    @Override
    public SearchResultEntry readEntry() throws SearchResultReferenceIOException,
            ErrorResultIOException {
    public SearchResultEntry readEntry() throws SearchResultReferenceIOException, LdapException {
        if (isEntry()) {
            final SearchResultEntry entry = (SearchResultEntry) nextResponse;
            nextResponse = null;
@@ -344,7 +342,7 @@
     *
     * @return The next search result reference, or {@code null} if the next
     *         response was a search result entry.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If there are no more search result entries or references and
     *             the search result code indicates that the search operation
     *             failed for some reason.
@@ -353,7 +351,7 @@
     *             the search result code indicates that the search operation
     *             succeeded.
     */
    public SearchResultReference readReference() throws ErrorResultIOException {
    public SearchResultReference readReference() throws LdapException {
        if (isReference()) {
            final SearchResultReference reference = (SearchResultReference) nextResponse;
            nextResponse = null;
@@ -367,7 +365,7 @@
     * Waits for the next search response to become available and returns it if
     * it is a search result indicating that the search completed successfully.
     * If the search result indicates that the search failed then an
     * {@link ErrorResultIOException} is thrown. Otherwise, if the search
     * {@link LdapException} is thrown. Otherwise, if the search
     * response represents an entry or reference then an
     * {@code IllegalStateException} is thrown.
     * <p>
@@ -381,7 +379,7 @@
     * once the current page of results has been processed.
     *
     * @return The search result indicating success.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the search result indicates that the search operation
     *             failed for some reason.
     * @throws IllegalStateException
@@ -389,7 +387,7 @@
     *             be processed. In other words, if {@link #hasNext()} would
     *             return {@code true}.
     */
    public Result readResult() throws ErrorResultIOException {
    public Result readResult() throws LdapException {
        if (hasNext()) {
            throw new IllegalStateException();
        } else {
@@ -397,14 +395,12 @@
        }
    }
    private Response getNextResponse() throws ErrorResultIOException {
    private Response getNextResponse() throws LdapException {
        while (nextResponse == null) {
            try {
                nextResponse = buffer.responses.poll(50, TimeUnit.MILLISECONDS);
            } catch (final InterruptedException e) {
                final ErrorResultException ere =
                        newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e);
                throw new ErrorResultIOException(ere);
                throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e);
            }
            if (nextResponse == null && buffer.isInterrupted) {
opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java
@@ -22,15 +22,14 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldif;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.util.Reject;
@@ -42,7 +41,7 @@
 * All Add requests are performed synchronously, blocking until an Add result is
 * received. If an Add result indicates that an Add request has failed for some
 * reason then the error result is propagated to the caller using an
 * {@code ErrorResultIOException}.
 * {@code LdapException}.
 * <p>
 * <b>Note:</b> comments are not supported by connection change record writers.
 * Attempts to write comments will be ignored.
@@ -104,19 +103,15 @@
     * @param entry
     *            The {@code Entry} to be written.
     * @return A reference to this connection entry writer.
     * @throws ErrorResultIOException
     * @throws LdapException
     *             If the result code indicates that the request failed for some
     *             reason.
     * @throws NullPointerException
     *             If {@code entry} was {@code null}.
     */
    public ConnectionEntryWriter writeEntry(final Entry entry) throws ErrorResultIOException {
    public ConnectionEntryWriter writeEntry(final Entry entry) throws LdapException {
        Reject.ifNull(entry);
        try {
            connection.add(entry);
        } catch (final ErrorResultException e) {
            throw new ErrorResultIOException(e);
        }
        return this;
    }
opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -52,7 +52,7 @@
import static org.fest.assertions.Assertions.*;
import static org.fest.assertions.Fail.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.FutureResultWrapper.*;
import static org.forgerock.opendj.ldap.TestCaseUtils.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
@@ -206,7 +206,7 @@
        try {
            mockConnection.add(addRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -225,7 +225,7 @@
        try {
            mockConnection.bind(bindRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -245,7 +245,7 @@
        try {
            mockConnection.compare(compareRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -265,7 +265,7 @@
        try {
            mockConnection.delete(deleteRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -285,7 +285,7 @@
        try {
            mockConnection.extendedRequest(extendedRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -305,7 +305,7 @@
        try {
            mockConnection.modify(modifyRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -325,7 +325,7 @@
        try {
            mockConnection.modifyDN(modifyDNRequest);
            fail();
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -351,8 +351,8 @@
        List<SearchResultEntry> entries = new LinkedList<SearchResultEntry>();
        try {
            mockConnection.search(searchRequest, entries);
            failWasExpected(ErrorResultException.class);
        } catch (ErrorResultException e) {
            failWasExpected(LdapException.class);
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
            assertThat(entries.isEmpty());
        }
@@ -432,14 +432,14 @@
                newSearchResultEntry("cn=test"));
        final SearchRequest request =
                newSingleEntrySearchRequest("cn=test", SearchScope.BASE_OBJECT, "(objectClass=*)");
        FailureHandler<ErrorResultException> failureHandler = mock(FailureHandler.class);
        FailureHandler<LdapException> failureHandler = mock(FailureHandler.class);
        try {
            mockConnection.searchSingleEntryAsync(request).onFailure(failureHandler).getOrThrow();
            failWasExpected(MultipleEntriesFoundException.class);
        } catch (MultipleEntriesFoundException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED);
            verify(failureHandler).handleError(any(ErrorResultException.class));
            verify(failureHandler).handleError(any(LdapException.class));
        }
    }
@@ -451,13 +451,13 @@
        final SearchRequest request = newSingleEntrySearchRequest("cn=test", SearchScope.BASE_OBJECT,
                "(objectClass=*)");
        @SuppressWarnings("unchecked")
        FailureHandler<ErrorResultException> failureHandler = mock(FailureHandler.class);
        FailureHandler<LdapException> failureHandler = mock(FailureHandler.class);
        try {
            mockConnection.searchSingleEntryAsync(request).onFailure(failureHandler).getOrThrow();
            failWasExpected(MultipleEntriesFoundException.class);
        } catch (MultipleEntriesFoundException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED);
            verify(failureHandler).handleError(any(ErrorResultException.class));
            verify(failureHandler).handleError(any(LdapException.class));
        }
    }
@@ -468,8 +468,8 @@
                newSingleEntrySearchRequest("cn=test", SearchScope.BASE_OBJECT, "(objectClass=*)");
        try {
            mockConnection.searchSingleEntry(request);
            failWasExpected(ErrorResultException.class);
        } catch (ErrorResultException e) {
            failWasExpected(LdapException.class);
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
        }
    }
@@ -480,13 +480,13 @@
        final SearchRequest request =
                newSingleEntrySearchRequest("cn=test", SearchScope.BASE_OBJECT, "(objectClass=*)");
        @SuppressWarnings("unchecked")
        FailureHandler<ErrorResultException> failureHandler = mock(FailureHandler.class);
        FailureHandler<LdapException> failureHandler = mock(FailureHandler.class);
        try {
            mockConnection.searchSingleEntryAsync(request).onFailure(failureHandler).getOrThrow();
            failWasExpected(ErrorResultException.class);
        } catch (ErrorResultException e) {
            failWasExpected(LdapException.class);
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.UNWILLING_TO_PERFORM);
            verify(failureHandler).handleError(any(ErrorResultException.class));
            verify(failureHandler).handleError(any(LdapException.class));
        }
    }
opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithmTestCase.java
@@ -38,7 +38,7 @@
import static org.fest.assertions.Assertions.*;
import static org.fest.assertions.Fail.*;
import static org.forgerock.opendj.ldap.Connections.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.util.promise.Promises.*;
import static org.mockito.Mockito.*;
@@ -52,15 +52,15 @@
            }
            @Override
            public Connection getConnection() throws ErrorResultException {
            public Connection getConnection() throws LdapException {
                return mock.getConnection();
            }
            @Override
            public Promise<Connection, ErrorResultException> getConnectionAsync() {
            public Promise<Connection, LdapException> getConnectionAsync() {
                try {
                    return newSuccessfulPromise(mock.getConnection());
                } catch (final ErrorResultException e) {
                } catch (final LdapException e) {
                    return newFailedPromise(e);
                }
            }
@@ -98,11 +98,11 @@
         * Create load-balancer with two failed connection factories.
         */
        final ConnectionFactory first = mock(ConnectionFactory.class, "first");
        final ErrorResultException firstError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        final LdapException firstError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        when(first.getConnection()).thenThrow(firstError);
        final ConnectionFactory second = mock(ConnectionFactory.class, "second");
        final ErrorResultException secondError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        final LdapException secondError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        when(second.getConnection()).thenThrow(secondError);
        final ConnectionFactory loadBalancer =
@@ -117,7 +117,7 @@
        try {
            loadBalancer.getConnection().close();
            fail("Unexpectedly obtained a connection");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            assertThat(e.getCause()).isSameAs(secondError);
        } finally {
            loadBalancer.close();
@@ -137,12 +137,12 @@
         */
        final ConnectionFactory first = mock(ConnectionFactory.class, "first");
        final ConnectionFactory firstAsync = mockAsync(first);
        final ErrorResultException firstError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        final LdapException firstError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        when(first.getConnection()).thenThrow(firstError).thenReturn(mock(Connection.class));
        final ConnectionFactory second = mock(ConnectionFactory.class, "second");
        final ConnectionFactory secondAsync = mockAsync(second);
        final ErrorResultException secondError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        final LdapException secondError = newErrorResult(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        when(second.getConnection()).thenThrow(secondError);
        final LoadBalancerEventListener listener = mock(LoadBalancerEventListener.class);
@@ -160,7 +160,7 @@
        try {
            loadBalancer.getConnection().close();
            fail("Unexpectedly obtained a connection");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            // Check that the event listener has been fired for both factories.
            verify(listener).handleConnectionFactoryOffline(firstAsync, firstError);
            verify(listener).handleConnectionFactoryOffline(secondAsync, secondError);
opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -45,7 +45,7 @@
import static org.fest.assertions.Assertions.*;
import static org.forgerock.opendj.ldap.Connections.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.TestCaseUtils.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
@@ -76,8 +76,7 @@
        connection.close();
        verify(listener).handleConnectionClosed();
        verify(listener, times(0)).handleConnectionError(anyBoolean(),
                any(ErrorResultException.class));
        verify(listener, times(0)).handleConnectionError(anyBoolean(), any(LdapException.class));
        verify(listener, times(0)).handleUnsolicitedNotification(any(ExtendedResult.class));
        // Get a connection again and make sure that the listener is no longer invoked.
@@ -132,8 +131,7 @@
        listeners.get(0).handleUnsolicitedNotification(
                Responses.newGenericExtendedResult(ResultCode.OTHER));
        verify(listener, times(0)).handleConnectionClosed();
        verify(listener, times(0)).handleConnectionError(anyBoolean(),
                any(ErrorResultException.class));
        verify(listener, times(0)).handleConnectionError(anyBoolean(), any(LdapException.class));
        verify(listener).handleUnsolicitedNotification(any(ExtendedResult.class));
        connection.close();
        assertThat(listeners).hasSize(0);
@@ -247,7 +245,7 @@
         * is a connection available immediately then the future will be
         * completed immediately).
         */
        final Promise<? extends Connection, ErrorResultException> future = pool.getConnectionAsync();
        final Promise<? extends Connection, LdapException> future = pool.getConnectionAsync();
        assertThat(future.isDone()).isFalse();
        // Release a connection and verify that it is immediately redeemed by
@@ -520,32 +518,31 @@
        final ConnectionFactory factory = mock(ConnectionFactory.class);
        final int poolSize = 2;
        final ConnectionPool pool = Connections.newFixedConnectionPool(factory, poolSize);
        doAnswer(new Answer<Promise<Connection, ErrorResultException>>() {
        doAnswer(new Answer<Promise<Connection, LdapException>>() {
            @Override
            public Promise<Connection, ErrorResultException> answer(final InvocationOnMock invocation)
            public Promise<Connection, LdapException> answer(final InvocationOnMock invocation)
                    throws Throwable {
                return PromiseImpl.create();
            }
        }).when(factory).getConnectionAsync();
        List<Promise<? extends Connection, ErrorResultException>> futures =
                new ArrayList<Promise<? extends Connection, ErrorResultException>>();
        List<Promise<? extends Connection, LdapException>> futures =
                new ArrayList<Promise<? extends Connection, LdapException>>();
        for (int i = 0; i < poolSize + 1; i++) {
            futures.add(pool.getConnectionAsync());
        }
        // factory.getConnectionAsync() has been called by the pool poolSize times
        verify(factory, times(poolSize)).getConnectionAsync();
        final ErrorResultException connectError = ErrorResultException
                .newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR);
        for (Promise<? extends Connection, ErrorResultException> future : futures) {
        final LdapException connectError = LdapException.newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR);
        for (Promise<? extends Connection, LdapException> future : futures) {
            // Simulate that an error happened with the created connections
            ((FutureResultImpl) future).handleError(connectError);
            try {
                // Before the fix for OPENDJ-1348 the third future.get() would hang.
                future.getOrThrow();
                Assert.fail("ErrorResultException should have been called");
            } catch (ErrorResultException e) {
                Assert.fail("Expected an exception to be thrown");
            } catch (LdapException e) {
                assertThat(e).isSameAs(connectError);
            }
        }
opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java
@@ -51,7 +51,7 @@
import static org.fest.assertions.Assertions.*;
import static org.fest.assertions.Fail.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.FutureResultWrapper.*;
import static org.forgerock.opendj.ldap.SearchScope.*;
import static org.forgerock.opendj.ldap.TestCaseUtils.*;
@@ -187,13 +187,13 @@
    public void testGetConnectionAsyncWithInitialHeartBeatError() throws Exception {
        @SuppressWarnings("unchecked")
        final SuccessHandler<Connection> mockSuccessHandler = mock(SuccessHandler.class);
        final PromiseImpl<ErrorResultException, NeverThrowsException> promisedError = PromiseImpl.create();
        final PromiseImpl<LdapException, NeverThrowsException> promisedError = PromiseImpl.create();
        mockConnectionWithInitialHeartbeatResult(ResultCode.BUSY);
        Promise<? extends Connection, ErrorResultException> promise = hbcf.getConnectionAsync();
        promise.onSuccess(mockSuccessHandler).onFailure(new FailureHandler<ErrorResultException>() {
        Promise<? extends Connection, LdapException> promise = hbcf.getConnectionAsync();
        promise.onSuccess(mockSuccessHandler).onFailure(new FailureHandler<LdapException>() {
            @Override
            public void handleError(ErrorResultException error) {
            public void handleError(LdapException error) {
                promisedError.handleResult(error);
            }
        });
@@ -203,7 +203,7 @@
        try {
            promise.getOrThrow();
            fail("Unexpectedly obtained a connection");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            checkInitialHeartBeatFailure(e);
        }
@@ -216,7 +216,7 @@
        try {
            hbcf.getConnection();
            fail("Unexpectedly obtained a connection");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            checkInitialHeartBeatFailure(e);
        }
    }
@@ -256,10 +256,9 @@
        // Attempt to send a new request: it should fail immediately.
        @SuppressWarnings("unchecked")
        final FailureHandler<ErrorResultException> mockHandler = mock(FailureHandler.class);
        final FailureHandler<LdapException> mockHandler = mock(FailureHandler.class);
        hbc.modifyAsync(newModifyRequest(DN.rootDN())).onFailure(mockHandler);
        final ArgumentCaptor<ErrorResultException> arg =
                ArgumentCaptor.forClass(ErrorResultException.class);
        final ArgumentCaptor<LdapException> arg = ArgumentCaptor.forClass(LdapException.class);
        verify(mockHandler).handleError(arg.capture());
        assertThat(arg.getValue().getResult().getResultCode()).isEqualTo(
                ResultCode.CLIENT_SIDE_SERVER_DOWN);
@@ -383,16 +382,15 @@
        assertThat(hbcf.toString()).isNotNull();
    }
    private void checkInitialHeartBeatFailure(final ErrorResultException e) {
    private void checkInitialHeartBeatFailure(final LdapException e) {
        /*
         * Initial heartbeat failure should trigger connection exception with
         * heartbeat cause.
         */
        assertThat(e).isInstanceOf(ConnectionException.class);
        assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.CLIENT_SIDE_SERVER_DOWN);
        assertThat(e.getCause()).isInstanceOf(ErrorResultException.class);
        assertThat(((ErrorResultException) e.getCause()).getResult().getResultCode()).isEqualTo(
                ResultCode.BUSY);
        assertThat(e.getCause()).isInstanceOf(LdapException.class);
        assertThat(((LdapException) e.getCause()).getResult().getResultCode()).isEqualTo(ResultCode.BUSY);
    }
    private void mockConnectionWithInitialHeartbeatResult(final ResultCode initialHeartBeatResult) {
@@ -433,7 +431,7 @@
                }
                if (resultCode.isExceptional()) {
                    final ErrorResultException error = newErrorResult(resultCode);
                    final LdapException error = newErrorResult(resultCode);
                    if (error instanceof ConnectionException) {
                        for (final ConnectionEventListener listener : listeners) {
                            listener.handleConnectionError(false, error);
opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -177,8 +177,7 @@
            if (entryMap.containsKey(dn)) {
                // duplicate entry.
                result = Responses.newResult(ResultCode.ENTRY_ALREADY_EXISTS);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                handler.handleError(ere);
                handler.handleError(LdapException.newErrorResult(result));
                // doesn't matter if it was canceled.
                requestsInProgress.remove(context);
                return;
@@ -196,8 +195,7 @@
            if (abReq.isCanceled()) {
                result = Responses.newResult(ResultCode.CANCELLED);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                handler.handleError(ere);
                handler.handleError(LdapException.newErrorResult(result));
                requestsInProgress.remove(context);
                return;
            }
@@ -282,26 +280,22 @@
                                }
                                @Override
                                public byte[] unwrap(byte[] incoming, int offset, int len)
                                        throws ErrorResultException {
                                public byte[] unwrap(byte[] incoming, int offset, int len) throws LdapException {
                                    try {
                                        return saslServer.unwrap(incoming, offset, len);
                                    } catch (SaslException e) {
                                        throw ErrorResultException
                                                .newErrorResult(Responses.newResult(
                                                        ResultCode.OPERATIONS_ERROR).setCause(e));
                                        throw LdapException.newErrorResult(
                                                Responses.newResult(ResultCode.OPERATIONS_ERROR).setCause(e));
                                    }
                                }
                                @Override
                                public byte[] wrap(byte[] outgoing, int offset, int len)
                                        throws ErrorResultException {
                                public byte[] wrap(byte[] outgoing, int offset, int len) throws LdapException {
                                    try {
                                        return saslServer.wrap(outgoing, offset, len);
                                    } catch (SaslException e) {
                                        throw ErrorResultException
                                                .newErrorResult(Responses.newResult(
                                                        ResultCode.OPERATIONS_ERROR).setCause(e));
                                        throw LdapException.newErrorResult(
                                                Responses.newResult(ResultCode.OPERATIONS_ERROR).setCause(e));
                                    }
                                }
                            };
@@ -315,7 +309,7 @@
                                ByteString.wrap(challenge)));
                    }
                } catch (Exception e) {
                    resultHandler.handleError(ErrorResultException.newErrorResult(Responses
                    resultHandler.handleError(LdapException.newErrorResult(Responses
                            .newBindResult(ResultCode.OPERATIONS_ERROR).setCause(e)
                            .setDiagnosticMessage(e.toString())));
                }
@@ -363,8 +357,7 @@
            if (!entryMap.containsKey(dn)) {
                // entry not found.
                result = Responses.newCompareResult(ResultCode.NO_SUCH_ATTRIBUTE);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                resultHandler.handleError(ere);
                resultHandler.handleError(LdapException.newErrorResult(result));
                // doesn't matter if it was canceled.
                requestsInProgress.remove(context);
                return;
@@ -379,8 +372,7 @@
                    final ByteString s = it.next();
                    if (abReq.isCanceled()) {
                        final Result r = Responses.newResult(ResultCode.CANCELLED);
                        final ErrorResultException ere = ErrorResultException.newErrorResult(r);
                        resultHandler.handleError(ere);
                        resultHandler.handleError(LdapException.newErrorResult(r));
                        requestsInProgress.remove(context);
                        return;
                    }
@@ -409,8 +401,7 @@
            if (!entryMap.containsKey(dn)) {
                // entry is not found.
                result = Responses.newResult(ResultCode.NO_SUCH_OBJECT);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                handler.handleError(ere);
                handler.handleError(LdapException.newErrorResult(result));
                // doesn't matter if it was canceled.
                requestsInProgress.remove(context);
                return;
@@ -418,8 +409,7 @@
            if (abReq.isCanceled()) {
                result = Responses.newResult(ResultCode.CANCELLED);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                handler.handleError(ere);
                handler.handleError(LdapException.newErrorResult(result));
                requestsInProgress.remove(context);
                return;
            }
@@ -471,8 +461,7 @@
            if (!entryMap.containsKey(dn)) {
                // Entry not found.
                result = Responses.newResult(ResultCode.NO_SUCH_OBJECT);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                resultHandler.handleError(ere);
                resultHandler.handleError(LdapException.newErrorResult(result));
                // Should searchResultHandler handle anything?
                // doesn't matter if it was canceled.
@@ -482,8 +471,7 @@
            if (abReq.isCanceled()) {
                result = Responses.newResult(ResultCode.CANCELLED);
                final ErrorResultException ere = ErrorResultException.newErrorResult(result);
                resultHandler.handleError(ere);
                resultHandler.handleError(LdapException.newErrorResult(result));
                requestsInProgress.remove(context);
                return;
            }
opendj-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013 ForgeRock AS.
 *      Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -99,7 +99,7 @@
                .isEqualTo(newDomain);
    }
    @Test(expectedExceptions = ErrorResultException.class)
    @Test(expectedExceptions = LdapException.class)
    public void testAddPreRead() throws Exception {
        final Connection connection = getConnection();
        final Entry newDomain =
@@ -169,7 +169,7 @@
        }
    }
    @Test(expectedExceptions = ErrorResultException.class)
    @Test(expectedExceptions = LdapException.class)
    public void testDeletePostRead() throws Exception {
        final Connection connection = getConnection();
        connection.delete(newDeleteRequest("dc=xxx,dc=com").addControl(
@@ -434,9 +434,9 @@
                        "objectClass: top", "dc: example"));
        try {
            reader.hasNext();
            TestCaseUtils.failWasExpected(ErrorResultIOException.class);
        } catch (ErrorResultIOException e) {
            assertThat(e.getCause().getResult().getResultCode()).isEqualTo(ResultCode.SIZE_LIMIT_EXCEEDED);
            TestCaseUtils.failWasExpected(LdapException.class);
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.SIZE_LIMIT_EXCEEDED);
        }
    }
@@ -481,8 +481,8 @@
            connection.search(
                    Requests.newSearchRequest("dc=example,dc=com", SearchScope.WHOLE_SUBTREE, "(objectClass=*)").
                    setSizeLimit(2), entries);
            TestCaseUtils.failWasExpected(ErrorResultException.class);
        } catch (ErrorResultException e) {
            TestCaseUtils.failWasExpected(LdapException.class);
        } catch (LdapException e) {
            assertThat(e.getResult().getResultCode()).isEqualTo(ResultCode.SIZE_LIMIT_EXCEEDED);
            assertThat(entries).hasSize(2);
        }
opendj-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2012-2013 ForgeRock AS.
 *      Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -43,7 +43,7 @@
    private final CountDownLatch errorLatch = new CountDownLatch(1);
    private final CountDownLatch notificationLatch = new CountDownLatch(1);
    private Boolean isDisconnectNotification = null;
    private ErrorResultException error = null;
    private LdapException error;
    private ExtendedResult notification = null;
    private final AtomicInteger invocationCount = new AtomicInteger();
@@ -60,7 +60,7 @@
     * {@inheritDoc}
     */
    @Override
    public void handleConnectionError(boolean isDisconnectNotification, ErrorResultException error) {
    public void handleConnectionError(boolean isDisconnectNotification, LdapException error) {
        this.isDisconnectNotification = isDisconnectNotification;
        this.error = error;
        invocationCount.incrementAndGet();
@@ -93,7 +93,7 @@
        return isDisconnectNotification;
    }
    public ErrorResultException getError() {
    public LdapException getError() {
        return error;
    }
opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -167,12 +167,12 @@
        final ConnectionFactory factory = mock(ConnectionFactory.class);
        try {
            when(factory.getConnection()).thenReturn(first, remaining);
        } catch (ErrorResultException ignored) {
        } catch (LdapException ignored) {
            // Cannot happen.
        }
        when(factory.getConnectionAsync()).thenAnswer(new Answer<Promise<Connection, ErrorResultException>>() {
        when(factory.getConnectionAsync()).thenAnswer(new Answer<Promise<Connection, LdapException>>() {
            @Override
            public Promise<Connection, ErrorResultException> answer(final InvocationOnMock invocation)
            public Promise<Connection, LdapException> answer(final InvocationOnMock invocation)
                    throws Throwable {
                return newSuccessfulFutureResult(factory.getConnection());
            }
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldap.schema;
@@ -35,7 +35,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy.EntryResolver;
import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy.Action;
@@ -1109,9 +1109,9 @@
    private EntryResolver newResolver(final Entry e) {
        return new EntryResolver() {
            public Entry getEntry(final DN dn) throws ErrorResultException {
            public Entry getEntry(final DN dn) throws LdapException {
                if (e == null) {
                    throw ErrorResultException.newErrorResult(ResultCode.NO_SUCH_OBJECT,
                    throw LdapException.newErrorResult(ResultCode.NO_SUCH_OBJECT,
                            "no such entry " + dn.toString());
                }
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -36,7 +36,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.FutureResultWrapper;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
@@ -1992,7 +1992,7 @@
        };
        // Send a search entry result promise :
        Promise<SearchResultEntry, ErrorResultException> promise =
        Promise<SearchResultEntry, LdapException> promise =
                newSuccessfulPromise(Responses.newSearchResultEntry(entry));
        FutureResult<SearchResultEntry> result = FutureResultWrapper.asFutureResult(promise);
        when(connection.searchSingleEntryAsync((SearchRequest) any())).thenReturn(result);
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
@@ -32,7 +32,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.FutureResultWrapper;
import org.forgerock.opendj.ldap.requests.SearchRequest;
@@ -83,7 +83,7 @@
        };
        // Send a search entry result promise :
        Promise<SearchResultEntry, ErrorResultException> promise =
        Promise<SearchResultEntry, LdapException> promise =
                newSuccessfulPromise(Responses.newSearchResultEntry(entry));
        FutureResult<SearchResultEntry> result = FutureResultWrapper.asFutureResult(promise);
        when(connection.searchSingleEntryAsync((SearchRequest) any())).thenReturn(result);
opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java
@@ -29,12 +29,12 @@
import java.net.InetSocketAddress;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPOptions;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.util.promise.Promise;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.util.promise.Promises.*;
import static org.mockito.Mockito.*;
@@ -69,7 +69,7 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        try {
            return getConnectionAsync().getOrThrow();
        } catch (final InterruptedException e) {
@@ -78,7 +78,7 @@
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        return newSuccessfulPromise(mock(Connection.class));
    }
opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java
@@ -21,12 +21,12 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013 ForgeRock AS.
 *      Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.spi;
import static org.fest.assertions.Assertions.assertThat;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import static org.forgerock.opendj.ldap.responses.Responses.newGenericExtendedResult;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.doAnswer;
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.verifyNoMoreInteractions;
import org.forgerock.opendj.ldap.ConnectionEventListener;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.ExtendedResult;
import org.mockito.invocation.InvocationOnMock;
@@ -48,8 +48,8 @@
 */
@SuppressWarnings("javadoc")
public class ConnectionStateTest extends LDAPTestCase {
    private static final ErrorResultException ERROR = newErrorResult(ResultCode.OTHER);
    private static final ErrorResultException LATE_ERROR = newErrorResult(ResultCode.BUSY);
    private static final LdapException ERROR = newErrorResult(ResultCode.OTHER);
    private static final LdapException LATE_ERROR = newErrorResult(ResultCode.BUSY);
    private static final ExtendedResult UNSOLICITED =
            newGenericExtendedResult(ResultCode.OPERATIONS_ERROR);
opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java
@@ -22,24 +22,17 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldif;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.IOException;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.DeleteRequest;
@@ -52,6 +45,10 @@
import org.testng.Assert;
import org.testng.annotations.Test;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
/**
 * This class tests the ConnectionChangeRecordWriter functionality.
 */
@@ -237,31 +234,28 @@
    /**
     * ConnectionChangeRecordWriter writes a ChangeRecord and an
     * ErrorResultIOException occurs on the ChangeAccept call.
     * LdapException occurs on the ChangeAccept call.
     *
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @Test(expectedExceptions = ErrorResultIOException.class)
    public final void testWriteChangeRecordChangeAcceptSendErrorResultIOException()
            throws Exception {
    @Test(expectedExceptions = LdapException.class)
    public final void testWriteChangeRecordChangeAcceptSendLdapException() throws Exception {
        Connection connection = mock(Connection.class);
        ConnectionChangeRecordWriter writer = null;
        ChangeRecord cr = mock(ChangeRecord.class);
        when(cr.accept(any(ChangeRecordVisitor.class), any(ConnectionChangeRecordWriter.class)))
                .thenAnswer(new Answer<ErrorResultIOException>() {
                .thenAnswer(new Answer<LdapException>() {
                    @Override
                    public ErrorResultIOException answer(final InvocationOnMock invocation)
                            throws Throwable {
                    public LdapException answer(final InvocationOnMock invocation) throws Throwable {
                        // Execute handler and return future.
                        final ChangeRecordVisitor<?, ?> handler =
                                (ChangeRecordVisitor<?, ?>) invocation.getArguments()[0];
                        if (handler != null) {
                            // Data here if needed.
                        }
                        return new ErrorResultIOException(ErrorResultException
                                .newErrorResult(ResultCode.UNAVAILABLE_CRITICAL_EXTENSION));
                        return newErrorResult(ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);
                    }
                });
opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java
@@ -21,15 +21,14 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2011 ForgeRock AS
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.ldif;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import static org.forgerock.opendj.ldap.responses.Responses.newResult;
import static org.forgerock.opendj.ldap.responses.Responses.newSearchResultEntry;
import static org.forgerock.opendj.ldap.responses.Responses.newSearchResultReference;
@@ -41,9 +40,9 @@
import java.util.NoSuchElementException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.FutureResultWrapper;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchResultHandler;
import org.forgerock.opendj.ldap.SearchResultReferenceIOException;
@@ -79,8 +78,8 @@
        try {
            reader.hasNext();
            fail();
        } catch (final ErrorResultIOException e) {
            assertThat(e.getCause().getResult()).isSameAs(ERROR);
        } catch (final LdapException e) {
            assertThat(e.getResult()).isSameAs(ERROR);
        } finally {
            reader.close();
        }
@@ -107,8 +106,8 @@
        try {
            reader.readEntry();
            fail();
        } catch (final ErrorResultIOException e) {
            assertThat(e.getCause().getResult()).isSameAs(ERROR);
        } catch (final LdapException e) {
            assertThat(e.getResult()).isSameAs(ERROR);
        } finally {
            reader.close();
        }
@@ -197,8 +196,8 @@
        try {
            reader.readReference();
            fail();
        } catch (final ErrorResultIOException e) {
            assertThat(e.getCause().getResult()).isSameAs(ERROR);
        } catch (final LdapException e) {
            assertThat(e.getResult()).isSameAs(ERROR);
        } finally {
            reader.close();
        }
@@ -231,8 +230,8 @@
        try {
            reader.readResult();
            fail();
        } catch (final ErrorResultIOException e) {
            assertThat(e.getCause().getResult()).isSameAs(ERROR);
        } catch (final LdapException e) {
            assertThat(e.getResult()).isSameAs(ERROR);
        } finally {
            reader.close();
        }
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java
@@ -22,13 +22,13 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.grizzly;
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.glassfish.grizzly.AbstractTransformer;
import org.glassfish.grizzly.Buffer;
import org.glassfish.grizzly.TransformationResult;
@@ -73,7 +73,7 @@
            try {
                final Buffer output = Buffers.wrap(memoryManager, layer.unwrap(buffer, 0, len));
                return TransformationResult.createCompletedResult(output, input);
            } catch (final ErrorResultException e) {
            } catch (final LdapException e) {
                return TransformationResult.createErrorResult(e.getResult().getResultCode()
                        .intValue(), e.getMessage());
            }
@@ -112,7 +112,7 @@
            try {
                final Buffer output = Buffers.wrap(memoryManager, layer.wrap(buffer, 0, len));
                return TransformationResult.createCompletedResult(output, input);
            } catch (final ErrorResultException e) {
            } catch (final LdapException e) {
                return TransformationResult.createErrorResult(e.getResult().getResultCode()
                        .intValue(), e.getMessage());
            }
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java
@@ -44,7 +44,7 @@
import org.forgerock.opendj.ldap.AbstractAsynchronousConnection;
import org.forgerock.opendj.ldap.ConnectionEventListener;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.LDAPOptions;
@@ -84,7 +84,7 @@
import org.glassfish.grizzly.ssl.SSLEngineConfigurator;
import org.glassfish.grizzly.ssl.SSLFilter;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.LdapException.newErrorResult;
import static org.forgerock.opendj.ldap.FutureResultWrapper.*;
import static com.forgerock.opendj.grizzly.GrizzlyMessages.*;
@@ -159,7 +159,7 @@
                 */
                checkBindOrStartTLSInProgress();
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            return newFailedFutureResult(e);
        }
@@ -226,7 +226,7 @@
                pendingRequests.remove(messageID);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -269,7 +269,7 @@
            // FIXME: Is this the best result code?
            final Result errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_LOCAL_ERROR)
                    .setDiagnosticMessage("An error occurred while creating a bind context").setCause(e);
            final ErrorResultException error = ErrorResultException.newErrorResult(errorResult);
            final LdapException error = LdapException.newErrorResult(errorResult);
            return newFailedFutureResult(error, messageID);
        }
@@ -309,7 +309,7 @@
                bindOrStartTLSInProgress.set(false);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
@@ -348,7 +348,7 @@
                pendingRequests.remove(messageID);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -378,7 +378,7 @@
                pendingRequests.remove(messageID);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -425,7 +425,7 @@
                bindOrStartTLSInProgress.set(false);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -469,7 +469,7 @@
                pendingRequests.remove(messageID);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -499,7 +499,7 @@
                pendingRequests.remove(messageID);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -540,7 +540,7 @@
                pendingRequests.remove(messageID);
                throw adaptRequestIOException(e);
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            future.adaptErrorResult(e.getResult());
        }
        return future;
@@ -712,8 +712,7 @@
        }
    }
    int continuePendingBindRequest(final LDAPBindFutureResultImpl future)
            throws ErrorResultException {
    int continuePendingBindRequest(final LDAPBindFutureResultImpl future) throws LdapException {
        final int newMsgID = nextMsgID.getAndIncrement();
        synchronized (stateLock) {
            checkConnectionIsValid();
@@ -800,7 +799,7 @@
        }
    }
    private ErrorResultException adaptRequestIOException(final IOException e) {
    private LdapException adaptRequestIOException(final IOException e) {
        // FIXME: what other sort of IOExceptions can be thrown?
        // FIXME: Is this the best result code?
        final Result errorResult = Responses.newResult(ResultCode.CLIENT_SIDE_ENCODING_ERROR).setCause(e);
@@ -808,13 +807,13 @@
        return newErrorResult(errorResult);
    }
    private void checkBindOrStartTLSInProgress() throws ErrorResultException {
    private void checkBindOrStartTLSInProgress() throws LdapException {
        if (bindOrStartTLSInProgress.get()) {
            throw newErrorResult(ResultCode.OPERATIONS_ERROR, "Bind or Start TLS operation in progress");
        }
    }
    private void checkConnectionIsValid() throws ErrorResultException {
    private void checkConnectionIsValid() throws LdapException {
        if (!isValid0()) {
            if (failedDueToDisconnect) {
                /*
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.grizzly;
@@ -38,7 +38,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResultImpl;
import org.forgerock.opendj.ldap.LDAPOptions;
import org.forgerock.opendj.ldap.ResultCode;
@@ -62,7 +62,7 @@
import static org.forgerock.opendj.grizzly.DefaultTCPNIOTransport.*;
import static org.forgerock.opendj.grizzly.GrizzlyUtils.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.TimeoutChecker.*;
import static com.forgerock.opendj.grizzly.GrizzlyMessages.*;
@@ -129,9 +129,9 @@
                    public void handleResult(final ExtendedResult result) {
                        onSuccess(connection);
                    }
                }).onFailure(new FailureHandler<ErrorResultException>() {
                }).onFailure(new FailureHandler<LdapException>() {
                    @Override
                    public void handleError(final ErrorResultException error) {
                    public void handleError(final LdapException error) {
                        onFailure(connection, error);
                    }
                });
@@ -181,13 +181,13 @@
            return ldapConnection;
        }
        private ErrorResultException adaptConnectionException(Throwable t) {
            if (!(t instanceof ErrorResultException) && t instanceof ExecutionException) {
        private LdapException adaptConnectionException(Throwable t) {
            if (!(t instanceof LdapException) && t instanceof ExecutionException) {
                t = t.getCause() != null ? t.getCause() : t;
            }
            if (t instanceof ErrorResultException) {
                return (ErrorResultException) t;
            if (t instanceof LdapException) {
                return (LdapException) t;
            } else {
                return newErrorResult(ResultCode.CLIENT_SIDE_CONNECT_ERROR, t.getMessage(), t);
            }
@@ -300,7 +300,7 @@
    }
    @Override
    public Connection getConnection() throws ErrorResultException {
    public Connection getConnection() throws LdapException {
        try {
            return getConnectionAsync().getOrThrow();
        } catch (final InterruptedException e) {
@@ -309,7 +309,7 @@
    }
    @Override
    public Promise<Connection, ErrorResultException> getConnectionAsync() {
    public Promise<Connection, LdapException> getConnectionAsync() {
        acquireTransportAndTimeoutChecker(); // Protect resources.
        final SocketConnectorHandler connectorHandler =
                TCPNIOConnectorHandler.builder(transport.get()).processor(defaultFilterChain)
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2013 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.grizzly;
@@ -39,7 +39,7 @@
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.AddRequest;
import org.forgerock.opendj.ldap.requests.BindClient;
@@ -163,7 +163,7 @@
                                }
                                return;
                            }
                        } catch (final ErrorResultException e) {
                        } catch (final LdapException e) {
                            ldapConnection.setBindOrStartTLSInProgress(false);
                            future.adaptErrorResult(e.getResult());
                            return;
opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2012-2014 ForgeRock AS.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.grizzly;
@@ -46,7 +46,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConnectionSecurityLayer;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.LDAPClientContext;
import org.forgerock.opendj.ldap.LDAPListenerOptions;
@@ -207,7 +207,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            handleResult(error.getResult());
        }
@@ -224,7 +224,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            final Result result = error.getResult();
            if (result instanceof BindResult) {
                handleResult((BindResult) result);
@@ -458,7 +458,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            final Result result = error.getResult();
            if (result instanceof CompareResult) {
                handleResult((CompareResult) result);
@@ -483,7 +483,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            handleResult(error.getResult());
        }
@@ -500,7 +500,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            final Result result = error.getResult();
            if (result instanceof ExtendedResult) {
                handleResult((ExtendedResult) result);
@@ -540,7 +540,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            handleResult(error.getResult());
        }
@@ -557,7 +557,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            handleResult(error.getResult());
        }
@@ -586,7 +586,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            handleResult(error.getResult());
        }
@@ -843,7 +843,7 @@
                    listener.getConnectionFactory().handleAccept(clientContext);
            clientContext.setServerConnection(serverConn);
            LDAP_CONNECTION_ATTR.set(connection, clientContext);
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            connection.close();
        }
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.grizzly;
@@ -45,7 +45,7 @@
import org.forgerock.opendj.ldap.ConnectionPool;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FailoverLoadBalancingAlgorithm;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
@@ -87,7 +87,7 @@
import static org.fest.assertions.Assertions.*;
import static org.forgerock.opendj.ldap.Connections.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.FutureResultWrapper.*;
import static org.forgerock.opendj.ldap.TestCaseUtils.*;
import static org.mockito.Matchers.*;
@@ -262,7 +262,7 @@
     */
    @Test(dataProvider = "connectionFactories", timeOut = TEST_TIMEOUT_MS)
    public void testBlockingFutureNoHandler(ConnectionFactory factory) throws Exception {
        final Promise<? extends Connection, ErrorResultException> promise = factory.getConnectionAsync();
        final Promise<? extends Connection, LdapException> promise = factory.getConnectionAsync();
        final Connection con = promise.get();
        // quickly check if it is a valid connection.
        // Don't use a result handler.
@@ -278,7 +278,7 @@
    @Test(dataProvider = "connectionFactories", timeOut = TEST_TIMEOUT_MS)
    public void testNonBlockingFutureWithHandler(ConnectionFactory factory) throws Exception {
        // Use the handler to get the result asynchronously.
        final PromiseImpl<Connection, ErrorResultException> promise = PromiseImpl.create();
        final PromiseImpl<Connection, LdapException> promise = PromiseImpl.create();
        factory.getConnectionAsync().onSuccess(new SuccessHandler<Connection>() {
            @Override
@@ -286,10 +286,10 @@
                con.close();
                promise.handleResult(con);
            }
        }).onFailure(new FailureHandler<ErrorResultException>() {
        }).onFailure(new FailureHandler<LdapException>() {
            @Override
            public void handleError(ErrorResultException error) {
            public void handleError(LdapException error) {
                promise.handleError(error);
            }
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java
@@ -37,7 +37,7 @@
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.LDAPClientContext;
@@ -126,8 +126,8 @@
                new LDAPOptions().setConnectTimeout(1, TimeUnit.MILLISECONDS));
        try {
            for (int i = 0; i < ITERATIONS; i++) {
                final PromiseImpl<ErrorResultException, NeverThrowsException> promise = PromiseImpl.create();
                final Promise<? extends Connection, ErrorResultException> future = factory.getConnectionAsync();
                final PromiseImpl<LdapException, NeverThrowsException> promise = PromiseImpl.create();
                final Promise<? extends Connection, LdapException> future = factory.getConnectionAsync();
                future.onFailure(getFailureHandler(promise));
                ConnectionException e = (ConnectionException) promise.getOrThrow(TEST_TIMEOUT, TimeUnit.SECONDS);
@@ -163,7 +163,7 @@
            waitForConnect();
            final MockConnectionEventListener listener = new MockConnectionEventListener();
            connection.addConnectionEventListener(listener);
            final PromiseImpl<ErrorResultException, NeverThrowsException> promise = PromiseImpl.create();
            final PromiseImpl<LdapException, NeverThrowsException> promise = PromiseImpl.create();
            final FutureResult<BindResult> future = connection.bindAsync(newSimpleBindRequest());
            future.onFailure(getFailureHandler(promise));
            waitForBind();
@@ -213,7 +213,7 @@
                connection.addConnectionEventListener(listener);
                // Now bind with timeout.
                final PromiseImpl<ErrorResultException, NeverThrowsException> promise = PromiseImpl.create();
                final PromiseImpl<LdapException, NeverThrowsException> promise = PromiseImpl.create();
                final FutureResult<BindResult> future = connection.bindAsync(newSimpleBindRequest());
                future.onFailure(getFailureHandler(promise));
                waitForBind();
@@ -266,12 +266,12 @@
                waitForConnect();
                final ConnectionEventListener listener = mock(ConnectionEventListener.class);
                connection.addConnectionEventListener(listener);
                final PromiseImpl<ErrorResultException, NeverThrowsException> promise = PromiseImpl.create();
                final PromiseImpl<LdapException, NeverThrowsException> promise = PromiseImpl.create();
                final FutureResult<SearchResultEntry> future = connection.readEntryAsync(DN.valueOf("cn=test"), null);
                future.onFailure(getFailureHandler(promise));
                waitForSearch();
                ErrorResultException e = promise.getOrThrow(TEST_TIMEOUT, TimeUnit.SECONDS);
                LdapException e = promise.getOrThrow(TEST_TIMEOUT, TimeUnit.SECONDS);
                verifyResultCodeIsClientSideTimeout(e);
                // Wait for the request to timeout.
                try {
@@ -355,7 +355,7 @@
                    new ServerConnectionFactory<LDAPClientContext, Integer>() {
                        @Override
                        public ServerConnection<Integer> handleAccept(
                                final LDAPClientContext clientContext) throws ErrorResultException {
                                final LDAPClientContext clientContext) throws LdapException {
                            context.set(clientContext);
                            connectLatch.release();
                            return serverConnection;
@@ -367,11 +367,11 @@
        }
    }
    private FailureHandler<ErrorResultException> getFailureHandler(
            final PromiseImpl<ErrorResultException, NeverThrowsException> promise) {
        return new FailureHandler<ErrorResultException>() {
    private FailureHandler<LdapException> getFailureHandler(
            final PromiseImpl<LdapException, NeverThrowsException> promise) {
        return new FailureHandler<LdapException>() {
            @Override
            public void handleError(ErrorResultException error) {
            public void handleError(LdapException error) {
                promise.handleResult(error);
            }
        };
@@ -423,7 +423,7 @@
                any(AbandonRequest.class));
    }
    private void verifyResultCodeIsClientSideTimeout(ErrorResultException error) {
    private void verifyResultCodeIsClientSideTimeout(LdapException error) {
        assertThat(error.getResult().getResultCode()).isEqualTo(ResultCode.CLIENT_SIDE_TIMEOUT);
    }
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java
@@ -35,7 +35,7 @@
import java.util.concurrent.TimeUnit;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LDAPListener;
import org.forgerock.opendj.ldap.LDAPOptions;
@@ -103,7 +103,7 @@
            }
            SearchResultHandler searchHandler = mock(SearchResultHandler.class);
            @SuppressWarnings("unchecked")
            FailureHandler<ErrorResultException> failureHandler = mock(FailureHandler.class);
            FailureHandler<LdapException> failureHandler = mock(FailureHandler.class);
            connection.searchAsync(request, searchHandler).onFailure(failureHandler);
            // Pass in a time which is guaranteed to trigger expiration.
@@ -111,8 +111,7 @@
            if (isPersistentSearch) {
                verifyZeroInteractions(searchHandler);
            } else {
                ArgumentCaptor<ErrorResultException> arg =
                        ArgumentCaptor.forClass(ErrorResultException.class);
                ArgumentCaptor<LdapException> arg = ArgumentCaptor.forClass(LdapException.class);
                verify(failureHandler).handleError(arg.capture());
                assertThat(arg.getValue()).isInstanceOf(TimeoutResultException.class);
                assertThat(arg.getValue().getResult().getResultCode()).isEqualTo(
opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package org.forgerock.opendj.grizzly;
@@ -37,7 +37,7 @@
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResultImpl;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.LDAPClientContext;
@@ -175,7 +175,7 @@
                final ExtendedRequest<R> request,
                final IntermediateResponseHandler intermediateResponseHandler,
                final ResultHandler<R> resultHandler) throws UnsupportedOperationException {
            resultHandler.handleError(ErrorResultException.newErrorResult(request
            resultHandler.handleError(LdapException.newErrorResult(request
                    .getResultDecoder().newExtendedErrorResult(ResultCode.PROTOCOL_ERROR, "",
                            "Extended operation " + request.getOID() + " not supported")));
        }
@@ -225,8 +225,7 @@
         * {@inheritDoc}
         */
        @Override
        public ServerConnection<Integer> handleAccept(final LDAPClientContext clientContext)
                throws ErrorResultException {
        public ServerConnection<Integer> handleAccept(final LDAPClientContext clientContext) throws LdapException {
            serverConnection.context.handleResult(clientContext);
            return serverConnection;
        }
@@ -362,7 +361,7 @@
                        @Override
                        public ServerConnection<Integer> handleAccept(
                                final LDAPClientContext clientContext) throws ErrorResultException {
                                final LDAPClientContext clientContext) throws LdapException {
                            // Get connection from load balancer, this should
                            // fail over twice before getting connection to
                            // online server.
@@ -454,7 +453,7 @@
                        resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
                    } catch (final Exception e) {
                        // Unexpected.
                        resultHandler.handleError(ErrorResultException.newErrorResult(
                        resultHandler.handleError(LdapException.newErrorResult(
                                ResultCode.OTHER,
                                "Unexpected exception when connecting to load balancer", e));
                    }
@@ -514,7 +513,7 @@
                        @Override
                        public ServerConnection<Integer> handleAccept(
                                final LDAPClientContext clientContext) throws ErrorResultException {
                                final LDAPClientContext clientContext) throws LdapException {
                            // First attempt offline server.
                            InetSocketAddress offlineAddress = findFreeSocketAddress();
                            LDAPConnectionFactory lcf =
@@ -523,7 +522,7 @@
                            try {
                                // This is expected to fail.
                                lcf.getConnection().close();
                                throw ErrorResultException.newErrorResult(ResultCode.OTHER,
                                throw LdapException.newErrorResult(ResultCode.OTHER,
                                        "Connection to offline server succeeded unexpectedly");
                            } catch (final ConnectionException ce) {
                                // This is expected - so go to online server.
@@ -535,16 +534,14 @@
                                    lcf.getConnection().close();
                                } catch (final Exception e) {
                                    // Unexpected.
                                    throw ErrorResultException
                                            .newErrorResult(
                                    throw LdapException.newErrorResult(
                                                    ResultCode.OTHER,
                                                    "Unexpected exception when connecting to online server",
                                                    e);
                                }
                            } catch (final Exception e) {
                                // Unexpected.
                                throw ErrorResultException
                                        .newErrorResult(
                                throw LdapException.newErrorResult(
                                                ResultCode.OTHER,
                                                "Unexpected exception when connecting to offline server",
                                                e);
@@ -611,7 +608,7 @@
                    try {
                        // This is expected to fail.
                        lcf.getConnection().close();
                        resultHandler.handleError(ErrorResultException.newErrorResult(
                        resultHandler.handleError(LdapException.newErrorResult(
                                ResultCode.OTHER,
                                "Connection to offline server succeeded unexpectedly"));
                    } catch (final ConnectionException ce) {
@@ -623,13 +620,13 @@
                            resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
                        } catch (final Exception e) {
                            // Unexpected.
                            resultHandler.handleError(ErrorResultException.newErrorResult(
                            resultHandler.handleError(LdapException.newErrorResult(
                                    ResultCode.OTHER,
                                    "Unexpected exception when connecting to online server", e));
                        }
                    } catch (final Exception e) {
                        // Unexpected.
                        resultHandler.handleError(ErrorResultException.newErrorResult(
                        resultHandler.handleError(LdapException.newErrorResult(
                                ResultCode.OTHER,
                                "Unexpected exception when connecting to offline server", e));
                    }
@@ -703,7 +700,7 @@
            try {
                connection.bind("cn=test", password2);
                fail("Big bind unexpectedly succeeded");
            } catch (final ErrorResultException e) {
            } catch (final LdapException e) {
                // Expected exception.
                assertThat(e.getResult().getResultCode()).isEqualTo(
                        ResultCode.CLIENT_SIDE_SERVER_DOWN);
@@ -743,7 +740,7 @@
            connection = new LDAPConnectionFactory(listener.getHostName(), listener.getPort()).getConnection();
            try {
                connection.bind("cn=test", "password".toCharArray());
            } catch (final ErrorResultException e) {
            } catch (final LdapException e) {
                connection.close();
                throw e;
            }
@@ -767,7 +764,7 @@
        try {
            connection.bind("cn=test", "password".toCharArray());
            fail("Bind attempt on closed connection succeeded unexpectedly");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            // Expected.
            assertThat(connection.isValid()).isFalse();
            assertThat(connection.isClosed()).isFalse();
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Controls.java
@@ -34,8 +34,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ModificationType;
@@ -146,7 +145,7 @@
            //useSubtreeDeleteRequestControl(connection);
            //useVirtualListViewRequestControl(connection);
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
@@ -170,10 +169,9 @@
     * and expects entries under {@code dc=example,dc=com}.
     *
     * @param connection Active connection to Active Directory server.
     * @throws ErrorResultException Operation failed.
     * @throws LdapException Operation failed.
     */
    static void useADNotificationRequestControl(Connection connection)
            throws ErrorResultException {
    static void useADNotificationRequestControl(Connection connection) throws LdapException {
        // --- JCite ADNotification ---
        final String user = "cn=Administrator,cn=users,dc=example,dc=com";
@@ -233,9 +231,9 @@
                    reader.readReference(); // Read and ignore reference
                }
            }
        } catch (final ErrorResultIOException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getCause().getResult().getResultCode().intValue());
            System.exit(e.getResult().getResultCode().intValue());
        } catch (final SearchResultReferenceIOException e) {
            System.err.println("Got search reference(s): " + e.getReference()
                    .getURIs().toString());
@@ -254,10 +252,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useAssertionControl(Connection connection) throws ErrorResultException {
    static void useAssertionControl(Connection connection) throws LdapException {
        // --- JCite assertion ---
        if (isSupported(AssertionRequestControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -292,10 +290,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useAuthorizationIdentityRequestControl(Connection connection) throws ErrorResultException {
    static void useAuthorizationIdentityRequestControl(Connection connection) throws LdapException {
        // --- JCite authzid ---
        if (isSupported(AuthorizationIdentityRequestControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -331,10 +329,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useGetEffectiveRightsRequestControl(Connection connection) throws ErrorResultException {
    static void useGetEffectiveRightsRequestControl(Connection connection) throws LdapException {
        // --- JCite effective rights ---
        if (isSupported(GetEffectiveRightsRequestControl.OID)) {
            final String authDN = "uid=kvaughan,ou=People,dc=example,dc=com";
@@ -356,9 +354,9 @@
                    }
                }
                writer.close();
            } catch (final ErrorResultIOException e) {
            } catch (final LdapException e) {
                System.err.println(e.getMessage());
                System.exit(e.getCause().getResult().getResultCode().intValue());
                System.exit(e.getResult().getResultCode().intValue());
            } catch (final SearchResultReferenceIOException e) {
                System.err.println("Got search reference(s): " + e.getReference()
                        .getURIs().toString());
@@ -380,10 +378,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useManageDsaITRequestControl(Connection connection) throws ErrorResultException {
    static void useManageDsaITRequestControl(Connection connection) throws LdapException {
        // --- JCite manage DsaIT ---
        if (isSupported(ManageDsaITRequestControl.OID)) {
            final String dn = "dc=ref,dc=com";
@@ -406,9 +404,9 @@
                final SearchResultEntry entry = connection.searchSingleEntry(request);
                writer.writeEntry(entry);
                writer.close();
            } catch (final ErrorResultIOException e) {
            } catch (final LdapException e) {
                System.err.println(e.getMessage());
                System.exit(e.getCause().getResult().getResultCode().intValue());
                System.exit(e.getResult().getResultCode().intValue());
            } catch (final SearchResultReferenceIOException e) {
                System.err.println("Got search reference(s): " + e.getReference()
                        .getURIs().toString());
@@ -430,10 +428,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useMatchedValuesRequestControl(Connection connection) throws ErrorResultException {
    static void useMatchedValuesRequestControl(Connection connection) throws LdapException {
        // --- JCite matched values ---
        if (isSupported(MatchedValuesRequestControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -477,7 +475,7 @@
            try {
                connection.bind(dn, pwd);
            } catch (final ErrorResultException e) {
            } catch (final LdapException e) {
                final Result result = e.getResult();
                try {
                    final PasswordExpiredResponseControl control =
@@ -507,10 +505,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void usePasswordExpiringResponseControl(Connection connection) throws ErrorResultException {
    static void usePasswordExpiringResponseControl(Connection connection) throws LdapException {
        // --- JCite password expiring ---
        if (isSupported(PasswordExpiringResponseControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -566,7 +564,7 @@
                            + control.getWarningType().toString() + ", value "
                            + control.getWarningValue() + " for " + dn);
                }
            } catch (final ErrorResultException e) {
            } catch (final LdapException e) {
                final Result result = e.getResult();
                try {
                    final PasswordPolicyResponseControl control =
@@ -598,10 +596,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void usePermissiveModifyRequestControl(Connection connection) throws ErrorResultException {
    static void usePermissiveModifyRequestControl(Connection connection) throws LdapException {
        // --- JCite permissive modify ---
        if (isSupported(PermissiveModifyRequestControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -632,10 +630,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void usePersistentSearchRequestControl(Connection connection) throws ErrorResultException {
    static void usePersistentSearchRequestControl(Connection connection) throws LdapException {
        // --- JCite psearch ---
        if (isSupported(PersistentSearchRequestControl.OID)) {
            final SearchRequest request =
@@ -675,9 +673,9 @@
            } catch (final DecodeException e) {
                System.err.println(e.getMessage());
                System.exit(ResultCode.CLIENT_SIDE_DECODING_ERROR.intValue());
            } catch (final ErrorResultIOException e) {
            } catch (final LdapException e) {
                System.err.println(e.getMessage());
                System.exit(e.getCause().getResult().getResultCode().intValue());
                System.exit(e.getResult().getResultCode().intValue());
            } catch (final SearchResultReferenceIOException e) {
                System.err.println("Got search reference(s): " + e.getReference()
                        .getURIs().toString());
@@ -696,10 +694,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void usePostReadRequestControl(Connection connection) throws ErrorResultException {
    static void usePostReadRequestControl(Connection connection) throws LdapException {
        // --- JCite post read ---
        if (isSupported(PostReadRequestControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -740,10 +738,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void usePreReadRequestControl(Connection connection) throws ErrorResultException {
    static void usePreReadRequestControl(Connection connection) throws LdapException {
        // --- JCite pre read ---
        if (isSupported(PreReadRequestControl.OID)) {
            final String dn = "uid=bjensen,ou=People,dc=example,dc=com";
@@ -784,10 +782,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useProxiedAuthV2RequestControl(Connection connection) throws ErrorResultException {
    static void useProxiedAuthV2RequestControl(Connection connection) throws LdapException {
        // --- JCite proxied authzv2 ---
        if (isSupported(ProxiedAuthV2RequestControl.OID)) {
            final String bindDN = "cn=My App,ou=Apps,dc=example,dc=com";
@@ -825,12 +823,11 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    // --- JCite server-side sort ---
    static void useServerSideSortRequestControl(Connection connection)
            throws ErrorResultException {
    static void useServerSideSortRequestControl(Connection connection) throws LdapException {
        if (isSupported(ServerSideSortRequestControl.OID)) {
            final SearchRequest request =
                    Requests.newSearchRequest("ou=People,dc=example,dc=com",
@@ -889,10 +886,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useSimplePagedResultsControl(Connection connection) throws ErrorResultException {
    static void useSimplePagedResultsControl(Connection connection) throws LdapException {
        // --- JCite simple paged results ---
        if (isSupported(SimplePagedResultsControl.OID)) {
            ByteString cookie = ByteString.empty();
@@ -936,10 +933,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useSubentriesRequestControl(Connection connection) throws ErrorResultException {
    static void useSubentriesRequestControl(Connection connection) throws LdapException {
        // --- JCite subentries ---
        if (isSupported(SubentriesRequestControl.OID)) {
            final SearchRequest request =
@@ -959,9 +956,9 @@
                    }
                }
                writer.close();
            } catch (final ErrorResultIOException e) {
            } catch (final LdapException e) {
                System.err.println(e.getMessage());
                System.exit(e.getCause().getResult().getResultCode().intValue());
                System.exit(e.getResult().getResultCode().intValue());
            } catch (final SearchResultReferenceIOException e) {
                System.err.println("Got search reference(s): " + e.getReference()
                        .getURIs().toString());
@@ -982,10 +979,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useSubtreeDeleteRequestControl(Connection connection) throws ErrorResultException {
    static void useSubtreeDeleteRequestControl(Connection connection) throws LdapException {
        // --- JCite tree delete ---
        if (isSupported(SubtreeDeleteRequestControl.OID)) {
@@ -1019,10 +1016,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useVirtualListViewRequestControl(Connection connection) throws ErrorResultException {
    static void useVirtualListViewRequestControl(Connection connection) throws LdapException {
        // --- JCite vlv ---
        if (isSupported(VirtualListViewRequestControl.OID)) {
            ByteString contextID = ByteString.empty();
@@ -1079,11 +1076,10 @@
     *
     * @param connection
     *            Active connection to the LDAP server.
     * @throws ErrorResultException
     * @throws LdapException
     *             Failed to get list of controls.
     */
    static void checkSupportedControls(Connection connection)
            throws ErrorResultException {
    static void checkSupportedControls(Connection connection) throws LdapException {
        controls = RootDSE.readRootDSE(connection).getSupportedControls();
    }
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ExtendedOperations.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2012 ForgeRock AS
 *      Copyright 2012-2014 ForgeRock AS
 *
 */
@@ -29,7 +29,7 @@
import java.util.Collection;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.RootDSE;
import org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest;
@@ -85,7 +85,7 @@
            // For StartTLS, see the authentication examples.
            useWhoAmIExtendedRequest(connection);
        } catch (ErrorResultException e) {
        } catch (LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
@@ -103,10 +103,10 @@
     *            Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void usePasswordModifyExtendedRequest(Connection connection) throws ErrorResultException {
    static void usePasswordModifyExtendedRequest(Connection connection) throws LdapException {
        // --- JCite password modify ---
        if (isSupported(PasswordModifyExtendedRequest.OID)) {
            final String userIdentity = "u:scarter";
@@ -138,10 +138,10 @@
     * @param connection Active connection to LDAP server containing <a
     *            href="http://opendj.forgerock.org/Example.ldif"
     *            >Example.ldif</a> content.
     * @throws ErrorResultException
     * @throws LdapException
     *             Operation failed.
     */
    static void useWhoAmIExtendedRequest(Connection connection) throws ErrorResultException {
    static void useWhoAmIExtendedRequest(Connection connection) throws LdapException {
        // --- JCite who am I ---
        if (isSupported(WhoAmIExtendedRequest.OID)) {
@@ -177,11 +177,10 @@
     *
     * @param connection
     *            Active connection to the LDAP server.
     * @throws ErrorResultException
     * @throws LdapException
     *             Failed to get list of extended operations.
     */
    static void checkSupportedExtendedOperations(Connection connection)
            throws ErrorResultException {
    static void checkSupportedExtendedOperations(Connection connection) throws LdapException {
        extendedOperations = RootDSE.readRootDSE(connection)
                .getSupportedExtendedOperations();
    }
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetADChangeNotifications.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -30,8 +30,7 @@
import java.io.IOException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -127,12 +126,9 @@
                            + ref.getURIs().toString());
                }
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
        } catch (final ErrorResultIOException e) {
            System.err.println(e.getMessage());
            System.exit(e.getCause().getResult().getResultCode().intValue());
        } catch (final IOException e) {
            System.err.println(e.getMessage());
            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetInfo.java
@@ -21,14 +21,14 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2012-2013 ForgeRock AS
 *      Copyright 2012-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
import java.io.IOException;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -90,7 +90,7 @@
                writer.writeEntry(entry);
            }
            writer.flush();
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Modify.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -33,7 +33,7 @@
import java.io.InputStream;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldif.ChangeRecord;
@@ -105,7 +105,7 @@
                System.err.println("Successfully modified entry "
                        + changeRecord.getName().toString());
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ParseAttributes.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2012-2013 ForgeRock AS
 *      Copyright 2012-2014 ForgeRock AS
 *
 */
@@ -34,7 +34,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.ModificationType;
@@ -119,7 +119,7 @@
            final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
            writer.writeEntry(newEntry);
            writer.close();
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
@@ -144,11 +144,11 @@
     *            DN of the entry to modify.
     * @param attributeDescription
     *            Attribute to modify. Must take a String value.
     * @throws ErrorResultException
     * @throws LdapException
     *             Modify failed.
     */
    private static void updateEntry(final Connection connection, final String name,
            final String attributeDescription) throws ErrorResultException {
            final String attributeDescription) throws LdapException {
        ModifyRequest request = Requests.newModifyRequest(name)
                .addModification(ModificationType.REPLACE, attributeDescription, "This is a String.");
        connection.modify(request);
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/PasswordResetForAD.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2013 ForgeRock AS
 *      Copyright 2013-2014 ForgeRock AS
 *
 */
@@ -28,7 +28,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LDAPOptions;
import org.forgerock.opendj.ldap.ModificationType;
@@ -132,7 +132,7 @@
            System.out.println("Successfully changed password for "
                    + targetDN + " to " + newPassword + ".");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
        } catch (final GeneralSecurityException e) {
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -33,7 +33,7 @@
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPClientContext;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LDAPListener;
@@ -122,8 +122,7 @@
        final RequestHandlerFactory<LDAPClientContext, RequestContext> proxyFactory =
                new RequestHandlerFactory<LDAPClientContext, RequestContext>() {
                    @Override
                    public ProxyBackend handleAccept(LDAPClientContext clientContext)
                            throws ErrorResultException {
                    public ProxyBackend handleAccept(LDAPClientContext clientContext) throws LdapException {
                        return new ProxyBackend(factory, bindFactory);
                    }
                };
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ProxyBackend.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.RequestContext;
import org.forgerock.opendj.ldap.RequestHandler;
@@ -58,7 +58,7 @@
import org.forgerock.util.promise.Promise;
import org.forgerock.util.promise.SuccessHandler;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.util.Utils.*;
/**
@@ -81,7 +81,7 @@
 * final RequestHandlerFactory&lt;LDAPClientContext, RequestContext&gt; proxyFactory =
 *     new RequestHandlerFactory&lt;LDAPClientContext, RequestContext&gt;() {
 *         &#064;Override
 *         public ProxyBackend handleAccept(LDAPClientContext clientContext) throws ErrorResultException {
 *         public ProxyBackend handleAccept(LDAPClientContext clientContext) throws LdapException {
 *             return new ProxyBackend(factory, bindFactory);
 *         }
 *     };
@@ -107,9 +107,9 @@
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        addProxiedAuthControl(request);
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(Connection connection) throws ErrorResultException {
            public Promise<Result, LdapException> apply(Connection connection) throws LdapException {
                connectionHolder.set(connection);
                return connection.addAsync(request, intermediateResponseHandler);
            }
@@ -131,10 +131,9 @@
            final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
            proxiedAuthControl = null;
            bindFactory.getConnectionAsync()
                    .thenAsync(new AsyncFunction<Connection, BindResult, ErrorResultException>() {
                    .thenAsync(new AsyncFunction<Connection, BindResult, LdapException>() {
                        @Override
                        public Promise<BindResult, ErrorResultException> apply(Connection connection)
                                throws ErrorResultException {
                        public Promise<BindResult, LdapException> apply(Connection connection) throws LdapException {
                            connectionHolder.set(connection);
                            return connection.bindAsync(request, intermediateResponseHandler);
                        }
@@ -157,10 +156,9 @@
        addProxiedAuthControl(request);
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, CompareResult, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, CompareResult, LdapException>() {
            @Override
            public Promise<CompareResult, ErrorResultException> apply(Connection connection)
                    throws ErrorResultException {
            public Promise<CompareResult, LdapException> apply(Connection connection) throws LdapException {
                connectionHolder.set(connection);
                return connection.compareAsync(request, intermediateResponseHandler);
            }
@@ -174,9 +172,9 @@
        addProxiedAuthControl(request);
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(Connection connection) throws ErrorResultException {
            public Promise<Result, LdapException> apply(Connection connection) throws LdapException {
                connectionHolder.set(connection);
                return connection.deleteAsync(request, intermediateResponseHandler);
            }
@@ -201,9 +199,9 @@
            addProxiedAuthControl(request);
            final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
            factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, R, ErrorResultException>() {
            factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, R, LdapException>() {
                @Override
                public Promise<R, ErrorResultException> apply(Connection connection) throws ErrorResultException {
                public Promise<R, LdapException> apply(Connection connection) throws LdapException {
                    connectionHolder.set(connection);
                    return connection.extendedRequestAsync(request, intermediateResponseHandler);
                }
@@ -219,9 +217,9 @@
        addProxiedAuthControl(request);
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(Connection connection) throws ErrorResultException {
            public Promise<Result, LdapException> apply(Connection connection) throws LdapException {
                connectionHolder.set(connection);
                return connection.modifyAsync(request, intermediateResponseHandler);
            }
@@ -235,9 +233,9 @@
        addProxiedAuthControl(request);
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(Connection connection) throws ErrorResultException {
            public Promise<Result, LdapException> apply(Connection connection) throws LdapException {
                connectionHolder.set(connection);
                return connection.modifyDNAsync(request, intermediateResponseHandler);
            }
@@ -252,9 +250,9 @@
        addProxiedAuthControl(request);
        final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(Connection connection) throws ErrorResultException {
            public Promise<Result, LdapException> apply(Connection connection) throws LdapException {
                connectionHolder.set(connection);
                return connection.searchAsync(request, intermediateResponseHandler, entryHandler);
            }
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -30,7 +30,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
@@ -109,7 +109,7 @@
                System.out.println("  " + m.toString());
            }
            System.out.println();
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/RewriterProxy.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -38,7 +38,7 @@
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.LDAPClientContext;
@@ -413,8 +413,7 @@
        final RequestHandlerFactory<LDAPClientContext, RequestContext> proxyFactory =
                new RequestHandlerFactory<LDAPClientContext, RequestContext>() {
                    @Override
                    public Rewriter handleAccept(final LDAPClientContext clientContext)
                            throws ErrorResultException {
                    public Rewriter handleAccept(final LDAPClientContext clientContext) throws LdapException {
                        return new Rewriter(new ProxyBackend(factory, bindFactory));
                    }
                };
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2011-2013 ForgeRock AS
 *      Copyright 2011-2014 ForgeRock AS
 */
/**
@@ -37,7 +37,7 @@
import javax.net.ssl.SSLContext;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LDAPOptions;
import org.forgerock.opendj.ldap.ResultCode;
@@ -95,7 +95,7 @@
                    .setAuthorizationID(authzid);
            connection.bind(request);
            System.out.println("Authenticated as " + authcid + ".");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -31,8 +31,7 @@
import java.util.Arrays;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -126,14 +125,10 @@
                }
            }
            writer.flush();
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
        } catch (final ErrorResultIOException e) {
            System.err.println(e.getMessage());
            System.exit(e.getCause().getResult().getResultCode().intValue());
            return;
        } catch (final IOException e) {
            System.err.println(e.getMessage());
            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -32,7 +32,7 @@
import java.util.concurrent.CountDownLatch;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.FutureResultWrapper;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
@@ -80,9 +80,9 @@
                            System.err.println("Cancel request succeeded");
                            CANCEL_LATCH.countDown();
                        }
                    }).onFailure(new FailureHandler<ErrorResultException>() {
                    }).onFailure(new FailureHandler<LdapException>() {
                        @Override
                        public void handleError(ErrorResultException error) {
                        public void handleError(LdapException error) {
                            System.err.println("Cancel request failed with result code: "
                                + error.getResult().getResultCode().intValue());
                            CANCEL_LATCH.countDown();
@@ -182,15 +182,15 @@
        // Initiate the asynchronous connect, bind, and search.
        final LDAPConnectionFactory factory = new LDAPConnectionFactory(hostName, port);
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, BindResult, ErrorResultException>() {
        factory.getConnectionAsync().thenAsync(new AsyncFunction<Connection, BindResult, LdapException>() {
            @Override
            public Promise<BindResult, ErrorResultException> apply(Connection connection) throws ErrorResultException {
            public Promise<BindResult, LdapException> apply(Connection connection) throws LdapException {
                SearchAsync.connection = connection;
                return connection.bindAsync(Requests.newSimpleBindRequest(userName, password.toCharArray()));
            }
        }).thenAsync(new AsyncFunction<BindResult, Result, ErrorResultException>() {
        }).thenAsync(new AsyncFunction<BindResult, Result, LdapException>() {
            @Override
            public Promise<Result, ErrorResultException> apply(BindResult result) throws ErrorResultException {
            public Promise<Result, LdapException> apply(BindResult result) throws LdapException {
                FutureResult<Result> future = FutureResultWrapper.asFutureResult(connection.searchAsync(
                        Requests.newSearchRequest(baseDN, scope, filter, attributes), new SearchResultHandlerImpl()));
                requestID = future.getRequestID();
@@ -202,9 +202,9 @@
                resultCode = result.getResultCode().intValue();
                COMPLETION_LATCH.countDown();
            }
        }).onFailure(new FailureHandler<ErrorResultException>() {
        }).onFailure(new FailureHandler<LdapException>() {
            @Override
            public void handleError(ErrorResultException error) {
            public void handleError(LdapException error) {
                System.err.println(error.getMessage());
                resultCode = error.getResult().getResultCode().intValue();
                COMPLETION_LATCH.countDown();
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2012-2013 ForgeRock AS
 *      Copyright 2012-2014 ForgeRock AS
 *
 */
@@ -30,7 +30,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
@@ -89,7 +89,7 @@
            String cn = entry.getAttribute("cn").firstValueAsString();
            System.out.println("Hello, " + cn + "!");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println("Failed to bind.");
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -33,7 +33,7 @@
import javax.net.ssl.SSLContext;
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.KeyManagers;
import org.forgerock.opendj.ldap.LDAPClientContext;
import org.forgerock.opendj.ldap.LDAPListener;
@@ -118,9 +118,8 @@
                        new ServerConnectionFactory<LDAPClientContext, Integer>() {
                            @Override
                            public ServerConnection<Integer> handleAccept(
                                    final LDAPClientContext clientContext)
                                    throws ErrorResultException {
                            public ServerConnection<Integer> handleAccept(final LDAPClientContext clientContext)
                                    throws LdapException {
                                clientContext.enableTLS(sslContext, null, null, false, false);
                                return connectionHandler.handleAccept(clientContext);
                            }
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLife.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2012-2013 ForgeRock AS
 *      Copyright 2012-2014 ForgeRock AS
 *
 */
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.Entries;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.ResultCode;
@@ -133,7 +133,7 @@
            connection.delete(newDN);
            System.out.println("...done.");
            // --- JCite delete ---
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
@@ -34,7 +34,7 @@
import javax.net.ssl.TrustManager;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LDAPOptions;
import org.forgerock.opendj.ldap.ResultCode;
@@ -95,7 +95,7 @@
            connection = factory.getConnection();
            connection.bind(bindDN, bindPassword.toCharArray());
            System.out.println("Authenticated as " + bindDN + ".");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
@@ -174,7 +174,7 @@
            System.out.println("Authenticated as " + bindDN + ".");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
@@ -225,7 +225,7 @@
            connection = factory.getConnection();
            connection.bind(bindDN, bindPassword.toCharArray());
            System.out.println("Authenticated as " + bindDN + ".");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroup.java
@@ -20,7 +20,7 @@
 *
 * CDDL HEADER END
 *
 *      Copyright 2012-2013 ForgeRock AS
 *      Copyright 2012-2014 ForgeRock AS
 *
 */
@@ -29,7 +29,7 @@
import java.util.Collection;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
@@ -147,7 +147,7 @@
            System.out.println("The entry with DN " + memberDN + " has been "
                    + op + " the group with DN " + groupDN + ".");
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
            return;
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseGenericControl.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -33,8 +33,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
@@ -153,12 +152,9 @@
                writer.flush();
            }
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            System.err.println(e.getMessage());
            System.exit(e.getResult().getResultCode().intValue());
        } catch (final ErrorResultIOException e) {
            System.err.println(e.getMessage());
            System.exit(e.getCause().getResult().getResultCode().intValue());
        } catch (final IOException e) {
            System.err.println(e.getMessage());
            System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AddRate.java
@@ -37,7 +37,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ResultHandler;
import org.forgerock.opendj.ldap.requests.AddRequest;
@@ -147,7 +147,7 @@
            }
            @Override
            public Promise<?, ErrorResultException> performOperation(Connection connection, DataSource[] dataSources,
            public Promise<?, LdapException> performOperation(Connection connection, DataSource[] dataSources,
                    long currentTime) {
                if (needsDelete(currentTime)) {
                    DeleteRequest dr = Requests.newDeleteRequest(getDNEntryToRemove());
@@ -159,7 +159,7 @@
                }
            }
            private Promise<Result, ErrorResultException> performAddOperation(Connection connection, long currentTime) {
            private Promise<Result, LdapException> performAddOperation(Connection connection, long currentTime) {
                try {
                    Entry entry;
                    synchronized (generator) {
@@ -172,7 +172,7 @@
                } catch (IOException e) {
                    // faking an error result by notifying the Handler
                    UpdateStatsResultHandler<Result> resHandler = new UpdateStatsResultHandler<Result>(currentTime);
                    resHandler.handleError(ErrorResultException.newErrorResult(ResultCode.OTHER, e));
                    resHandler.handleError(LdapException.newErrorResult(ResultCode.OTHER, e));
                    return null;
                }
            }
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -38,7 +38,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -104,7 +104,7 @@
            }
            @Override
            public void handleError(final ErrorResultException error) {
            public void handleError(final LdapException error) {
                super.handleError(error);
                if (error.getResult().getResultCode() == ResultCode.INVALID_CREDENTIALS) {
@@ -134,7 +134,7 @@
            }
            @Override
            public Promise<?, ErrorResultException> performOperation(final Connection connection,
            public Promise<?, LdapException> performOperation(final Connection connection,
                    final DataSource[] dataSources, final long startTime) {
                if (dataSources != null) {
                    data = DataSource.generateData(dataSources, data);
@@ -145,7 +145,7 @@
                    }
                }
                Promise<BindResult, ErrorResultException> returnedPromise;
                Promise<BindResult, LdapException> returnedPromise;
                if (filter != null && baseDN != null) {
                    if (sr == null) {
                        if (dataSources == null) {
@@ -161,10 +161,10 @@
                    }
                    returnedPromise = connection.searchSingleEntryAsync(sr).thenAsync(
                            new AsyncFunction<SearchResultEntry, BindResult, ErrorResultException>() {
                            new AsyncFunction<SearchResultEntry, BindResult, LdapException>() {
                                @Override
                                public Promise<BindResult, ErrorResultException> apply(SearchResultEntry result)
                                        throws ErrorResultException {
                                public Promise<BindResult, LdapException> apply(SearchResultEntry result)
                                        throws LdapException {
                                    searchWaitRecentTime.getAndAdd(System.nanoTime() - startTime);
                                    if (data == null) {
                                        data = new Object[1];
@@ -182,7 +182,7 @@
                        new BindUpdateStatsResultHandler(startTime));
            }
            private Promise<BindResult, ErrorResultException> performBind(final Connection connection,
            private Promise<BindResult, LdapException> performBind(final Connection connection,
                final Object[] data) {
                final boolean useInvalidPassword;
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -46,7 +46,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
@@ -121,7 +121,7 @@
                    println(INFO_COMPARE_OPERATION_RESULT_TRUE.get(request.getName().toString()));
                }
            } catch (final ErrorResultException ere) {
            } catch (final LdapException ere) {
                final LocalizableMessage msg = INFO_OPERATION_FAILED.get("COMPARE");
                errPrintln(msg);
                final Result r = ere.getResult();
@@ -362,7 +362,7 @@
        if (!noop.isPresent()) {
            try {
                connection = connectionFactory.getConnection();
            } catch (final ErrorResultException ere) {
            } catch (final LdapException ere) {
                errPrintln(LocalizableMessage.raw(ere.getMessage()));
                return ere.getResult().getResultCode().intValue();
            }
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -45,7 +45,7 @@
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
@@ -93,7 +93,7 @@
                    Result r = connection.add(change);
                    printResult(opType, change.getName().toString(), r);
                    return r.getResultCode().intValue();
                } catch (final ErrorResultException ere) {
                } catch (final LdapException ere) {
                    return Utils.printErrorMessage(LDAPModify.this, ere);
                }
            }
@@ -111,7 +111,7 @@
                    Result r = connection.delete(change);
                    printResult(opType, change.getName().toString(), r);
                    return r.getResultCode().intValue();
                } catch (final ErrorResultException ere) {
                } catch (final LdapException ere) {
                    return printErrorMessage(LDAPModify.this, ere);
                }
            }
@@ -129,7 +129,7 @@
                    Result r = connection.modifyDN(change);
                    printResult(opType, change.getName().toString(), r);
                    return r.getResultCode().intValue();
                } catch (final ErrorResultException ere) {
                } catch (final LdapException ere) {
                    return Utils.printErrorMessage(LDAPModify.this, ere);
                }
            }
@@ -147,7 +147,7 @@
                    Result r = connection.modify(change);
                    printResult(opType, change.getName().toString(), r);
                    return r.getResultCode().intValue();
                } catch (final ErrorResultException ere) {
                } catch (final LdapException ere) {
                    return Utils.printErrorMessage(LDAPModify.this, ere);
                }
            }
@@ -456,7 +456,7 @@
        if (!noop.isPresent()) {
            try {
                connection = connectionFactory.getConnection();
            } catch (final ErrorResultException ere) {
            } catch (final LdapException ere) {
                return Utils.printErrorMessage(this, ere);
            }
        }
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -34,7 +34,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.controls.Control;
import org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest;
@@ -245,7 +245,7 @@
        Connection connection;
        try {
            connection = connectionFactory.getConnection();
        } catch (final ErrorResultException ere) {
        } catch (final LdapException ere) {
            return Utils.printErrorMessage(this, ere);
        }
@@ -268,7 +268,7 @@
        PasswordModifyExtendedResult result;
        try {
            result = connection.extendedRequest(request);
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            LocalizableMessage message =
                    ERR_LDAPPWMOD_FAILED.get(e.getResult().getResultCode().intValue(), e
                            .getResult().getResultCode().toString());
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -45,7 +45,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchResultHandler;
@@ -825,7 +825,7 @@
        Connection connection;
        try {
            connection = connectionFactory.getConnection();
        } catch (final ErrorResultException ere) {
        } catch (final LdapException ere) {
            return Utils.printErrorMessage(this, ere);
        }
@@ -918,7 +918,7 @@
                println(message);
                println();
            }
        } catch (final ErrorResultException ere) {
        } catch (final LdapException ere) {
            return Utils.printErrorMessage(this, ere);
        } finally {
            closeSilently(ldifWriter, connection);
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
@@ -22,14 +22,14 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.ResultHandler;
@@ -66,7 +66,7 @@
            }
            @Override
            public Promise<?, ErrorResultException> performOperation(final Connection connection,
            public Promise<?, LdapException> performOperation(final Connection connection,
                    final DataSource[] dataSources, final long startTime) {
                if (dataSources != null) {
                    data = DataSource.generateData(dataSources, data);
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS.
 *      Portions Copyright 2011-2014 ForgeRock AS.
 */
package com.forgerock.opendj.ldap.tools;
@@ -42,7 +42,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionEventListener;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultHandler;
import org.forgerock.opendj.ldap.responses.ExtendedResult;
import org.forgerock.opendj.ldap.responses.Result;
@@ -371,7 +371,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            failedRecentCount.getAndIncrement();
            updateStats();
            app.errPrintVerboseMessage(LocalizableMessage.raw(error.getResult().toString()));
@@ -411,12 +411,12 @@
            this.connectionFactory = connectionFactory;
        }
        public abstract Promise<?, ErrorResultException> performOperation(Connection connection,
        public abstract Promise<?, LdapException> performOperation(Connection connection,
                DataSource[] dataSources, long startTime);
        @Override
        public void run() {
            Promise<?, ErrorResultException> promise;
            Promise<?, LdapException> promise;
            Connection connection;
            final double targetTimeInMS = 1000.0 / (targetThroughput / (double) (numThreads * numConnections));
@@ -429,7 +429,7 @@
                    } catch (final InterruptedException e) {
                        // Ignore and check stop requested
                        continue;
                    } catch (final ErrorResultException e) {
                    } catch (final LdapException e) {
                        app.errPrintln(LocalizableMessage.raw(e.getResult().getDiagnosticMessage()));
                        if (e.getCause() != null && app.isVerbose()) {
                            e.getCause().printStackTrace(app.getErrorStream());
@@ -446,7 +446,7 @@
                        } catch (final InterruptedException e) {
                            // Ignore and check stop requested
                            continue;
                        } catch (final ErrorResultException e) {
                        } catch (final LdapException e) {
                            app.errPrintln(LocalizableMessage.raw(e.getResult().toString()));
                            if (e.getCause() != null && app.isVerbose()) {
                                e.getCause().printStackTrace(app.getErrorStream());
@@ -469,7 +469,7 @@
                    } catch (final InterruptedException e) {
                        // Ignore and check stop requested
                        continue;
                    } catch (final ErrorResultException e) {
                    } catch (final LdapException e) {
                        if (e.getCause() instanceof IOException) {
                            e.getCause().printStackTrace(app.getErrorStream());
                            stopRequested = true;
@@ -787,8 +787,7 @@
    }
    @Override
    public synchronized void handleConnectionError(final boolean isDisconnectNotification,
            final ErrorResultException error) {
    public synchronized void handleConnectionError(final boolean isDisconnectNotification, final LdapException error) {
        if (!stopRequested) {
            app.errPrintln(LocalizableMessage.raw("Error occurred on one or more connections: "
                    + error.getResult()));
@@ -891,7 +890,7 @@
            statsThread.join();
        } catch (final InterruptedException e) {
            stopRequested = true;
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            stopRequested = true;
            app.println(LocalizableMessage.raw(e.getResult().getDiagnosticMessage()));
        } finally {
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package com.forgerock.opendj.ldap.tools;
@@ -35,7 +35,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchResultHandler;
import org.forgerock.opendj.ldap.SearchScope;
@@ -118,7 +118,7 @@
            }
            @Override
            public Promise<?, ErrorResultException> performOperation(final Connection connection,
            public Promise<?, LdapException> performOperation(final Connection connection,
                    final DataSource[] dataSources, final long startTime) {
                if (sr == null) {
                    if (dataSources == null) {
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
@@ -35,7 +35,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.controls.AuthorizationIdentityRequestControl;
import org.forgerock.opendj.ldap.controls.AuthorizationIdentityResponseControl;
import org.forgerock.opendj.ldap.controls.GenericControl;
@@ -170,7 +170,7 @@
     *            The error result.
     * @return The error code.
     */
    static int printErrorMessage(final ConsoleApplication app, final ErrorResultException ere) {
    static int printErrorMessage(final ConsoleApplication app, final LdapException ere) {
         /* if ((ere.getMessage() != null) && (ere.getMessage().length() > 0)) {
             app.println(LocalizableMessage.raw(ere.getMessage()));
         }*/
opendj-rest2ldap-servlet/src/main/java/org/forgerock/opendj/rest2ldap/servlet/Rest2LDAPAuthnFilter.java
@@ -48,7 +48,7 @@
import org.forgerock.opendj.ldap.Connections;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.MultipleEntriesFoundException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -65,7 +65,7 @@
import static org.forgerock.json.resource.SecurityContext.*;
import static org.forgerock.json.resource.servlet.SecurityContextFactory.*;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.forgerock.opendj.rest2ldap.Rest2LDAP.*;
import static org.forgerock.opendj.rest2ldap.servlet.Rest2LDAPContextFactory.*;
@@ -221,10 +221,10 @@
                        searchFilterTemplate, username);
                final SearchRequest searchRequest = newSearchRequest(searchBaseDN, searchScope, filter, "1.1");
                searchLDAPConnectionFactory.getConnectionAsync()
                        .thenAsync(new AsyncFunction<Connection, SearchResultEntry, ErrorResultException>() {
                        .thenAsync(new AsyncFunction<Connection, SearchResultEntry, LdapException>() {
                            @Override
                            public Promise<SearchResultEntry, ErrorResultException> apply(Connection connection)
                                    throws ErrorResultException {
                            public Promise<SearchResultEntry, LdapException> apply(Connection connection)
                                    throws LdapException {
                                savedConnection.set(connection);
                                // Do the search.
                                return connection.searchSingleEntryAsync(searchRequest);
@@ -240,10 +240,10 @@
                                doBind(req, res, newSimpleBindRequest(bindDN, password), chain, savedConnection, sync,
                                        username, authzid);
                            }
                        }).onFailure(new FailureHandler<ErrorResultException>() {
                        }).onFailure(new FailureHandler<LdapException>() {
                            @Override
                            public void handleError(final ErrorResultException error) {
                                ErrorResultException normalizedError = error;
                            public void handleError(final LdapException error) {
                                LdapException normalizedError = error;
                                if (savedConnection.get() != null) {
                                    savedConnection.get().close();
                                    /*
@@ -394,10 +394,10 @@
            final BindRequest bindRequest, final FilterChain chain, final AtomicReference<Connection> savedConnection,
            final ServletSynchronizer sync, final String authcid, final Map<String, Object> authzid) {
        bindLDAPConnectionFactory.getConnectionAsync()
                .thenAsync(new AsyncFunction<Connection, BindResult, ErrorResultException>() {
                .thenAsync(new AsyncFunction<Connection, BindResult, LdapException>() {
                    @Override
                    public Promise<BindResult, ErrorResultException> apply(Connection connection)
                            throws ErrorResultException {
                    public Promise<BindResult, LdapException> apply(Connection connection)
                            throws LdapException {
                        savedConnection.set(connection);
                        return connection.bindAsync(bindRequest);
                    }
@@ -439,9 +439,9 @@
                            }
                        }
                    }
                }).onFailure(new FailureHandler<ErrorResultException>() {
                }).onFailure(new FailureHandler<LdapException>() {
                    @Override
                    public void handleError(final ErrorResultException error) {
                    public void handleError(final LdapException error) {
                        sync.signalAndComplete(asResourceException(error));
                    }
                });
opendj-rest2ldap-servlet/src/main/java/org/forgerock/opendj/rest2ldap/servlet/Rest2LDAPContextFactory.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions copyright [year] [name of copyright owner]".
 *
 * Copyright 2012 ForgeRock AS.
 * Copyright 2012-2014 ForgeRock AS.
 */
package org.forgerock.opendj.rest2ldap.servlet;
@@ -50,7 +50,7 @@
 *     try {
 *         connection.bind(username, password.toCharArray());
 *         request.setAttribute(ATTRIBUTE_AUTHN_CONNECTION, connection);
 *     } catch (ErrorResultException e) {
 *     } catch (LdapException e) {
 *         // Fail the HTTP request.
 *         response.setStatus(...);
 *         return;
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Context.java
@@ -29,7 +29,7 @@
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionEventListener;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.ResultHandler;
@@ -92,7 +92,7 @@
        }
        @Override
        public void handleError(final ErrorResultException error) {
        public void handleError(final LdapException error) {
            handleResult(error.getResult());
        }
@@ -292,9 +292,9 @@
                    connection = wrap(result);
                    runnable.run();
                }
            }).onFailure(new FailureHandler<ErrorResultException>() {
            }).onFailure(new FailureHandler<LdapException>() {
                @Override
                public final void handleError(final ErrorResultException error) {
                public final void handleError(final LdapException error) {
                    handler.handleError(asResourceException(error));
                }
            });
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPCollectionResourceProvider.java
@@ -52,7 +52,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.Function;
import org.forgerock.opendj.ldap.Modification;
@@ -476,9 +476,9 @@
                                        completeIfNecessary(SUCCESS);
                                    }
                                }
                            }).onFailure(new FailureHandler<ErrorResultException>() {
                            }).onFailure(new FailureHandler<LdapException>() {
                                @Override
                                public void handleError(ErrorResultException error) {
                                public void handleError(LdapException error) {
                                    synchronized (sequenceLock) {
                                        completeIfNecessary(asResourceException(error));
                                    }
@@ -537,9 +537,9 @@
                    public void handleResult(final SearchResultEntry entry) {
                        adaptEntry(c, entry, h);
                    }
                }).onFailure(new FailureHandler<ErrorResultException>() {
                }).onFailure(new FailureHandler<LdapException>() {
                    @Override
                    public void handleError(final ErrorResultException error) {
                    public void handleError(final LdapException error) {
                        h.handleError(asResourceException(error));
                    }
                });
@@ -621,9 +621,9 @@
                                    h.handleError(asResourceException(e));
                                }
                            }
                        }).onFailure(new FailureHandler<ErrorResultException>() {
                        }).onFailure(new FailureHandler<LdapException>() {
                            @Override
                            public void handleError(final ErrorResultException error) {
                            public void handleError(final LdapException error) {
                                h.handleError(asResourceException(error));
                            }
                        });
@@ -681,9 +681,9 @@
                                        updateHandler.handleError(asResourceException(e));
                                    }
                                }
                            }).onFailure(new FailureHandler<ErrorResultException>() {
                            }).onFailure(new FailureHandler<LdapException>() {
                                @Override
                                public void handleError(final ErrorResultException error) {
                                public void handleError(final LdapException error) {
                                    updateHandler.handleError(asResourceException(error));
                                }
                            });
@@ -980,10 +980,10 @@
        };
    }
    private FailureHandler<ErrorResultException> postEmptyPatchFailureHandler(final ResultHandler<Resource> h) {
        return new FailureHandler<ErrorResultException>() {
    private FailureHandler<LdapException> postEmptyPatchFailureHandler(final ResultHandler<Resource> h) {
        return new FailureHandler<LdapException>() {
            @Override
            public void handleError(final ErrorResultException error) {
            public void handleError(final LdapException error) {
                h.handleError(asResourceException(error));
            }
        };
@@ -1025,11 +1025,11 @@
        };
    }
    private FailureHandler<ErrorResultException> postUpdateFailureHandler(final ResultHandler<Resource> handler) {
    private FailureHandler<LdapException> postUpdateFailureHandler(final ResultHandler<Resource> handler) {
        // The handler which will be invoked for the LDAP add result.
        return new FailureHandler<ErrorResultException>() {
        return new FailureHandler<LdapException>() {
            @Override
            public void handleError(final ErrorResultException error) {
            public void handleError(final LdapException error) {
                handler.handleError(asResourceException(error));
            }
        };
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/ReferenceAttributeMapper.java
@@ -34,7 +34,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.Function;
import org.forgerock.opendj.ldap.LinkedAttribute;
@@ -49,7 +49,7 @@
import org.forgerock.util.promise.FailureHandler;
import org.forgerock.util.promise.SuccessHandler;
import static org.forgerock.opendj.ldap.ErrorResultException.*;
import static org.forgerock.opendj.ldap.LdapException.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.forgerock.opendj.rest2ldap.Rest2LDAP.*;
import static org.forgerock.opendj.rest2ldap.Utils.*;
@@ -140,10 +140,9 @@
                final SearchRequest request = createSearchRequest(result);
                final List<Filter> subFilters = new LinkedList<Filter>();
                final FailureHandler<ErrorResultException> failureHandler =
                    new FailureHandler<ErrorResultException>() {
                final FailureHandler<LdapException> failureHandler = new FailureHandler<LdapException>() {
                        @Override
                        public void handleError(ErrorResultException error) {
                    public void handleError(LdapException error) {
                            h.handleError(asResourceException(error)); // Propagate.
                        }
                    };
@@ -237,9 +236,9 @@
                            }
                            completeIfNecessary();
                        }
                    }).onFailure(new FailureHandler<ErrorResultException>() {
                    }).onFailure(new FailureHandler<LdapException>() {
                        @Override
                        public void handleError(final ErrorResultException error) {
                        public void handleError(final LdapException error) {
                            ResourceException re;
                            try {
                                throw error;
@@ -254,7 +253,7 @@
                                        "The request cannot be processed " + "because the resource '%s' "
                                            + "referenced in field '%s' is " + "ambiguous",
                                        primaryKeyValue.toString(), path));
                            } catch (final ErrorResultException e) {
                            } catch (final LdapException e) {
                                re = asResourceException(e);
                            }
                            exception.compareAndSet(null, re);
@@ -343,9 +342,9 @@
                    public void handleResult(final SearchResultEntry result) {
                        mapper.read(c, path, result, handler);
                    }
                }).onFailure(new FailureHandler<ErrorResultException>() {
                }).onFailure(new FailureHandler<LdapException>() {
                    @Override
                    public void handleError(final ErrorResultException error) {
                    public void handleError(final LdapException error) {
                        if (!(error instanceof EntryNotFoundException)) {
                            handler.handleError(asResourceException(error));
                        } else {
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions copyright [year] [name of copyright owner]".
 *
 * Copyright 2013 ForgeRock AS.
 * Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.rest2ldap;
@@ -50,7 +50,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FailoverLoadBalancingAlgorithm;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
@@ -794,7 +794,7 @@
    /**
     * Adapts a {@code Throwable} to a {@code ResourceException}. If the
     * {@code Throwable} is an LDAP {@code ErrorResultException} then an
     * {@code Throwable} is an LDAP {@link LdapException} then an
     * appropriate {@code ResourceException} is returned, otherwise an
     * {@code InternalServerErrorException} is returned.
     *
@@ -830,7 +830,7 @@
            resourceResultCode = ResourceException.INTERNAL_ERROR;
        } catch (final TimeoutResultException e) {
            resourceResultCode = 408;
        } catch (final ErrorResultException e) {
        } catch (final LdapException e) {
            final ResultCode rc = e.getResult().getResultCode();
            if (rc.equals(ResultCode.ADMIN_LIMIT_EXCEEDED)) {
                resourceResultCode = 413; // Request Entity Too Large
opendj-server/src/main/java/org/forgerock/opendj/server/core/AbstractDataProvider.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -32,7 +32,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,7 +61,7 @@
     * {@code true} if the entry was successfully retrieved.
     */
    @Override
    public boolean containsEntry(final DN dn) throws ErrorResultException {
    public boolean containsEntry(final DN dn) throws LdapException {
        return getEntry(dn) != null;
    }
@@ -88,7 +88,7 @@
     * that change notification is not supported.
     */
    @Override
    public boolean supportsChangeNotification(final DN baseDN) throws ErrorResultException {
    public boolean supportsChangeNotification(final DN baseDN) throws LdapException {
        return false;
    }
opendj-server/src/main/java/org/forgerock/opendj/server/core/ArchivableDataProvider.java
@@ -22,7 +22,7 @@
 *
 *
 *       Copyright 2008 Sun Microsystems, Inc.
 *       Portions copyright 2013 ForgeRock AS.
 *       Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -40,7 +40,7 @@
 * implementation simpler? E.g. initialization, crypto.
 * <p>
 * FIXME: the async APIs used below are a bad fit. We do not want to return an
 * ErrorResultException. We really need a more generic promises API.
 * {@link LdapException}. We really need a more generic promises API.
 */
public interface ArchivableDataProvider {
opendj-server/src/main/java/org/forgerock/opendj/server/core/DataProvider.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -30,7 +30,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.RequestHandler;
/**
@@ -81,12 +81,12 @@
     *            The DN of the entry.
     * @return {@code true} if this data provider contains the specified entry,
     *         or {@code false} if it does not.
     * @throws ErrorResultException
     * @throws LdapException
     *             If a problem occurs while trying to make the determination,
     *             or if {@code dn} is not a DN equal to or subordinate to one
     *             of the base DNs managed by this data provider.
     */
    boolean containsEntry(DN dn) throws ErrorResultException;
    boolean containsEntry(DN dn) throws LdapException;
    /**
     * Deregisters an event listener from this data provider.
@@ -133,12 +133,12 @@
     *            The DN of the entry.
     * @return The requested entry, or {@code null} if this data provider does
     *         not contain the specified entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If a problem occurs while trying to retrieve the entry, or if
     *             {@code dn} is not a DN equal to or subordinate to one of the
     *             base DNs managed by this data provider.
     */
    Entry getEntry(DN dn) throws ErrorResultException;
    Entry getEntry(DN dn) throws LdapException;
    /**
     * Returns the current status of the provided base DN in this data provider.
@@ -146,11 +146,11 @@
     * @param baseDN
     *            The base DN in this data provider.
     * @return The current status of the provided base DN in this data provider.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by this
     *             data provider.
     */
    DataProviderStatus getStatus(DN baseDN) throws ErrorResultException;
    DataProviderStatus getStatus(DN baseDN) throws LdapException;
    /**
     * Returns an unmodifiable set containing the OIDs of the controls that may
@@ -160,11 +160,11 @@
     *            The base DN in this data provider.
     * @return An unmodifiable set containing the OIDs of the controls that may
     *         be supported by the provided base DN in this data provider.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by this
     *             data provider.
     */
    Set<String> getSupportedControls(DN baseDN) throws ErrorResultException;
    Set<String> getSupportedControls(DN baseDN) throws LdapException;
    /**
     * Returns an unmodifiable set containing the OIDs of the features that may
@@ -174,11 +174,11 @@
     *            The base DN in this data provider.
     * @return An unmodifiable set containing the OIDs of the features that may
     *         be supported by the provided base DN in this data provider.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by this
     *             data provider.
     */
    Set<String> getSupportedFeatures(DN baseDN) throws ErrorResultException;
    Set<String> getSupportedFeatures(DN baseDN) throws LdapException;
    /**
     * Registers an event listener with this data provider.
@@ -241,10 +241,10 @@
     *            The base DN in this data provider.
     * @return {@code true} if the provided base DN in this data provider
     *         supports change notification.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by this
     *             data provider.
     */
    boolean supportsChangeNotification(DN baseDN) throws ErrorResultException;
    boolean supportsChangeNotification(DN baseDN) throws LdapException;
}
opendj-server/src/main/java/org/forgerock/opendj/server/core/DataProviderConnection.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -30,7 +30,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.RequestHandler;
/**
@@ -53,12 +53,12 @@
     *            The DN of the entry.
     * @return {@code true} if the underlying data provider contains the
     *         specified entry, or {@code false} if it does not.
     * @throws ErrorResultException
     * @throws LdapException
     *             If a problem occurs while trying to make the determination,
     *             or if {@code dn} is not a DN equal to or subordinate to one
     *             of the base DNs managed by the underlying data provider.
     */
    boolean containsEntry(DN dn) throws ErrorResultException;
    boolean containsEntry(DN dn) throws LdapException;
    /**
     * Deregisters an event listener from the underlying data provider.
@@ -84,12 +84,12 @@
     *            The DN of the entry.
     * @return The requested entry, or {@code null} if the underlying data
     *         provider does not contain the specified entry.
     * @throws ErrorResultException
     * @throws LdapException
     *             If a problem occurs while trying to retrieve the entry, or if
     *             {@code dn} is not a DN equal to or subordinate to one of the
     *             base DNs managed by the underlying data provider.
     */
    Entry getEntry(DN dn) throws ErrorResultException;
    Entry getEntry(DN dn) throws LdapException;
    /**
     * Returns the current status of the provided base DN in the underlying data
@@ -99,11 +99,11 @@
     *            The base DN in the underlying data provider.
     * @return The current status of the provided base DN in the underlying data
     *         provider.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by the
     *             underlying data provider.
     */
    DataProviderStatus getStatus(DN baseDN) throws ErrorResultException;
    DataProviderStatus getStatus(DN baseDN) throws LdapException;
    /**
     * Returns an unmodifiable set containing the OIDs of the controls that may
@@ -114,11 +114,11 @@
     * @return An unmodifiable set containing the OIDs of the controls that may
     *         be supported by the provided base DN in the underlying data
     *         provider.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by the
     *             underlying data provider.
     */
    Set<String> getSupportedControls(DN baseDN) throws ErrorResultException;
    Set<String> getSupportedControls(DN baseDN) throws LdapException;
    /**
     * Returns an unmodifiable set containing the OIDs of the features that may
@@ -129,11 +129,11 @@
     * @return An unmodifiable set containing the OIDs of the features that may
     *         be supported by the provided base DN in the underlying data
     *         provider.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by the
     *             underlying data provider.
     */
    Set<String> getSupportedFeatures(DN baseDN) throws ErrorResultException;
    Set<String> getSupportedFeatures(DN baseDN) throws LdapException;
    /**
     * Registers an event listener with the underlying data provider.
@@ -151,9 +151,9 @@
     *            The base DN in the underlying data provider.
     * @return {@code true} if the provided base DN in the underlying data
     *         provider supports change notification.
     * @throws ErrorResultException
     * @throws LdapException
     *             If {@code baseDN} is not one of the base DNs managed by the
     *             underlying data provider.
     */
    boolean supportsChangeNotification(DN baseDN) throws ErrorResultException;
    boolean supportsChangeNotification(DN baseDN) throws LdapException;
}
opendj-server/src/main/java/org/forgerock/opendj/server/core/ExportableDataProvider.java
@@ -22,7 +22,7 @@
 *
 *
 *       Copyright 2008 Sun Microsystems, Inc.
 *       Portions copyright 2013 ForgeRock AS.
 *       Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -34,7 +34,7 @@
 * A data provider which supports LDIF export functionality.
 * <p>
 * FIXME: the async APIs used below are a bad fit. We do not want to return an
 * ErrorResultException. We really need a more generic promises API.
 * {@link LdapException}. We really need a more generic promises API.
 */
public interface ExportableDataProvider {
opendj-server/src/main/java/org/forgerock/opendj/server/core/ImportableDataProvider.java
@@ -22,7 +22,7 @@
 *
 *
 *       Copyright 2008 Sun Microsystems, Inc.
 *       Portions copyright 2013 ForgeRock AS.
 *       Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -34,7 +34,7 @@
 * A data provider which supports LDIF import functionality.
 * <p>
 * FIXME: the async APIs used below are a bad fit. We do not want to return an
 * ErrorResultException. We really need a more generic promises API.
 * {@link LdapException}. We really need a more generic promises API.
 * <p>
 * FIXME: it would be nice if we can use EntryReader, however we may need to
 * provide an optimized implementation for use in multi-threaded imports. E.g.
opendj-server2x-adapter/src/main/java/org/forgerock/opendj/adapter/server2x/Adapters.java
@@ -36,7 +36,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchResultHandler;
@@ -147,13 +147,13 @@
            }
            @Override
            public Promise<Connection, ErrorResultException> getConnectionAsync() {
            public Promise<Connection, LdapException> getConnectionAsync() {
                // TODO change the path...
                return newSuccessfulPromise(newConnection(icc));
            }
            @Override
            public Connection getConnection() throws ErrorResultException {
            public Connection getConnection() throws LdapException {
                return newConnection(icc);
            }
        };
@@ -183,15 +183,14 @@
     * @param dn
     *            The DN of the user.
     * @return A new connection for a specified user.
     * @throws ErrorResultException
     * @throws LdapException
     *             If no such object.
     */
    public static Connection newConnectionForUser(final DN dn) throws ErrorResultException {
    public static Connection newConnectionForUser(final DN dn) throws LdapException {
        try {
            return newConnection(new InternalClientConnection(to(dn)));
        } catch (DirectoryException e) {
            throw ErrorResultException.newErrorResult(Responses
                    .newResult(ResultCode.NO_SUCH_OBJECT));
            throw LdapException.newErrorResult(Responses.newResult(ResultCode.NO_SUCH_OBJECT));
        }
    }
@@ -199,8 +198,7 @@
        return new AbstractSynchronousConnection() {
            @Override
            public Result search(final SearchRequest request, final SearchResultHandler handler)
                    throws ErrorResultException {
            public Result search(final SearchRequest request, final SearchResultHandler handler) throws LdapException {
                InternalSearchListener internalSearchListener = new InternalSearchListener() {
                    @Override
@@ -234,7 +232,7 @@
            }
            @Override
            public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException {
            public Result modifyDN(final ModifyDNRequest request) throws LdapException {
                final ModifyDNOperation modifyDNOperation =
                        icc.processModifyDN(to(valueOf(request.getName())), to(valueOf(request
                                .getNewRDN())), request.isDeleteOldRDN(),
@@ -244,7 +242,7 @@
            }
            @Override
            public Result modify(final ModifyRequest request) throws ErrorResultException {
            public Result modify(final ModifyRequest request) throws LdapException {
                final ModifyOperation modifyOperation =
                        icc.processModify(to(valueOf(request.getName())), toRawModifications(request
                                .getModifications()), to(request.getControls()));
@@ -264,7 +262,7 @@
            @Override
            public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
                    final IntermediateResponseHandler handler) throws ErrorResultException {
                    final IntermediateResponseHandler handler) throws LdapException {
                final ExtendedOperation extendedOperation =
                        icc.processExtendedOperation(request.getOID(), to(request.getValue()),
@@ -295,14 +293,14 @@
            }
            @Override
            public Result delete(final DeleteRequest request) throws ErrorResultException {
            public Result delete(final DeleteRequest request) throws LdapException {
                final DeleteOperation deleteOperation =
                        icc.processDelete(to(valueOf(request.getName())), to(request.getControls()));
                return getResponseResult(deleteOperation);
            }
            @Override
            public CompareResult compare(final CompareRequest request) throws ErrorResultException {
            public CompareResult compare(final CompareRequest request) throws LdapException {
                final CompareOperation compareOperation =
                        icc.processCompare(to(valueOf(request.getName())), request
                                .getAttributeDescription().toString(), to(request
@@ -320,7 +318,7 @@
            }
            @Override
            public BindResult bind(final BindRequest request) throws ErrorResultException {
            public BindResult bind(final BindRequest request) throws LdapException {
                BindOperation bindOperation = null;
                if (request instanceof SimpleBindRequest) {
                    bindOperation =
@@ -348,7 +346,7 @@
                    bindClient.dispose();
                } else { // not supported
                    throw ErrorResultException.newErrorResult(Responses
                    throw LdapException.newErrorResult(Responses
                            .newResult(ResultCode.AUTH_METHOD_NOT_SUPPORTED));
                }
                BindResult result =
@@ -358,7 +356,7 @@
                if (result.isSuccess()) {
                    return result;
                } else {
                    throw ErrorResultException.newErrorResult(result);
                    throw LdapException.newErrorResult(result);
                }
            }
@@ -368,7 +366,7 @@
            }
            @Override
            public Result add(final AddRequest request) throws ErrorResultException {
            public Result add(final AddRequest request) throws LdapException {
                final AddOperation addOperation =
                        icc.processAdd(to(valueOf(request.getName())), to(request
                                .getAllAttributes()), to(request.getControls()));
opendj-server2x-adapter/src/main/java/org/forgerock/opendj/adapter/server2x/Converters.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013 ForgeRock AS.
 *      Copyright 2013-2014 ForgeRock AS.
 */
package org.forgerock.opendj.adapter.server2x;
@@ -35,7 +35,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LinkedAttribute;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.ResultCode;
@@ -603,7 +603,7 @@
    /**
     * Populates the result object with the operation details and return the
     * result object if it was successful. Otherwise, it throws an
     * {@link ErrorResultException}.
     * {@link LdapException}.
     *
     * @param <T>
     *          the type of the result object
@@ -611,13 +611,13 @@
     *          used to populate the result
     * @param result
     *          the result object to populate from the Operation
     * @return the result if successful, an {@link ErrorResultException} is thrown
     * @return the result if successful, an {@link LdapException} is thrown
     *         otherwise
     * @throws ErrorResultException
     * @throws LdapException
     *           when an error occurs
     */
    public static <T extends Result> T getResponseResult(final Operation operation, final T result)
            throws ErrorResultException {
            throws LdapException {
        if (operation.getReferralURLs() != null) {
            for (String ref : operation.getReferralURLs()) {
                result.addReferralURI(ref);
@@ -635,7 +635,7 @@
        if (result.isSuccess()) {
            return result;
        } else {
            throw ErrorResultException.newErrorResult(result);
            throw LdapException.newErrorResult(result);
        }
    }
@@ -646,10 +646,10 @@
     * @param operation
     *          value to convert
     * @return the converted value
     * @throws ErrorResultException
     * @throws LdapException
     *           when an error occurs
     */
    public static Result getResponseResult(final Operation operation) throws ErrorResultException {
    public static Result getResponseResult(final Operation operation) throws LdapException {
        return getResponseResult(operation, newSDKResult(operation));
    }
opendj-server2x-adapter/src/test/java/org/forgerock/opendj/adapter/server2x/AdaptersTestCase.java
@@ -21,13 +21,10 @@
 * CDDL HEADER END
 *
 *
 *      Portions copyright 2013 ForgeRock AS
 *      Copyright 2013-2014 ForgeRock AS
 */
package org.forgerock.opendj.adapter.server2x;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
import java.security.GeneralSecurityException;
import java.util.NoSuchElementException;
@@ -43,9 +40,8 @@
import org.forgerock.opendj.ldap.Entries;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
@@ -78,7 +74,9 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.forgerock.opendj.adapter.server2x.EmbeddedServerTestCaseUtils.CONFIG_PROPERTIES;
import static org.fest.assertions.Assertions.*;
import static org.fest.assertions.Fail.*;
import static org.forgerock.opendj.adapter.server2x.EmbeddedServerTestCaseUtils.*;
/**
 * This class defines a set of tests for the Adapters.class.
@@ -211,10 +209,10 @@
    /**
     * A simple LDAP connection.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testSimpleLDAPConnectionFactorySimpleBind() throws ErrorResultException {
    public void testSimpleLDAPConnectionFactorySimpleBind() throws LdapException {
        final LDAPConnectionFactory factory =
                new LDAPConnectionFactory("localhost",
                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
@@ -236,11 +234,10 @@
     *
     * @throws NumberFormatException
     * @throws GeneralSecurityException
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testLDAPSASLBind() throws NumberFormatException, GeneralSecurityException,
            ErrorResultException {
    public void testLDAPSASLBind() throws NumberFormatException, GeneralSecurityException, LdapException {
        LDAPConnectionFactory factory =
                new LDAPConnectionFactory("localhost",
                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
@@ -261,10 +258,10 @@
    /**
     * Tests an SASL connection with the adapter.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testAdapterConnectionSASLBindRequest() throws ErrorResultException,
    public void testAdapterConnectionSASLBindRequest() throws LdapException,
            GeneralSecurityException {
        final Connection connection = Adapters.newRootConnection();
@@ -283,12 +280,10 @@
     * This type of connection is not supported. Anonymous SASL Mechanisms is
     * disabled in the config.ldif file.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = ErrorResultException.class)
    public void testConnectionAnonymousSASLBindRequest(final ConnectionFactory factory)
            throws ErrorResultException {
    @Test(dataProvider = "anonymousConnectionFactories", expectedExceptions = LdapException.class)
    public void testConnectionAnonymousSASLBindRequest(final ConnectionFactory factory) throws LdapException {
        final Connection connection = factory.getConnection();
        try {
            connection.bind(Requests.newAnonymousSASLBindRequest("anonymousSASLBindRequest"));
@@ -513,14 +508,13 @@
     * Performs a search with a sub entries request control. Sub-entries are
     * included and the normal entries are excluded. No result expected.
     *
     * @throws ErrorResultException
     * @throws ErrorResultIOException
     * @throws LdapException
     * @throws SearchResultReferenceIOException
     */
    @Test(dataProvider = "rootConnectionFactories",
            expectedExceptions = NoSuchElementException.class)
    public void testAdapterSearchRequestSubEntriesWithNoResult(final ConnectionFactory factory)
            throws ErrorResultException, ErrorResultIOException, SearchResultReferenceIOException {
            throws LdapException, SearchResultReferenceIOException {
        final Connection connection = factory.getConnection();
        try {
            final SearchRequest request =
@@ -542,13 +536,12 @@
     * Performs a search with a sub entries request control. Sub-entries are
     * excluded this time and the normal entries are included.
     *
     * @throws ErrorResultException
     * @throws ErrorResultIOException
     * @throws LdapException
     * @throws SearchResultReferenceIOException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterSearchRequestSubEntries(final ConnectionFactory factory)
            throws ErrorResultException, ErrorResultIOException, SearchResultReferenceIOException {
            throws LdapException, SearchResultReferenceIOException {
        final Connection connection = factory.getConnection();
        final SearchRequest request =
@@ -575,12 +568,11 @@
    /**
     * Deletes an inexistent entry.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories",
            expectedExceptions = EntryNotFoundException.class)
    public void testAdapterDeleteRequestNoSuchEntry(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterDeleteRequestNoSuchEntry(final ConnectionFactory factory) throws LdapException {
        final DeleteRequest deleteRequest = Requests.newDeleteRequest("cn=test");
        final Connection connection = factory.getConnection();
        try {
@@ -593,11 +585,10 @@
    /**
     * Deletes an existing entry with the 'no-op' control.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterDeleteRequestNoOpControl(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterDeleteRequestNoOpControl(final ConnectionFactory factory) throws LdapException {
        final DeleteRequest deleteRequest =
                Requests.newDeleteRequest("uid=user.1, dc=example,dc=org")
                // The no-op control is specified with his OID.
@@ -619,10 +610,10 @@
    /**
     * Deletes an existing entry.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testAdapterDeleteRequest() throws ErrorResultException {
    public void testAdapterDeleteRequest() throws LdapException {
        final Connection connection = Adapters.newRootConnection();
        // Checks if the entry exists.
@@ -651,11 +642,11 @@
    /**
     * Modifies an existing entry.
     *
     * @throws ErrorResultException
     * @throws LdapException
     * @throws DecodeException
     */
    @Test()
    public void testAdapterModifyRequest() throws ErrorResultException, DecodeException {
    public void testAdapterModifyRequest() throws LdapException, DecodeException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2, dc=example,dc=org").addControl(
@@ -690,11 +681,10 @@
     * Tries to modify the existing entry with the same values but using the
     * permissive modify control.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterUsePermissiveModifyRequest(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterUsePermissiveModifyRequest(final ConnectionFactory factory) throws LdapException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2, dc=example,dc=org").addControl(
@@ -714,13 +704,11 @@
    /**
     * Tries to modify the existing entry with the same values.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories",
            expectedExceptions = ConstraintViolationException.class)
    public void testAdapterModifyRequestFails(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterModifyRequestFails(final ConnectionFactory factory) throws LdapException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2, dc=example,dc=org").addModification(
                        ModificationType.ADD, "uid", "user.2");
@@ -731,11 +719,10 @@
    /**
     * Modifies the DN.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterModifyDNRequest(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterModifyDNRequest(final ConnectionFactory factory) throws LdapException {
        final Connection connection = factory.getConnection();
        // Verifies that entry has been correctly modified.
@@ -769,12 +756,10 @@
    /**
     * Compare request. The comparison returns true.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterCompareRequestTrue(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterCompareRequestTrue(final ConnectionFactory factory) throws LdapException {
        final CompareRequest compareRequest =
                Requests.newCompareRequest("uid=user.0,dc=example,dc=org", "uid", "user.0");
@@ -789,12 +774,10 @@
    /**
     * Compare request. The comparison returns false.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterCompareRequestFalse(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterCompareRequestFalse(final ConnectionFactory factory) throws LdapException {
        final CompareRequest compareRequest =
                Requests.newCompareRequest("uid=user.0,dc=example,dc=org", "uid", "scarter");
@@ -809,11 +792,10 @@
    /**
     * Use the Who Am I? extended request.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterExtendedOperation(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterExtendedOperation(final ConnectionFactory factory) throws LdapException {
        final WhoAmIExtendedRequest request = Requests.newWhoAmIExtendedRequest();
        final Connection connection = factory.getConnection();
        try {
@@ -828,12 +810,12 @@
     * If an anonymous tries to delete, sends a result code : insufficient
     * access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = AuthorizationException.class)
    public void testAdapterAsAnonymousCannotPerformDeleteRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final DeleteRequest deleteRequest =
                Requests.newDeleteRequest("uid=user.2,dc=example,dc=org");
@@ -850,12 +832,12 @@
     * If an anonymous tries to do an add request, sends a result code :
     * insufficient access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = AuthorizationException.class)
    public void testAdapterAsAnonymousCannotPerformAddRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        // @formatter:off
        final AddRequest addRequest = Requests.newAddRequest(
@@ -877,12 +859,12 @@
     * If an anonymous tries to do a modify DN request, sends a result code :
     * insufficient access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = AuthorizationException.class)
    public void testAdapterAsAnonymousCannotPerformModifyDNRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final Connection connection = factory.getConnection();
@@ -901,12 +883,12 @@
     * If an anonymous tries to do a modify request, sends a result code :
     * insufficient access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = ErrorResultException.class)
            expectedExceptions = LdapException.class)
    public void testAdapterAsAnonymousCannotPerformModifyRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2,dc=example,dc=org").addControl(
@@ -924,11 +906,11 @@
    /**
     * The anonymous connection is allowed to perform compare request.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories")
    public void testAdapterAsAnonymousPerformsCompareRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final CompareRequest compareRequest =
                Requests.newCompareRequest("uid=user.0,dc=example,dc=org", "uid", "user.0");
@@ -976,8 +958,7 @@
     *
     * @throws Exception
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = ErrorResultIOException.class)
    @Test(dataProvider = "anonymousConnectionFactories", expectedExceptions = LdapException.class)
    public void testAdapterAsAnonymousCannotPerformSearchRequestWithControl(
            final ConnectionFactory factory) throws Exception {
        final Connection connection = factory.getConnection();
@@ -995,14 +976,11 @@
     * add/delete/search and compare results with an SDK adapter connection
     * doing the same.
     *
     * @throws ErrorResultException
     * @throws ErrorResultIOException
     * @throws LdapException
     * @throws SearchResultReferenceIOException
     */
    @Test()
    public void testLDAPConnectionAndAdapterComparison() throws ErrorResultException,
            ErrorResultIOException, SearchResultReferenceIOException {
    public void testLDAPConnectionAndAdapterComparison() throws LdapException, SearchResultReferenceIOException {
        // @formatter:off
        final AddRequest addRequest = Requests.newAddRequest(
                "dn: sn=babs,dc=example,dc=org",
@@ -1064,8 +1042,7 @@
            assertThat(entry.getName().toString()).isEqualTo(sdkEntry.getName().toString());
            assertThat(entry.getAttributeCount()).isEqualTo(sdkEntry.getAttributeCount());
            assertThat(entry.getAllAttributes().iterator().next().getAttributeDescription())
                    .isEqualTo(
                            sdkEntry.getAllAttributes().iterator().next().getAttributeDescription());
                    .isEqualTo(sdkEntry.getAllAttributes().iterator().next().getAttributeDescription());
            assertThat(entry.getControls().size()).isEqualTo(sdkEntry.getControls().size());
        }
    }
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Adapters.java
@@ -37,7 +37,7 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchResultHandler;
@@ -147,13 +147,13 @@
            }
            @Override
            public Promise<Connection, ErrorResultException> getConnectionAsync() {
            public Promise<Connection, LdapException> getConnectionAsync() {
                // TODO change the path...
                return newSuccessfulPromise(newConnection(icc));
            }
            @Override
            public Connection getConnection() throws ErrorResultException {
            public Connection getConnection() throws LdapException {
                return newConnection(icc);
            }
        };
@@ -183,15 +183,14 @@
     * @param dn
     *            The DN of the user.
     * @return A new connection for a specified user.
     * @throws ErrorResultException
     * @throws LdapException
     *             If no such object.
     */
    public static Connection newConnectionForUser(final DN dn) throws ErrorResultException {
    public static Connection newConnectionForUser(final DN dn) throws LdapException {
        try {
            return newConnection(new InternalClientConnection(to(dn)));
        } catch (DirectoryException e) {
            throw ErrorResultException.newErrorResult(Responses
                    .newResult(ResultCode.NO_SUCH_OBJECT));
            throw LdapException.newErrorResult(Responses.newResult(ResultCode.NO_SUCH_OBJECT));
        }
    }
@@ -200,7 +199,7 @@
            @Override
            public Result search(final SearchRequest request, final SearchResultHandler handler)
                    throws ErrorResultException {
                    throws LdapException {
                InternalSearchListener internalSearchListener = new InternalSearchListener() {
                    @Override
@@ -233,7 +232,7 @@
            }
            @Override
            public Result modifyDN(final ModifyDNRequest request) throws ErrorResultException {
            public Result modifyDN(final ModifyDNRequest request) throws LdapException {
                final ModifyDNOperation modifyDNOperation =
                        icc.processModifyDN(valueOf(request.getName()), valueOf(request.getNewRDN()),
                                request.isDeleteOldRDN(),
@@ -243,7 +242,7 @@
            }
            @Override
            public Result modify(final ModifyRequest request) throws ErrorResultException {
            public Result modify(final ModifyRequest request) throws LdapException {
                final ModifyOperation modifyOperation =
                        icc.processModify(valueOf(request.getName()), toRawModifications(request
                                .getModifications()), to(request.getControls()));
@@ -263,7 +262,7 @@
            @Override
            public <R extends ExtendedResult> R extendedRequest(final ExtendedRequest<R> request,
                    final IntermediateResponseHandler handler) throws ErrorResultException {
                    final IntermediateResponseHandler handler) throws LdapException {
                final ExtendedOperation extendedOperation =
                        icc.processExtendedOperation(request.getOID(), request.getValue(),
@@ -294,14 +293,14 @@
            }
            @Override
            public Result delete(final DeleteRequest request) throws ErrorResultException {
            public Result delete(final DeleteRequest request) throws LdapException {
                final DeleteOperation deleteOperation =
                        icc.processDelete(valueOf(request.getName()), to(request.getControls()));
                return getResponseResult(deleteOperation);
            }
            @Override
            public CompareResult compare(final CompareRequest request) throws ErrorResultException {
            public CompareResult compare(final CompareRequest request) throws LdapException {
                final CompareOperation compareOperation =
                        icc.processCompare(valueOf(request.getName()),
                                request.getAttributeDescription().toString(),
@@ -318,7 +317,7 @@
            }
            @Override
            public BindResult bind(final BindRequest request) throws ErrorResultException {
            public BindResult bind(final BindRequest request) throws LdapException {
                BindOperation bindOperation = null;
                if (request instanceof SimpleBindRequest) {
                    bindOperation =
@@ -346,7 +345,7 @@
                    bindClient.dispose();
                } else { // not supported
                    throw ErrorResultException.newErrorResult(Responses
                    throw LdapException.newErrorResult(Responses
                            .newResult(ResultCode.AUTH_METHOD_NOT_SUPPORTED));
                }
                BindResult result = Responses.newBindResult(bindOperation.getResultCode());
@@ -355,7 +354,7 @@
                if (result.isSuccess()) {
                    return result;
                } else {
                    throw ErrorResultException.newErrorResult(result);
                    throw LdapException.newErrorResult(result);
                }
            }
@@ -365,7 +364,7 @@
            }
            @Override
            public Result add(final AddRequest request) throws ErrorResultException {
            public Result add(final AddRequest request) throws LdapException {
                final AddOperation addOperation =
                        icc.processAdd(valueOf(request.getName()), to(request
                                .getAllAttributes()), to(request.getControls()));
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -41,7 +41,7 @@
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LinkedAttribute;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.RDN;
@@ -626,7 +626,7 @@
    /**
     * Populates the result object with the operation details and return the
     * result object if it was successful. Otherwise, it throws an
     * {@link ErrorResultException}.
     * {@link LdapException}.
     *
     * @param <T>
     *          the type of the result object
@@ -634,13 +634,13 @@
     *          used to populate the result
     * @param result
     *          the result object to populate from the Operation
     * @return the result if successful, an {@link ErrorResultException} is thrown
     * @return the result if successful, an {@link LdapException} is thrown
     *         otherwise
     * @throws ErrorResultException
     * @throws LdapException
     *           when an error occurs
     */
    public static <T extends Result> T getResponseResult(final Operation operation, final T result)
            throws ErrorResultException {
            throws LdapException {
        if (operation.getReferralURLs() != null) {
            for (String ref : operation.getReferralURLs()) {
                result.addReferralURI(ref);
@@ -658,7 +658,7 @@
        if (result.isSuccess()) {
            return result;
        } else {
            throw ErrorResultException.newErrorResult(result);
            throw LdapException.newErrorResult(result);
        }
    }
@@ -669,10 +669,10 @@
     * @param operation
     *          value to convert
     * @return the converted value
     * @throws ErrorResultException
     * @throws LdapException
     *           when an error occurs
     */
    public static Result getResponseResult(final Operation operation) throws ErrorResultException {
    public static Result getResponseResult(final Operation operation) throws LdapException {
        return getResponseResult(operation, newSDKResult(operation));
    }
opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java
@@ -21,13 +21,10 @@
 * CDDL HEADER END
 *
 *
 *      Portions copyright 2013-2014 ForgeRock AS
 *      Copyright 2013-2014 ForgeRock AS
 */
package org.forgerock.opendj.adapter.server3x;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
import java.security.GeneralSecurityException;
import java.util.NoSuchElementException;
@@ -43,9 +40,8 @@
import org.forgerock.opendj.ldap.Entries;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.EntryNotFoundException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ErrorResultIOException;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
@@ -78,7 +74,9 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.forgerock.opendj.adapter.server3x.EmbeddedServerTestCaseUtils.CONFIG_PROPERTIES;
import static org.fest.assertions.Assertions.*;
import static org.fest.assertions.Fail.*;
import static org.forgerock.opendj.adapter.server3x.EmbeddedServerTestCaseUtils.*;
/**
 * This class defines a set of tests for the Adapters.class.
@@ -211,10 +209,10 @@
    /**
     * A simple LDAP connection.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testSimpleLDAPConnectionFactorySimpleBind() throws ErrorResultException {
    public void testSimpleLDAPConnectionFactorySimpleBind() throws LdapException {
        final LDAPConnectionFactory factory =
                new LDAPConnectionFactory("localhost",
                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
@@ -236,11 +234,10 @@
     *
     * @throws NumberFormatException
     * @throws GeneralSecurityException
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testLDAPSASLBind() throws NumberFormatException, GeneralSecurityException,
            ErrorResultException {
    public void testLDAPSASLBind() throws NumberFormatException, GeneralSecurityException, LdapException {
        LDAPConnectionFactory factory =
                new LDAPConnectionFactory("localhost",
                        Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")));
@@ -261,10 +258,10 @@
    /**
     * Tests an SASL connection with the adapter.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testAdapterConnectionSASLBindRequest() throws ErrorResultException,
    public void testAdapterConnectionSASLBindRequest() throws LdapException,
            GeneralSecurityException {
        final Connection connection = Adapters.newRootConnection();
@@ -283,12 +280,10 @@
     * This type of connection is not supported. Anonymous SASL Mechanisms is
     * disabled in the config.ldif file.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = ErrorResultException.class)
    public void testConnectionAnonymousSASLBindRequest(final ConnectionFactory factory)
            throws ErrorResultException {
    @Test(dataProvider = "anonymousConnectionFactories", expectedExceptions = LdapException.class)
    public void testConnectionAnonymousSASLBindRequest(final ConnectionFactory factory) throws LdapException {
        final Connection connection = factory.getConnection();
        try {
            connection.bind(Requests.newAnonymousSASLBindRequest("anonymousSASLBindRequest"));
@@ -513,14 +508,13 @@
     * Performs a search with a sub entries request control. Sub-entries are
     * included and the normal entries are excluded. No result expected.
     *
     * @throws ErrorResultException
     * @throws ErrorResultIOException
     * @throws LdapException
     * @throws SearchResultReferenceIOException
     */
    @Test(dataProvider = "rootConnectionFactories",
            expectedExceptions = NoSuchElementException.class)
    public void testAdapterSearchRequestSubEntriesWithNoResult(final ConnectionFactory factory)
            throws ErrorResultException, ErrorResultIOException, SearchResultReferenceIOException {
            throws LdapException, SearchResultReferenceIOException {
        final Connection connection = factory.getConnection();
        try {
            final SearchRequest request =
@@ -542,13 +536,12 @@
     * Performs a search with a sub entries request control. Sub-entries are
     * excluded this time and the normal entries are included.
     *
     * @throws ErrorResultException
     * @throws ErrorResultIOException
     * @throws LdapException
     * @throws SearchResultReferenceIOException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterSearchRequestSubEntries(final ConnectionFactory factory)
            throws ErrorResultException, ErrorResultIOException, SearchResultReferenceIOException {
            throws LdapException, SearchResultReferenceIOException {
        final Connection connection = factory.getConnection();
        final SearchRequest request =
@@ -575,12 +568,11 @@
    /**
     * Deletes an inexistent entry.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories",
            expectedExceptions = EntryNotFoundException.class)
    public void testAdapterDeleteRequestNoSuchEntry(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterDeleteRequestNoSuchEntry(final ConnectionFactory factory) throws LdapException {
        final DeleteRequest deleteRequest = Requests.newDeleteRequest("cn=test");
        final Connection connection = factory.getConnection();
        try {
@@ -593,11 +585,10 @@
    /**
     * Deletes an existing entry with the 'no-op' control.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterDeleteRequestNoOpControl(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterDeleteRequestNoOpControl(final ConnectionFactory factory) throws LdapException {
        final DeleteRequest deleteRequest =
                Requests.newDeleteRequest("uid=user.1, dc=example,dc=org")
                // The no-op control is specified with his OID.
@@ -619,10 +610,10 @@
    /**
     * Deletes an existing entry.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test()
    public void testAdapterDeleteRequest() throws ErrorResultException {
    public void testAdapterDeleteRequest() throws LdapException {
        final Connection connection = Adapters.newRootConnection();
        // Checks if the entry exists.
@@ -651,11 +642,11 @@
    /**
     * Modifies an existing entry.
     *
     * @throws ErrorResultException
     * @throws LdapException
     * @throws DecodeException
     */
    @Test()
    public void testAdapterModifyRequest() throws ErrorResultException, DecodeException {
    public void testAdapterModifyRequest() throws LdapException, DecodeException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2, dc=example,dc=org").addControl(
@@ -690,11 +681,10 @@
     * Tries to modify the existing entry with the same values but using the
     * permissive modify control.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterUsePermissiveModifyRequest(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterUsePermissiveModifyRequest(final ConnectionFactory factory) throws LdapException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2, dc=example,dc=org").addControl(
@@ -714,13 +704,11 @@
    /**
     * Tries to modify the existing entry with the same values.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories",
            expectedExceptions = ConstraintViolationException.class)
    public void testAdapterModifyRequestFails(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterModifyRequestFails(final ConnectionFactory factory) throws LdapException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2, dc=example,dc=org").addModification(
                        ModificationType.ADD, "uid", "user.2");
@@ -731,11 +719,10 @@
    /**
     * Modifies the DN.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterModifyDNRequest(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterModifyDNRequest(final ConnectionFactory factory) throws LdapException {
        final Connection connection = factory.getConnection();
        // Verifies that entry has been correctly modified.
@@ -769,12 +756,10 @@
    /**
     * Compare request. The comparison returns true.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterCompareRequestTrue(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterCompareRequestTrue(final ConnectionFactory factory) throws LdapException {
        final CompareRequest compareRequest =
                Requests.newCompareRequest("uid=user.0,dc=example,dc=org", "uid", "user.0");
@@ -789,12 +774,10 @@
    /**
     * Compare request. The comparison returns false.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterCompareRequestFalse(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterCompareRequestFalse(final ConnectionFactory factory) throws LdapException {
        final CompareRequest compareRequest =
                Requests.newCompareRequest("uid=user.0,dc=example,dc=org", "uid", "scarter");
@@ -809,11 +792,10 @@
    /**
     * Use the Who Am I? extended request.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "rootConnectionFactories")
    public void testAdapterExtendedOperation(final ConnectionFactory factory)
            throws ErrorResultException {
    public void testAdapterExtendedOperation(final ConnectionFactory factory) throws LdapException {
        final WhoAmIExtendedRequest request = Requests.newWhoAmIExtendedRequest();
        final Connection connection = factory.getConnection();
        try {
@@ -828,12 +810,12 @@
     * If an anonymous tries to delete, sends a result code : insufficient
     * access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = AuthorizationException.class)
    public void testAdapterAsAnonymousCannotPerformDeleteRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final DeleteRequest deleteRequest =
                Requests.newDeleteRequest("uid=user.2,dc=example,dc=org");
@@ -850,12 +832,12 @@
     * If an anonymous tries to do an add request, sends a result code :
     * insufficient access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = AuthorizationException.class)
    public void testAdapterAsAnonymousCannotPerformAddRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        // @formatter:off
        final AddRequest addRequest = Requests.newAddRequest(
@@ -877,12 +859,12 @@
     * If an anonymous tries to do a modify DN request, sends a result code :
     * insufficient access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = AuthorizationException.class)
    public void testAdapterAsAnonymousCannotPerformModifyDNRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final Connection connection = factory.getConnection();
@@ -901,12 +883,12 @@
     * If an anonymous tries to do a modify request, sends a result code :
     * insufficient access rights.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = ErrorResultException.class)
            expectedExceptions = LdapException.class)
    public void testAdapterAsAnonymousCannotPerformModifyRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final ModifyRequest changeRequest =
                Requests.newModifyRequest("uid=user.2,dc=example,dc=org").addControl(
@@ -924,11 +906,11 @@
    /**
     * The anonymous connection is allowed to perform compare request.
     *
     * @throws ErrorResultException
     * @throws LdapException
     */
    @Test(dataProvider = "anonymousConnectionFactories")
    public void testAdapterAsAnonymousPerformsCompareRequest(final ConnectionFactory factory)
            throws ErrorResultException {
            throws LdapException {
        final CompareRequest compareRequest =
                Requests.newCompareRequest("uid=user.0,dc=example,dc=org", "uid", "user.0");
@@ -976,8 +958,7 @@
     *
     * @throws Exception
     */
    @Test(dataProvider = "anonymousConnectionFactories",
            expectedExceptions = ErrorResultIOException.class)
    @Test(dataProvider = "anonymousConnectionFactories", expectedExceptions = LdapException.class)
    public void testAdapterAsAnonymousCannotPerformSearchRequestWithControl(
            final ConnectionFactory factory) throws Exception {
        final Connection connection = factory.getConnection();
@@ -995,14 +976,11 @@
     * add/delete/search and compare results with an SDK adapter connection
     * doing the same.
     *
     * @throws ErrorResultException
     * @throws ErrorResultIOException
     * @throws LdapException
     * @throws SearchResultReferenceIOException
     */
    @Test()
    public void testLDAPConnectionAndAdapterComparison() throws ErrorResultException,
            ErrorResultIOException, SearchResultReferenceIOException {
    public void testLDAPConnectionAndAdapterComparison() throws LdapException, SearchResultReferenceIOException {
        // @formatter:off
        final AddRequest addRequest = Requests.newAddRequest(
                "dn: sn=babs,dc=example,dc=org",
@@ -1064,8 +1042,7 @@
            assertThat(entry.getName().toString()).isEqualTo(sdkEntry.getName().toString());
            assertThat(entry.getAttributeCount()).isEqualTo(sdkEntry.getAttributeCount());
            assertThat(entry.getAllAttributes().iterator().next().getAttributeDescription())
                    .isEqualTo(
                            sdkEntry.getAllAttributes().iterator().next().getAttributeDescription());
                    .isEqualTo(sdkEntry.getAllAttributes().iterator().next().getAttributeDescription());
            assertThat(entry.getControls().size()).isEqualTo(sdkEntry.getControls().size());
        }
    }