Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-318

Restful Objects viewer returning 500 instead of 400 when given bad input

    Details

      Description

      For example, this invalid input:

      {
      "description": "Eat Seaweed",
      "category": "OTHER",
      "dueBy": "Jan 23, 2013"
      }

      using URL: http://localhost:8080/restful/services/toDoItems/actions/newToDo/invoke

      returns a 500 instead of 400 (the problem is both value formatting and the missing "value" key for each arg).

      This erroneous input:
      {
      "description":

      {"value": "Eat Seaweed"}

      ,
      "category":

      {"value": "OTHER"}

      ,
      "subcategory":

      {"value": "OTHER"}

      ,
      "dueBy":

      {"value": "Jan 23, 2013"}

      ,
      "cost":

      {"value": "123.45"}

      }

      (still) produces the stacktrace [A] below

      This erroneous input:
      {
      "description":

      {"value": "Eat Seaweed"}

      ,
      "category":

      {"value": "Other"}

      ,
      "subcategory":

      {"value": "Other"}

      ,
      "dueBy":

      {"value": "Jan 23, 2013"}

      ,
      "cost":

      {"value": "123.45"}

      }

      produces the stacktrace [B] below

      fyi the correct input is

      {
      "description":

      {"value": "Eat Seaweed"}

      ,
      "category":

      {"value": "Other"}

      ,
      "subcategory":

      {"value": "Other"}

      ,
      "dueBy":

      {"value": "20130123T000000000"}

      ,
      "cost":

      {"value": "123.45"}

      }

      ... which works.

      stacktrace [A] :

      {
      "message": "Unknown enum constant 'OTHER'",
      "stackTrace": [
      "org.apache.isis.core.progmodel.facets.object.choices.enums.EnumValueSemanticsProvider.doParse(EnumValueSemanticsProvider.java:63)",
      "org.apache.isis.core.progmodel.facets.object.choices.enums.EnumValueSemanticsProvider.doRestore(EnumValueSemanticsProvider.java:73)",
      "org.apache.isis.core.progmodel.facets.object.choices.enums.EnumValueSemanticsProvider.doRestore(EnumValueSemanticsProvider.java:32)",
      "org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract.fromEncodedString(ValueSemanticsProviderAndFacetAbstract.java:261)",
      "org.apache.isis.core.progmodel.facets.object.encodeable.EncodableFacetUsingEncoderDecoder.fromEncodedString(EncodableFacetUsingEncoderDecoder.java:60)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.JsonValueEncoder.asAdapter(JsonValueEncoder.java:163)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainResourceHelper.objectAdapterFor(DomainResourceHelper.java:332)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainResourceHelper.parseArguments(DomainResourceHelper.java:476)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainResourceHelper.parseArguments(DomainResourceHelper.java:463)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainResourceHelper.invokeActionUsingAdapters(DomainResourceHelper.java:270)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainResourceHelper.invokeAction(DomainResourceHelper.java:265)",
      "org.apache.isis.viewer.restfulobjects.viewer.resources.domainobjects.DomainObjectResourceServerside.invokeAction(DomainObjectResourceServerside.java:407)",
      "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
      "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)",
      "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
      "java.lang.reflect.Method.invoke(Method.java:601)",
      "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)",
      "org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)",
      "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)",
      "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)",
      "org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)",
      "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)",
      "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)",
      "org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)",

      stacktrace [B] :

      {
      "message" : "java.text.ParseException: Unparseable date: \"Jan 23, 2013\"",
      "stackTrace" : [ "org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal.doRestore(ValueSemanticsProviderAbstractTemporal.java:313)", "org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract.fromEncodedString(ValueSemanticsProviderAndFacetAbstract.java:261)", "org.apache.isis.core.progmodel.facets.object.encodeable.EncodableFacetUsingEncoderDecoder.fromEncodedString(EncodableFacetUsingEncoderDecoder.java:60)", "org.apache.isis.viewer.restfulobjects.rendering.domainobjects.JsonValueEncoder.asAdapter(JsonValueEncoder.java:395)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.objectAdapterFor(DomainResourceHelper.java:313)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.parseAndValidateArguments(DomainResourceHelper.java:476)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionUsingAdapters(DomainResourceHelper.java:277)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeAction(DomainResourceHelper.java:272)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainServiceResourceServerside.invokeAction(DomainServiceResourceServerside.java:173)", "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)", "org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)", "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)", "org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)", "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)", "org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)", "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:806)", "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)", "org.apache.isis.core.webapp.IsisSessionFilter$SessionState$1.handle(IsisSessionFilter.java:315)", "org.apache.isis.core.webapp.IsisSessionFilter.doFilter(IsisSessionFilter.java:404)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)", "org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)", "org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)", "org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)", "org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)", "org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)", "org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)", "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)", "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)", "org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)", "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)", "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)", "org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)", "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)", "org.mortbay.jetty.Server.handle(Server.java:326)", "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)", "org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)", "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)", "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)", "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)", "org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)", "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" ],
      "causedBy" :

      { "message" : "Unparseable date: \"Jan 23, 2013\"", "stackTrace" : [ "java.text.DateFormat.parse(Unknown Source)", "org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal.parse(ValueSemanticsProviderAbstractTemporal.java:319)", "org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal.doRestore(ValueSemanticsProviderAbstractTemporal.java:303)", "org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract.fromEncodedString(ValueSemanticsProviderAndFacetAbstract.java:261)", "org.apache.isis.core.progmodel.facets.object.encodeable.EncodableFacetUsingEncoderDecoder.fromEncodedString(EncodableFacetUsingEncoderDecoder.java:60)", "org.apache.isis.viewer.restfulobjects.rendering.domainobjects.JsonValueEncoder.asAdapter(JsonValueEncoder.java:395)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.objectAdapterFor(DomainResourceHelper.java:313)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.parseAndValidateArguments(DomainResourceHelper.java:476)", "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.invokeActionUsingAdapters(DomainResourceHelper.java:277)", }

        Attachments

          Activity

            People

            • Assignee:
              danhaywood Dan Haywood
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: