Hi Erik,
Agreed. Issue logged:
https://jersey.dev.java.net/issues/show_bug.cgi?id=117
Paul.
On Oct 1, 2008, at 12:45 AM, Erik van Zijst wrote:
> Hi folks,
>
> I noticed that when I manually access a resource using POST to
> create a new record, without supplying the required request body,
> Jersey 0.9 produces a 500 response code containing a stack trace
> that indicates it could not inject the request documents as a method
> parameter.
>
> Now I would argue this should have produced a 400 (Bad Request)
> response instead of a 500, as this was caused by invalid client
> input, not a server-side problem.
>
> cheers,
> Erik van Zijst
> erik-van-zijsts-mac-pro:commons ervzijst$ cat - | nc localhost 8061
> POST /rest-service/reviews-v1 HTTP/1.1
> Authorization: Basic *****
> User-Agent: Jakarta Commons-HttpClient/3.1
> Host: 192.168.3.242:8061
> Cookie: $Version=0; crucibleprefs1=D%3D1222817071182; $Path=/
> Cookie: $Version=0; FESESSIONID=6y6b897o7f6z; $Path=/
>
> HTTP/1.1 500 Internal Server Error
> Cache-Control: private
> Content-Type: text/plain
> Transfer-Encoding: chunked
> Server: Jetty(6.1.10)
>
> 1ACC
> Exception injecting parameters to Web resource method
> com.sun.jersey.api.container.ContainerException: Exception injecting
> parameters to Web resource method
> at
> com.sun.jersey.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityParamInInvoker.getParams(EntityParamDispatchProvider.java:105)
> at
> com.sun.jersey.impl.model.method.dispatch.EntityParamDispatchProvider
> $TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:134)
> at
> com
> .sun
> .jersey
> .impl
> .model
> .method
> .dispatch
> .ResourceJavaMethodDispatcher
> .dispatch(ResourceJavaMethodDispatcher.java:81)
> at
> com
> .sun.jersey.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:
> 123)
> at
> com
> .sun
> .jersey
> .impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
> at
> com
> .sun
> .jersey
> .impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
> at
> com
> .sun
> .jersey
> .impl
> .uri
> .rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:64)
> at
> com
> .sun
> .jersey
> .impl
> .application
> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:720)
> at
> com
> .sun
> .jersey
> .impl
> .application
> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:690)
> at
> com
> .sun
> .jersey
> .spi
> .container.servlet.ServletContainer.service(ServletContainer.java:309)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1144)
> at org.springframework.web.filter.RequestContextFilter.doFilterInternal
> (RequestContextFilter.java:83)
> at
> org
> .springframework
> .web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
> 76)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> com
> .cenqua.crucible.filters.CrucibleFilter.doFilter(CrucibleFilter.java:
> 139)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> com
> .cenqua
> .fisheye.web.filters.TotalityFilter.doFilter(TotalityFilter.java:189)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> com
> .atlassian
> .security
> .auth
> .trustedapps
> .filter
> .TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98)
> at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate
> (DelegatingFilterProxy.java:236)
> at
> org
> .springframework
> .web
> .filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:81)
> at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:145)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> com
> .cenqua
> .fisheye
> .web.filters.ProductInfoFilter.doFilter(ProductInfoFilter.java:32)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> com
> .cenqua
> .fisheye.web.filters.UpfrontFilter.doFilter(UpfrontFilter.java:39)
> at org.mortbay.jetty.servlet.ServletHandler
> $Chain.doFilter(ServletHandler.java:1136)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 360)
> at
> org
> .mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 181)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 726)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 405)
> at
> org
> .mortbay
> .jetty
> .handler
> .ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
> at
> org
> .mortbay
> .jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> 505)
> at org.mortbay.jetty.HttpConnection
> $RequestHandler.headerComplete(HttpConnection.java:829)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
> at
> org
> .mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 395)
> at org.mortbay.thread.BoundedThreadPool
> $PoolThread.run(BoundedThreadPool.java:450)
> Caused by: java.lang.IllegalArgumentException: java.io.IOException:
> Error unmarshalling JAXB object of type "class
> com.atlassian.crucible.spi.rpc.RestReviewService$CreateReview".
> at
> com
> .sun
> .jersey
> .spi.container.ContainerRequest.getEntity(ContainerRequest.java:243)
> at
> com.sun.jersey.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityInjectable.getValue(EntityParamDispatchProvider.java:81)
> at
> com.sun.jersey.impl.model.method.dispatch.EntityParamDispatchProvider
> $EntityParamInInvoker.getParams(EntityParamDispatchProvider.java:99)
> ... 46 more
> Caused by: java.io.IOException: Error unmarshalling JAXB object of
> type "class com.atlassian.crucible.spi.rpc.RestReviewService
> $CreateReview".
> at
> com
> .sun
> .jersey
> .impl
> .provider
> .entity.XMLRootElementProvider.readFrom(XMLRootElementProvider.java:
> 98)
> at
> com
> .sun
> .jersey
> .spi.container.ContainerRequest.getEntity(ContainerRequest.java:241)
> ... 48 more
> Caused by: javax.xml.bind.UnmarshalException
> - with linked exception:
> [org.xml.sax.SAXParseException: Premature end of file.]
> at
> javax
> .xml
> .bind
> .helpers
> .AbstractUnmarshallerImpl
> .createUnmarshalException(AbstractUnmarshallerImpl.java:315)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller
> .UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:476)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:198)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:167)
> at
> javax
> .xml
> .bind
> .helpers
> .AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
> at
> javax
> .xml
> .bind
> .helpers
> .AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
> at
> com
> .sun
> .jersey
> .impl
> .provider
> .entity.XMLRootElementProvider.readFrom(XMLRootElementProvider.java:
> 96)
> ... 49 more
> Caused by: org.xml.sax.SAXParseException: Premature end of file.
> at
> org
> .apache
> .xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown
> Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> at
> org
> .apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at
> com
> .sun
> .xml
> .bind
> .v2
> .runtime
> .unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:194)
> ... 53 more
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net