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

Jaxb unmarshall populating wrong value instead of exception when value type given wrong in Camel rest binding mode in rest DSL



    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Works for Me
    • 2.18.3, 2.20.1, 2.21.0
    • 2.21.0
    • camel-jaxb, camel-jetty
    • None
    • Unknown


      I am using camel rest DSL and enabled the rest binding feature to convert my xml to POJO internally after I receive the xml as input.So I am using RestBindingMode.xml.
      Now In my XSD I have one long field let say my zipcode. In XML I am providing some string in the zipcode field like "ABC". Now when the internal restbinding happen it is not throwing any NumberFormatException for this instead it is populating "0" in the zipcode field.
      I am using JAXB plugin in POM file that is generating the POJO class from my XSD automatically and using JAXB jar file in my classpath.

      input xml
      <?xml version="1.0" encoding="utf-8"?>

      output xml

      Tested with newer version but no luck !!

      The zipcode in the output xml is "0". That should not be the ideal case. I am passing a String "ABC" in the zipcode field which is long as per my xsd. So it should throw exception. But it is populating "0" when using RestBinding. I have attached source code below. This is a maven project.

      In the log in my route it is shown that the xml is getting changed.

      Please let me know if you need more details.


        1. springboot-camel.rar
          37.27 MB
          Arnab Santra



            davsclaus Claus Ibsen
            arnab.santra85@gmail.com Arnab Santra
            0 Vote for this issue
            2 Start watching this issue