Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-4961

enableFilteredResultsHandler:true causes NPEs when using queryFilter=true

    Details

      Description

      In each OpenICF provisioner configuration file, there is an optional section called "resultsHandlerConfig". Here is an example from openidm-zip/src/main/resources/samples/provisioners/provisioner.openicf-ldap.json :

          "resultsHandlerConfig" : {
              "enableNormalizingResultsHandler" : true,
              "enableFilteredResultsHandler" : false,
              "enableCaseInsensitiveFilter" : false,
              "enableAttributesToGetSearchResultsHandler" : true
          },
      

      This is documented here: http://openidm.forgerock.org/doc/bootstrap/integrators-guide/index.html#results-handler-config

      Many provisioner configurations that are shipped by default do not include this section, and so they have the default values for each setting. The default setting for "enableFilteredResultsHandler" is true.

      Unfortunately, when enableFilteredResultsHandler is set to true (either implicitly or explicitly) then there is a Null Pointer Exception thrown every time a query is made using _queryFilter=true.

      Steps to reproduce:

      1) start sample2c
      2) curl -u openidm-admin:openidm-admin -k https://localhost:8443/openidm/system/ldap/group?_queryFilter=true - returns the list of groups in ldap
      3) edit samples/sample2c/conf/provisioner.openicf-ldap.json, changing enableFilteredResultsHandler to true
      4) curl -u openidm-admin:openidm-admin -k https://localhost:8443/openidm/system/ldap/group?_queryFilter=true now returns a 500 error, and this stack trace on the IDM console:

      Resource exception: 500 Internal Server Error: "Internal Server Error"
      org.forgerock.json.resource.InternalServerErrorException: Internal Server Error
      	at org.forgerock.openidm.provisioner.openicf.impl.OpenICFProvisionerService$ObjectClassResourceProvider.handleQuery(OpenICFProvisionerService.java:1495)
      	at org.forgerock.openidm.provisioner.openicf.impl.OpenICFProvisionerService$ObjectClassRequestHandler.handleQuery(OpenICFProvisionerService.java:1051)
      	at org.forgerock.json.resource.Router.handleQuery(Router.java:310)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:99)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterQuery(Filters.java:92)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:97)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterQuery(Filters.java:92)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:97)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter$7.apply(ScriptedFilter.java:157)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter$7.apply(ScriptedFilter.java:154)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:221)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:205)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter.filterResourceResponseRequest(ScriptedFilter.java:169)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter.filterQuery(ScriptedFilter.java:153)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterQuery(Filters.java:90)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:97)
      	at org.forgerock.openidm.audit.filter.AuditFilter.filterQuery(AuditFilter.java:152)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterQuery(Filters.java:90)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:97)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$5.filterQuery(ServletConnectionFactory.java:520)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:97)
      	at org.forgerock.openidm.maintenance.impl.PassthroughFilter.filterQuery(PassthroughFilter.java:66)
      	at org.forgerock.openidm.maintenance.impl.MaintenanceService.filterQuery(MaintenanceService.java:262)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterQuery(Filters.java:90)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleQuery(FilterChain.java:97)
      	at org.forgerock.json.resource.FilterChain.handleQuery(FilterChain.java:231)
      	at org.forgerock.json.resource.InternalConnection.queryAsync(InternalConnection.java:78)
      	at org.forgerock.json.resource.AbstractConnectionWrapper.queryAsync(AbstractConnectionWrapper.java:189)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$1$1.queryAsync(ServletConnectionFactory.java:314)
      	at org.forgerock.json.resource.http.RequestRunner.visitQueryRequest(RequestRunner.java:238)
      	at org.forgerock.json.resource.http.RequestRunner.visitQueryRequest(RequestRunner.java:73)
      	at org.forgerock.json.resource.Requests$QueryRequestImpl.accept(Requests.java:448)
      	at org.forgerock.json.resource.http.RequestRunner.handleResult(RequestRunner.java:119)
      	at org.forgerock.json.resource.http.HttpAdapter$2.apply(HttpAdapter.java:566)
      	at org.forgerock.json.resource.http.HttpAdapter$2.apply(HttpAdapter.java:563)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:221)
      	at org.forgerock.json.resource.http.HttpAdapter.doRequest(HttpAdapter.java:562)
      	at org.forgerock.json.resource.http.HttpAdapter.doQuery(HttpAdapter.java:358)
      	at org.forgerock.json.resource.http.HttpAdapter.handle(HttpAdapter.java:173)
      	at org.forgerock.http.handler.Chain.handle(Chain.java:57)
      	at org.forgerock.http.filter.OptionsFilter.filter(OptionsFilter.java:77)
      	at org.forgerock.http.handler.Chain.handle(Chain.java:55)
      	at org.forgerock.http.handler.Chain.handle(Chain.java:57)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.grantAccess(AuthenticationFramework.java:220)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.access$400(AuthenticationFramework.java:65)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$3.apply(AuthenticationFramework.java:212)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$3.apply(AuthenticationFramework.java:205)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:221)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.validateRequest(AuthenticationFramework.java:168)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.access$100(AuthenticationFramework.java:65)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$1.apply(AuthenticationFramework.java:155)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$1.apply(AuthenticationFramework.java:152)
      	at org.forgerock.util.promise.PromiseImpl$7.handleStateChange(PromiseImpl.java:445)
      	at org.forgerock.util.promise.PromiseImpl.handleCompletion(PromiseImpl.java:521)
      	at org.forgerock.util.promise.PromiseImpl.addOrFireListener(PromiseImpl.java:509)
      	at org.forgerock.util.promise.PromiseImpl.thenAsync(PromiseImpl.java:438)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.processMessage(AuthenticationFramework.java:146)
      	at org.forgerock.caf.authentication.framework.AuthenticationFilter.filter(AuthenticationFilter.java:96)
      	at org.forgerock.openidm.auth.AuthFilterWrapper.filter(AuthFilterWrapper.java:90)
      	at org.forgerock.http.handler.Chain.handle(Chain.java:55)
      	at org.forgerock.http.handler.Chain.handle(Chain.java:57)
      	at org.forgerock.http.filter.TransactionIdInboundFilter.filter(TransactionIdInboundFilter.java:60)
      	at org.forgerock.http.handler.Chain.handle(Chain.java:55)
      	at org.forgerock.http.servlet.HttpFrameworkServlet.service(HttpFrameworkServlet.java:222)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      	at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:259)
      	at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:222)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.forgerock.openidm.servletregistration.impl.ServletRegistrationSingleton$FilterProxy.invoke(ServletRegistrationSingleton.java:295)
      	at com.sun.proxy.$Proxy24.doFilter(Unknown Source)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
      	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:364)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.forgerock.openidm.servletregistration.impl.ServletRegistrationSingleton$FilterProxy.invoke(ServletRegistrationSingleton.java:295)
      	at com.sun.proxy.$Proxy24.doFilter(Unknown Source)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:267)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:497)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException
      	at org.identityconnectors.framework.common.objects.filter.FilteredResultsHandlerVisitor$1.accept(FilteredResultsHandlerVisitor.java:65)
      	at org.identityconnectors.framework.impl.api.local.operations.FilteredResultsHandler.handle(FilteredResultsHandler.java:61)
      	at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$AttributesToGetSearchResultsHandler.handle(SearchImpl.java:206)
      	at org.identityconnectors.framework.impl.api.local.operations.SearchImpl$1.handle(SearchImpl.java:125)
      	at org.identityconnectors.ldap.search.LdapSearch$1.handle(LdapSearch.java:142)
      	at org.identityconnectors.ldap.search.DefaultSearchStrategy.doSearch(DefaultSearchStrategy.java:102)
      	at org.identityconnectors.ldap.search.LdapInternalSearch.execute(LdapInternalSearch.java:63)
      	at org.identityconnectors.ldap.search.LdapSearch.execute(LdapSearch.java:140)
      	at org.identityconnectors.ldap.search.LdapSearch.execute(LdapSearch.java:126)
      	at org.identityconnectors.ldap.LdapConnector.executeQuery(LdapConnector.java:196)
      	at org.identityconnectors.ldap.LdapConnector.executeQuery(LdapConnector.java:69)
      	at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.rawSearch(SearchImpl.java:152)
      	at org.identityconnectors.framework.impl.api.local.operations.SearchImpl.search(SearchImpl.java:118)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:104)
      	at com.sun.proxy.$Proxy26.search(Unknown Source)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:96)
      	at com.sun.proxy.$Proxy26.search(Unknown Source)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.identityconnectors.framework.impl.api.BufferedResultsProxy$BufferedResultsHandler.run(BufferedResultsProxy.java:157)
      

      The same basic behavior is observable with any connector when enableFilteredResultsHandler is true.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbranch Jon Branch
                Reporter:
                jake.feasel Jake Feasel
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: