Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-11403

org.nuxeo.ecm.automation.OperationException should not be mapped to HTTP 500

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.2
    • Fix Version/s: 5.7.1
    • Component/s: Automation
    • Tags:
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      Kept org.nuxeo.ecm.automation.OperationException mapping with HTTP 500 waiting for NXP-11094.
      Made Drive wrap java.lang.UnsupportedOperationException into a new org.nuxeo.ecm.automation.InvalidOperationException, itself mapped with HTTP 400.
      Also, made the org.nuxeo.ecm.automation.server.jaxrs.ExceptionHandler map org.nuxeo.ecm.core.api.ClientException with no root cause to HTTP 400.

      Show
      Kept org.nuxeo.ecm.automation.OperationException mapping with HTTP 500 waiting for NXP-11094 . Made Drive wrap java.lang.UnsupportedOperationException into a new org.nuxeo.ecm.automation.InvalidOperationException, itself mapped with HTTP 400. Also, made the org.nuxeo.ecm.automation.server.jaxrs.ExceptionHandler map org.nuxeo.ecm.core.api.ClientException with no root cause to HTTP 400.

      Description

      Looking at the following stacktrace logged on server side:

      Apr 11, 2013 6:34:10 PM com.sun.jersey.spi.container.ContainerResponse logException
      18:34:10 SEVERE: Mapped exception to response: 500 (Internal Server Error)
      18:34:10 javax.ws.rs.WebApplicationException: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation NuxeoDrive.Move
      18:34:10 	at org.nuxeo.ecm.automation.server.jaxrs.ExceptionHandler.newException(ExceptionHandler.java:50)
      18:34:10 	at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost(ExecutableResource.java:77)
      18:34:10 	at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
      18:34:10 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      18:34:10 	at java.lang.reflect.Method.invoke(Method.java:597)
      18:34:10 	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
      18:34:10 	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ObjectOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:258)
      18:34:10 	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      18:34:10 	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
      18:34:10 	at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
      18:34:10 	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      18:34:10 	at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      18:34:10 	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      18:34:10 	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      18:34:10 	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
      18:34:10 	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
      18:34:10 	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      18:34:10 	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      18:34:10 	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      18:34:10 	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      18:34:10 	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
      18:34:10 	at org.nuxeo.ecm.webengine.app.jersey.WebEngineServlet.containerService(WebEngineServlet.java:60)
      18:34:10 	at org.nuxeo.ecm.webengine.app.jersey.WebEngineServlet.service(WebEngineServlet.java:44)
      18:34:10 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
      18:34:10 	at org.nuxeo.ecm.webengine.jaxrs.context.RequestContextFilter.run(RequestContextFilter.java:42)
      18:34:10 	at org.nuxeo.ecm.webengine.jaxrs.HttpFilter.doFilter(HttpFilter.java:43)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      18:34:10 	at org.nuxeo.ecm.webengine.jaxrs.session.SessionCleanupFilter.run(SessionCleanupFilter.java:45)
      18:34:10 	at org.nuxeo.ecm.webengine.jaxrs.HttpFilter.doFilter(HttpFilter.java:43)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      18:34:10 	at org.nuxeo.ecm.webengine.app.WebEngineFilter.doFilter(WebEngineFilter.java:92)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      18:34:10 	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilterInternal(NuxeoAuthenticationFilter.java:548)
      18:34:10 	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilter(NuxeoAuthenticationFilter.java:345)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
      18:34:10 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
      18:34:10 	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      18:34:10 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      18:34:10 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      18:34:10 	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      18:34:10 	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      18:34:10 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      18:34:10 	at org.mortbay.jetty.Server.handle(Server.java:322)
      18:34:10 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      18:34:10 	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      18:34:10 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      18:34:10 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      18:34:10 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      18:34:10 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      18:34:10 	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
      18:34:10 Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation NuxeoDrive.Move
      18:34:10 	at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:140)
      18:34:10 	at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:114)
      18:34:10 	at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:96)
      18:34:10 	at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:81)
      18:34:10 	at org.nuxeo.ecm.automation.server.jaxrs.OperationResource.execute(OperationResource.java:42)
      18:34:10 	at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost(ExecutableResource.java:56)
      18:34:10 	... 50 more
      18:34:10 Caused by: java.lang.UnsupportedOperationException: Cannot move a virtual folder item.
      18:34:10 	at org.nuxeo.drive.adapter.impl.AbstractVirtualFolderItem.move(AbstractVirtualFolderItem.java:90)
      18:34:10 	at org.nuxeo.drive.service.impl.FileSystemItemManagerImpl.move(FileSystemItemManagerImpl.java:230)
      18:34:10 	at org.nuxeo.drive.operations.NuxeoDriveMove.run(NuxeoDriveMove.java:55)
      18:34:10 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      18:34:10 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      18:34:10 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      18:34:10 	at java.lang.reflect.Method.invoke(Method.java:597)
      18:34:10 	at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:117)
      18:34:10 	at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:132)
      18:34:10 	... 55 more

      The error is known and well managed server side ("Cannot move a virtual folder item"). It is logged at level SEVERE because the HTTP status is 500, which is wrong.

      => Manage java.lang.UnsupportedOperationException and/or org.nuxeo.ecm.automation.OperationException in org.nuxeo.ecm.automation.server.jaxrs.ExceptionHandler.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: