Andre Couture
Andre Couture

Reputation: 51

jaxb-runtime-2.3.0 java.lang.NumberFormatException: Not a n│ umber: undefined

While I've seen other very similar questions, I haven't found one that give me a proper solution.

I have XML coming in like this

<w id="103" start="0" duration="0" />                                                                                                                                       │
<w id="undefined" start="0" duration="0" />

The attribute "id" is defined as

  <xs:attribute name="id" use="required" type="xs:int"/>

When the request is unmarshalled it crash with this message

 java.lang.NumberFormatException: Not a number: undefined

   at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:125) [jaxb-runtime-2.3.0.jar:2.3.0]          

From other post I would need to create a XmlAdapter but I'm not sure on what class and how to put this in my existing code.

What I'd like to do is to simply ignore those line for which the id="undefined" without rejecting the entire request which lead to loosing data.

Upvotes: 0

Views: 387

Answers (0)

Related Questions