Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-10230

Premature end of file if PathParam and PUT/POST are used together

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 11.0.0.Final
    • REST
    • None
    • Hide
      • Create a simple JAXB object.
      • Create a REST endpoint with a @PUT, @PathParam, and the JAXB object
      • Execute the endpoint with a client and get "Premature end of file".
      • Remove @PathParam so that just the JAXB object is present.
      • JAXB unmarsal is successful.
      Show
      Create a simple JAXB object. Create a REST endpoint with a @PUT, @PathParam, and the JAXB object Execute the endpoint with a client and get "Premature end of file". Remove @PathParam so that just the JAXB object is present. JAXB unmarsal is successful.

      The below fails with "Premature End of File". It is a PUT with a PathParam and a JAXB serializeable entity.

      @PUT
      @Path("{tenant}")
      @Consumes(MediaType.APPLICATION_XML)
      public void upsert(@PathParam("tenant") String tenant, DataTransferModel model)
      
      2:58:03,715 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-2) RESTEASY002005: Failed executing PUT /gateway/tenant: org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException
       - with linked exception:
      [org.xml.sax.SAXParseException; Premature end of file.]
      	at org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.readFrom(AbstractJAXBProvider.java:136)
      	at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:66)
      	at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:61)
      	at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:56)
      	at org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.aroundReadFrom(DigitalVerificationInterceptor.java:36)
      	at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:59)
      	at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:151)
      	at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:92)
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:115)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:406)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:213)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:228)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      

      However, if you remove the PathParam, it works.

      @PUT
      @Path("tenant")
      @Consumes(MediaType.APPLICATION_XML)
      public void upsert(DataTransferModel model)
      

      I tried swapping the order of the parameters and I get a "Stream Closed" exception instead.

              mmarusic Marek Marusic (Inactive)
              raytucson_jira Ray Ramos (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: