users@jaxb.java.net

SOA, noValidator, noValidatingUnmarshaller

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 28 Sep 2005 18:18:50 +0200

Hi.

Returning back to the SOA/serialization issue.

Maybe I miss something, but even having <xjc:noValidatingUnmarshaller/>
and <xjc:noValidator/>, XJC still generates bgm.ser files. This seems
like a bug, but I'm not 100% sure.

Take a look at the com.sun.tools.xjc.generator.ObjectFactoryGenerator.
Here's the code that produces bgm.ser:

         Grammar purifiedGrammar = AGMBuilder.remove( grammar );
         try {
             targetPackage.addResourceFile( new JSerializedObject(
                 "bgm.ser",purifiedGrammar) );
         } catch( IOException e ) {
             // we know that BGM can be always serialized. So this
shouldn't be possible
             throw new JAXBAssertionError(e);
         }

I could not find where noValidation or noValidatingUnmarshaller turn
this generation off.

I've added one line to make bgm.ser conditional:

         Grammar purifiedGrammar = AGMBuilder.remove( grammar );
         if (_opt.generateValidatingUnmarshallingCode ||
_opt.generateValidationCode )
         try {
             targetPackage.addResourceFile( new JSerializedObject(
                 "bgm.ser",purifiedGrammar) );
         } catch( IOException e ) {
             // we know that BGM can be always serialized. So this
shouldn't be possible
             throw new JAXBAssertionError(e);
         }

If I'm not mistaken and this fix is appropriate, could you apply it?

It goes about JAXB 1.0, I've got latest checkout from CVS.

Bye.
/lexi