[
https://issues.apache.org/jira/browse/CAMEL-5710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Amit Patel updated CAMEL-5710:
------------------------------
Description:
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);
}
}
was:
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);
}
}
Summary: Rest route returns Response with http Status code 500 Internal
Server Error when response has Last-Modified or Header-expires in header as
string. (was: Rest route returns Response is 500 Internal Server Error with
expected response headers/body when response has Last-Modified in header as
string. )
> 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
> Priority: Critical
>
> 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);
> }
> }
--
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