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

Setting relationship properties to empty string throws NPE

    Details

      Description

      When I attempt to create a managed/user with an empty string for the "manager" relationship attribute, this is the result:

      curl -u openidm-admin:openidm-admin 'https://localhost:8443/openidm/managed/user?_action=create' -H 'Content-Type: application/json' --data '{"mail":"jake.feasel@forgerock.com","sn":"Feasel","address2":"","givenName":"Jake","city":"","country":"","postalCode":"","stateProvince":"","postalAddress":"","userName":"jake.feasel","manager":""}' -k -X POST
      
      {"code":500,"reason":"Internal Server Error","message":"Internal Server Error"}
      

      With this stack trace on the console:

      Resource exception: 500 Internal Server Error: "Internal Server Error"
      org.forgerock.json.resource.InternalServerErrorException: Internal Server Error
      	at org.forgerock.openidm.managed.ManagedObjectSet.createInstance(ManagedObjectSet.java:628)
      	at org.forgerock.json.resource.InterfaceCollectionHandler.handleCreate(InterfaceCollectionHandler.java:40)
      	at org.forgerock.json.resource.Router.handleCreate(Router.java:255)
      	at org.forgerock.openidm.managed.ManagedObjectService$ManagedObjectSetRequestHandler.handleCreate(ManagedObjectService.java:172)
      	at org.forgerock.json.resource.Router.handleCreate(Router.java:255)
      	at org.forgerock.openidm.managed.ManagedObjectService.handleCreate(ManagedObjectService.java:275)
      	at org.forgerock.json.resource.Router.handleCreate(Router.java:255)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:69)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterCreate(Filters.java:62)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:67)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter$2.apply(ScriptedFilter.java:96)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter$2.apply(ScriptedFilter.java:93)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:200)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:184)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter.filterResourceResponseRequest(ScriptedFilter.java:169)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter.filterCreate(ScriptedFilter.java:92)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterCreate(Filters.java:60)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:67)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter$2.apply(ScriptedFilter.java:96)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter$2.apply(ScriptedFilter.java:93)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:200)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:184)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter.filterResourceResponseRequest(ScriptedFilter.java:169)
      	at org.forgerock.openidm.servlet.internal.ScriptedFilter.filterCreate(ScriptedFilter.java:92)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:67)
      	at org.forgerock.openidm.audit.filter.AuditFilter.filterCreate(AuditFilter.java:106)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterCreate(Filters.java:60)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:67)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$5.filterCreate(ServletConnectionFactory.java:489)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleCreate(FilterChain.java:67)
      	at org.forgerock.json.resource.FilterChain.handleCreate(FilterChain.java:213)
      	at org.forgerock.json.resource.InternalConnection.createAsync(InternalConnection.java:44)
      	at org.forgerock.json.resource.AbstractConnectionWrapper.createAsync(AbstractConnectionWrapper.java:105)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$1$1.createAsync(ServletConnectionFactory.java:181)
      	at org.forgerock.json.resource.http.RequestRunner.visitCreateRequest(RequestRunner.java:160)
      	at org.forgerock.json.resource.http.RequestRunner.visitCreateRequest(RequestRunner.java:73)
      	at org.forgerock.json.resource.Requests$CreateRequestImpl.accept(Requests.java:258)
      	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:200)
      	at org.forgerock.json.resource.http.HttpAdapter.doRequest(HttpAdapter.java:562)
      	at org.forgerock.json.resource.http.HttpAdapter.doCreate(HttpAdapter.java:432)
      	at org.forgerock.json.resource.http.HttpAdapter.handle(HttpAdapter.java:161)
      	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:218)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.access$400(AuthenticationFramework.java:63)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$3.apply(AuthenticationFramework.java:210)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$3.apply(AuthenticationFramework.java:203)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:200)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.validateRequest(AuthenticationFramework.java:166)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.access$100(AuthenticationFramework.java:63)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$1.apply(AuthenticationFramework.java:153)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework$1.apply(AuthenticationFramework.java:150)
      	at org.forgerock.util.promise.PromiseImpl$6.handleStateChange(PromiseImpl.java:415)
      	at org.forgerock.util.promise.PromiseImpl.handleCompletion(PromiseImpl.java:486)
      	at org.forgerock.util.promise.PromiseImpl.addOrFireListener(PromiseImpl.java:474)
      	at org.forgerock.util.promise.PromiseImpl.thenAsync(PromiseImpl.java:408)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.processMessage(AuthenticationFramework.java:144)
      	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.servlet.HttpFrameworkServlet.service(HttpFrameworkServlet.java:217)
      	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.$Proxy21.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:300)
      	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.$Proxy21.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.forgerock.json.resource.ResourcePath.child(ResourcePath.java:266)
      	at org.forgerock.openidm.managed.SingletonRelationshipProvider.queryRelationship(SingletonRelationshipProvider.java:114)
      	at org.forgerock.openidm.managed.SingletonRelationshipProvider.getRelationshipValueForResource(SingletonRelationshipProvider.java:91)
      	at org.forgerock.openidm.managed.SingletonRelationshipProvider.clear(SingletonRelationshipProvider.java:186)
      	at org.forgerock.openidm.managed.SingletonRelationshipProvider.setRelationshipValueForResource(SingletonRelationshipProvider.java:162)
      	at org.forgerock.openidm.managed.ManagedObjectSet.persistRelationships(ManagedObjectSet.java:503)
      	at org.forgerock.openidm.managed.ManagedObjectSet.createInstance(ManagedObjectSet.java:592)
      	... 106 more
      

      Expected behavior would be a 400 Bad Request error, ideally with details about why the request is bad.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chad.kienle chad.kienle
                Reporter:
                jake.feasel Jake Feasel
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: