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

ResourceException when external/rest receives HTTP 204 response

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: OpenIDM 5.5.0
    • Fix Version/s: 6.5.0
    • Labels:
    • Target Version/s:
    • Verified Version/s:
    • Story Points:
      2
    • Sprint:
      OpenIDM Sprint 6.5-1
    • Support Ticket IDs:

      Description

      When calling a REST endpoint via the external/rest component and receiving a HTTP 204 No Content response, the following error is thrown:

      Apr 19, 2018 1:57:49 PM org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3 lambda$handleRequestWithLogging$8
      WARNING: Resource exception: 500 Internal Server Error: "No content to map due to end-of-input
       at [Source: java.io.BufferedReader@45050f7d; line: 1, column: 0]"
      org.forgerock.json.resource.InternalServerErrorException: No content to map due to end-of-input
       at [Source: java.io.BufferedReader@45050f7d; line: 1, column: 0]
      	at org.forgerock.json.resource.ResourceException.newResourceException(ResourceException.java:231)
      	at org.forgerock.openidm.script.exception.ScriptThrownException.toResourceException(ScriptThrownException.java:111)
      	at org.forgerock.openidm.script.handler.ScriptedRequestHandler.convertScriptException(ScriptedRequestHandler.java:416)
      	at org.forgerock.openidm.script.handler.ScriptedRequestHandler.handleRead(ScriptedRequestHandler.java:383)
      	at org.forgerock.json.resource.Router.handleRead(Router.java:330)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:105)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterRead(Filters.java:94)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterRead(Filters.java:94)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.openidm.filter.ScriptedFilter.lambda$filterRead$4(ScriptedFilter.java:104)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:252)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:216)
      	at org.forgerock.openidm.filter.ScriptedFilter.filterRequest(ScriptedFilter.java:142)
      	at org.forgerock.openidm.filter.ScriptedFilter.filterRead(ScriptedFilter.java:104)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterRead(Filters.java:92)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.openidm.audit.filter.AuditFilter.lambda$filterRead$5(AuditFilter.java:142)
      	at org.forgerock.openidm.audit.filter.AuditFilter.logAuditAccessEntry(AuditFilter.java:168)
      	at org.forgerock.openidm.audit.filter.AuditFilter.filterRead(AuditFilter.java:142)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterRead(MutableFilterDecorator.java:96)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterRead(Filters.java:92)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3.lambda$filterRead$5(ServletConnectionFactory.java:403)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3.handleRequestWithLogging(ServletConnectionFactory.java:430)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3.filterRead(ServletConnectionFactory.java:403)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.openidm.filter.PassthroughFilter.filterRead(PassthroughFilter.java:72)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterRead(MutableFilterDecorator.java:96)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterRead(MutableFilterDecorator.java:96)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.openidm.filter.PassthroughFilter.filterRead(PassthroughFilter.java:72)
      	at org.forgerock.openidm.filter.MutableFilterDecorator.filterRead(MutableFilterDecorator.java:96)
      	at org.forgerock.json.resource.Filters$ConditionalFilter.filterRead(Filters.java:92)
      	at org.forgerock.json.resource.FilterChain$Cursor.handleRead(FilterChain.java:103)
      	at org.forgerock.json.resource.FilterChain.handleRead(FilterChain.java:252)
      	at org.forgerock.json.resource.InternalConnection.readAsync(InternalConnection.java:81)
      	at org.forgerock.json.resource.AbstractConnectionWrapper.readAsync(AbstractConnectionWrapper.java:203)
      	at org.forgerock.openidm.servlet.internal.ServletConnectionFactory$2$1.readAsync(ServletConnectionFactory.java:275)
      	at org.forgerock.json.resource.http.RequestRunner.visitReadRequest(RequestRunner.java:279)
      	at org.forgerock.json.resource.http.RequestRunner.visitReadRequest(RequestRunner.java:82)
      	at org.forgerock.json.resource.Requests$ReadRequestImpl.accept(Requests.java:583)
      	at org.forgerock.json.resource.http.RequestRunner.handleResult(RequestRunner.java:128)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:252)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:241)
      	at org.forgerock.json.resource.http.HttpAdapter.doRequest(HttpAdapter.java:712)
      	at org.forgerock.json.resource.http.HttpAdapter.doRead(HttpAdapter.java:369)
      	at org.forgerock.json.resource.http.HttpAdapter.handle(HttpAdapter.java:274)
      	at org.forgerock.http.handler.Handlers$HandlerDescribableAsDescribableHandler.handle(Handlers.java:146)
      	at org.forgerock.http.filter.OptionsFilter.filter(OptionsFilter.java:69)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.swagger.OpenApiRequestFilter.filter(OpenApiRequestFilter.java:62)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.grantAccess(AuthenticationFramework.java:188)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.lambda$onValidateRequestSuccess$1(AuthenticationFramework.java:181)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:252)
      	at org.forgerock.util.promise.Promises$CompletedPromise.thenAsync(Promises.java:241)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.validateRequest(AuthenticationFramework.java:144)
      	at org.forgerock.caf.authentication.framework.AuthenticationFramework.processMessage(AuthenticationFramework.java:134)
      	at org.forgerock.caf.authentication.framework.AuthenticationFilter.filter(AuthenticationFilter.java:84)
      	at org.forgerock.openidm.auth.AuthFilterWrapper.filter(AuthFilterWrapper.java:82)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.filter.TransactionIdInboundFilter.filter(TransactionIdInboundFilter.java:75)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.servlet.HttpFrameworkServlet.service(HttpFrameworkServlet.java:258)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      	at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
      	at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:365)
      	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:498)
      	at org.forgerock.openidm.servletregistration.impl.ServletRegistrationSingleton$FilterProxy.invoke(ServletRegistrationSingleton.java:284)
      	at com.sun.proxy.$Proxy54.doFilter(Unknown Source)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:257)
      	at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:220)
      	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:498)
      	at org.forgerock.openidm.servletregistration.impl.ServletRegistrationSingleton$FilterProxy.invoke(ServletRegistrationSingleton.java:284)
      	at com.sun.proxy.$Proxy54.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:71)
      	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:276)
      	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:499)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      	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:748)
      Caused by: org.forgerock.openidm.script.exception.ScriptThrownException: No content to map due to end-of-input
       at [Source: java.io.BufferedReader@45050f7d; line: 1, column: 0] {code=500, reason=Internal Server Error, message=No content to map due to end-of-input
       at [Source: java.io.BufferedReader@45050f7d; line: 1, column: 0]}
      	at org.forgerock.openidm.script.javascript.RhinoScriptEngine$3.newScriptThrownException(RhinoScriptEngine.java:424)
      	at org.forgerock.openidm.script.javascript.RhinoScript.eval(RhinoScript.java:297)
      	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:498)
      	at org.forgerock.openidm.script.registry.ScriptRegistryImpl$LibraryRecord.invoke(ScriptRegistryImpl.java:498)
      	at com.sun.proxy.$Proxy46.eval(Unknown Source)
      	at org.forgerock.openidm.script.registry.ScriptRegistryImpl$ScriptImpl.eval(ScriptRegistryImpl.java:768)
      	at org.forgerock.openidm.script.registry.ScriptRegistryImpl$ScriptImpl.eval(ScriptRegistryImpl.java:779)
      	at org.forgerock.openidm.script.handler.ScriptedRequestHandler.evaluate(ScriptedRequestHandler.java:439)
      	at org.forgerock.openidm.script.handler.ScriptedRequestHandler.handleRead(ScriptedRequestHandler.java:381)
      	... 102 more
      

      To replicate, create a custom endpoint that calls the following JS code:

      params = {
        "url" : "http://httpstat.us/204",
        "method" : "POST"
      }
      
      resp = openidm.action("external/rest", "call", params);
      logger.info("Response: {}", resp);
      

      Then perform a GET request against the appropriate custom endpoint to trigger this script.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cgdrake Chris Drake
                Reporter:
                tom.wood Tom Wood
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: