Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15026

Camel throws exception on HHTP response Content-Type header with additional info

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.21.0
    • 2.21.1
    • camel-http4
    • None
    • Unknown

    Description

      Camel throws an TypeConversionException when receiving a HTTP response, where the Content-Type header includes extended information, e.g. version info.

      org.apache.http.headers - [CID=879adbb4-d406-40e7-8529-5a20427157bf] - http-outgoing-0 << HTTP/1.1 400 Bad Request
      org.apache.http.headers - [CID=879adbb4-d406-40e7-8529-5a20427157bf] - http-outgoing-0 << Content-Type: application/json; charset=utf-8; v=1.0
      ...

      org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: java.lang.String with value [Body is instance of java.io.InputStream] due utf-8; v=1.0
      ....
      Caused by: java.io.UnsupportedEncodingException: utf-8; v=1.0
      at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:71)

      The exception throw is TypeConversionException and the response to the caller of route will get a 404 error back, even though the original response code was 400.

      It appears that Camel doesn't handle the ; v=1.0 part of the content-type header.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bslaterdk Benny Slater
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: