jaxb-ri
jaxb-ri copied to clipboard
JAXB fails to generate ValidationEvents for several errors
With JAXB 2.0, you can set an EventHandler to inform JAXB whether or not to continue processing whenever it detects an error. However, the current implementation fails to properly generate this event on several occasions, amongst others:
- A given string is not correctly mapped to an enum value, as described here: http://stackoverflow.com/questions/12147306/handling-invalid-enum-values-while-doing-jaxb-unmarshalling
- An xs:int that gets an integer out of bounds (for instance Integer.MAX_VALUE+1L)
- An xs:short that gets a short out of bounds (for instance Short.MAX_VALUE+1L)
- A boolean value that are not within the specification allowed values ("0", "1", "true", "false")
While these errors perhaps should not stop the continued JAXB processing per se, the event should be generated and the event handler should be able to decide whether or not the processing should stop (as its documentation states).
I have some test cases and made some changes to the JAXB classes, so the fix is fairly trivial (and in some cases, for instance in DatatypeConverterImpl, the exceptions were already there, just commented out - was this from 1.0, before the ValidationEvent were introduced?) Would like to share the changes with you if I can get git access.
Environment
Any Java enviroment (seen on Windows and RHEL)
Affected Versions
[2.2.6]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/952
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by anolepk
@glassfishrobot Commented yaroska said: Hi,
To be able to contribute please sign Oracle Contributor Agreement 1 (OCA), scan it and e-mail the result to oracle-ca_us(at)oracle.com. More about it you can read in 2.
@glassfishrobot Commented mapar70 said: I'm also running into this issue. Is there any update? Thanks.
@glassfishrobot Commented Was assigned to yaroska
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-952