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

Matthew Swift
14.10.2013 440d0439d1555479f601a5ac86ae635fa2b8701f
Fix OPENDJ-975: REST DELETE fails with HTTP result code 404 but it http-access it is 200

Close the request processing context after invoking the result handlers not before since the handler may need to interact with context before it is closed. In this case closing the context logged result before the handler had a chance to update the internal error state.
1 files modified
20 ■■■■ changed files
opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPCollectionResourceProvider.java 20 ●●●● patch | view | raw | blame | history
opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/LDAPCollectionResourceProvider.java
@@ -920,8 +920,11 @@
        return new QueryResultHandler() {
            @Override
            public void handleError(final ResourceException error) {
                c.close();
                try {
                handler.handleError(error);
                } finally {
                    c.close();
                }
            }
            @Override
@@ -931,8 +934,11 @@
            @Override
            public void handleResult(final QueryResult result) {
                c.close();
                try {
                handler.handleResult(result);
                } finally {
                    c.close();
                }
            }
        };
    }
@@ -941,14 +947,20 @@
        return new ResultHandler<V>() {
            @Override
            public void handleError(final ResourceException error) {
                c.close();
                try {
                handler.handleError(error);
                } finally {
                    c.close();
                }
            }
            @Override
            public void handleResult(final V result) {
                c.close();
                try {
                handler.handleResult(result);
                } finally {
                    c.close();
                }
            }
        };
    }