I think that's a great idea. Let me change the code.
The state machine management is tricky, so I might have to roll it back
if this causes a lot of regressions, but let's see how it goes...
Vallamshettla, Anand wrote:
> Would really appreciate if someone answers the following question?
>
> -----Original Message-----
> From: Vallamshettla, Anand
> Sent: Thursday, March 31, 2005 2:32 PM
> To: users_at_jaxb.dev.java.net
> Subject: Unexpected end element fatal error when invalid value is
> present for an element
>
>
> Using Jswdp 1.5 (validations turned off), when unmarshalling XML file
> with a "Date" type field containing invalid data, parser is throwing
> unexpected end element fatal error and the file is not parsed.
>
> For ex:
> If XML file contains element
> <ResidencyEstablishedDate>1967-08-13fdsfsd</ResidencyEstablishedDate>
>
> Then parser is reporting that data is invalid and then reports a fatal
> unexpected end element error on ResidencyEstablishedDate.
>
> I looked into generated code where actual error is being thrown
>
>
> Generated code:
> ---------------
>
> public void handleText(final java.lang.String value)
> throws org.xml.sax.SAXException
> {
> int attIdx;
> outer:
> while (true) {
> try {
> switch (state) {
> case 6 :
> revertToParentFromText(value);
> return ;
> case 4 :
> eatText1(value);
> state = 5;
> return ;
> case 1 :
> eatText2(value);
> state = 2;
> return ;
> case 0 :
> state = 3;
> continue outer;
> case 3 :
> state = 6;
> continue outer;
> }
> } catch (java.lang.RuntimeException e) {
> handleUnexpectedTextException(value, e);
> }
> break;
> }
> }
>
> When error occurs on eatText1 method, 'state' is not set to a valid
> state and hence fatal error occurs on leaveElement.
>
> Solution:
> ---------
>
> I changed the code to set the state before eatText1 and it worked as the
> Unmarshaller is in correct state to handle the end element.
>
> Please let me know if it is a bug and if it can be fixed in next
> release.
>
> Thanks,
> Anand.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com