• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

JAXB Custom Validation Handler is not receiving control during Exception

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am getting NumberFormatException during JAXB Unmarshal. The exception does not provide line number or the field which is having the incorrect value. I tried to create my own validation handler. But when the exception happens, the control is not coming into my custom validation handler. I am using JAXB 2.0.
By manual verification, I later found that this is happening due to an attribute of a field having wrong data. The attribute is a BigDecimal and value came in was empty (""), which trigggered the exception.

Why does the JAXB not reaching my custom validation handler during an exception? Are there any other ways are there for me to find out the field / attribute which has caused the exception?

Sudeep
 
M Sud
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Can anyone help me with this?

 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
M Sud,

I would try using a tool such as XML Schema Validator .

Regards,
Dan
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
In order for JAXB to perform validation against a XML schema, the Marshaller or Unmarshaller has to be configured with the schema to validate against.
Example:

I don't know how to accomplish this with generated stubs, though.

If you manage to obtain the XML fragment sent with the request, you can validate it against the XML schema using the Eclipse IDE.
Best wishes!
 
reply
    Bookmark Topic Watch Topic
  • New Topic