[jbossws-issues] [JBoss JIRA] Updated: (JBWS-2686) Parsing errors fail to terminate unmarshalling

Alessio Soldano (JIRA) jira-events at lists.jboss.org
Thu Jul 16 08:54:29 EDT 2009


     [ https://jira.jboss.org/jira/browse/JBWS-2686?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alessio Soldano updated JBWS-2686:
----------------------------------

    Fix Version/s:     (was: jbossws-native-3.2.0)


I've tested and committed the workaround, thanks Darran.

Unscheduling this while waiting for Sun to apply you patch. Then we'll remove the workaround.

> Parsing errors fail to terminate unmarshalling
> ----------------------------------------------
>
>                 Key: JBWS-2686
>                 URL: https://jira.jboss.org/jira/browse/JBWS-2686
>             Project: JBoss Web Services
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: jbossws-native
>    Affects Versions:  jbossws-native-3.1.2
>            Reporter: Darran Lofthouse
>            Assignee: Alessio Soldano
>
> If a message received suffers an error converting a value the error is silently dropped and the field is left initialised with the default value.
> i.e. if an NumberFormatExceptions are thrown converting Strings to longs then the NumberFormatException is dropped and the field left to the default value.
> The Unmarshaller should by default terminate for the first error or fatal error, currently it only terminates for a fatal error: -
> http://java.sun.com/javaee/5/docs/api/javax/xml/bind/Unmarshaller.html#setEventHandler%28javax.xml.bind.ValidationEventHandler%29
> This is a JAXB issue as raised here: -
>   https://jaxb.dev.java.net/issues/show_bug.cgi?id=655
> A workaround could be to add a ValidationEventHandler with this behaviour to our JAXBDeserializer: -
>          Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
>          unmarshaller.setAttachmentUnmarshaller( new AttachmentUnmarshallerImpl());
>          unmarshaller.setEventHandler(new ValidationEventHandler() {
>             public boolean handleEvent(final ValidationEvent event)
>             {
>                int severity = event.getSeverity();
>                return (severity != ValidationEvent.FATAL_ERROR && severity != ValidationEvent.ERROR);
>             }
>          });
>          
>          JAXBElement jbe = unmarshaller.unmarshal(xmlFragment, javaType);
>          value = jbe.getValue();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbossws-issues mailing list