You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2012/10/18 07:38:03 UTC

[jira] [Resolved] (CAMEL-5710) Rest route returns response with http Status code 500 Internal Server Error when response has Last-Modified or Header-expires in header as string.

     [ https://issues.apache.org/jira/browse/CAMEL-5710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-5710.
--------------------------------

    Resolution: Fixed

Thanks for reporting.
                
> Rest route returns response with http Status code 500 Internal Server Error when response has Last-Modified or Header-expires in header as string. 
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5710
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5710
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-restlet
>    Affects Versions: 2.10.1
>            Reporter: Amit Patel
>            Assignee: Claus Ibsen
>             Fix For: 2.9.5, 2.10.3, 2.11.0
>
>
> Rest route returns Response with http Status code 500 Internal Server Error and expected response headers/body when response has Last-Modified or Header-expires in header as string. 
> I found the issue in below code it try to convert string Wed, 31 Dec 1969 18:00:00 CS to Date and it fails. Is it posible to convert String Date without knowing Date format?
> DefaultRestletBinding
> =======================
>  if (header.equalsIgnoreCase(HeaderConstants.HEADER_LAST_MODIFIED)) {
>                 if (value instanceof Calendar) {
>                     message.getEntity().setModificationDate(((Calendar) value).getTime());
>                 } else if (value instanceof Date) {
>                     message.getEntity().setModificationDate((Date) value);
>                 } else {
>                     Date date = exchange.getContext().getTypeConverter().mandatoryConvertTo(Date.class, value); //  Here it try to convert String to Date it throws No type converter available to convert from type: java.lang.String to the required type: java.util.Date with value Wed, 31 Dec 1969 18:00:00 CS
>                     message.getEntity().setModificationDate(date);
>                 }
>             }
> Stack trace
> ===========
> 7 Oct 2012 08:28:06,010 WARN org.restlet.Component.StatusFilter - Exception or error caught in status service
> org.apache.camel.RuntimeCamelException: Cannot process request
>         at org.apache.camel.component.restlet.RestletConsumer$1.handle(RestletConsumer.java:62)
>         at org.apache.camel.component.restlet.MethodBasedRouter.handle(MethodBasedRouter.java:54)
>         at org.restlet.routing.Filter.doHandle(Filter.java:159)
>         at org.restlet.routing.Filter.handle(Filter.java:206)
>         at org.restlet.routing.Router.doHandle(Router.java:500)
>         at org.restlet.routing.Router.handle(Router.java:740)
>         at org.restlet.routing.Filter.doHandle(Filter.java:159)
>         at org.restlet.routing.Filter.handle(Filter.java:206)
>         at org.restlet.routing.Router.doHandle(Router.java:500)
>         at org.restlet.routing.Router.handle(Router.java:740)
>         at org.restlet.routing.Filter.doHandle(Filter.java:159)
>         at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:154)
>         at org.restlet.routing.Filter.handle(Filter.java:206)
>         at org.restlet.routing.Filter.doHandle(Filter.java:159)
>         at org.restlet.routing.Filter.handle(Filter.java:206)
>         at org.restlet.engine.ChainHelper.handle(ChainHelper.java:114)
>         at org.restlet.Component.handle(Component.java:391)
>         at org.restlet.Server.handle(Server.java:491)
>         at org.restlet.engine.ServerHelper.handle(ServerHelper.java:75)
>         at org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:153)
>         at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1031)
>         at org.apache.shiro.grails.SavedRequestFilter.doFilter(SavedRequestFilter.java:56)
>         at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:360)
>         at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:276)
>         at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
>         at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
>         at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:344)
>         at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:272)
>         at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: java.lang.String to the required type: java.util.Date with value Wed, 31 Dec 1969 18:00:00 CST
>         at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:169)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira