Amit Patel created CAMEL-5710:
---------------------------------

             Summary: Rest route returns Response is 500 Internal Server Error 
with expected response headers/body when response has Last-Modified in header 
as string. 
                 Key: CAMEL-5710
                 URL: https://issues.apache.org/jira/browse/CAMEL-5710
             Project: Camel
          Issue Type: Bug
            Reporter: Amit Patel


Rest route returns Response is 500 Internal Server Error with 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);
                }
            }




--
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

Reply via email to