You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marc Giger <gi...@gmx.ch> on 2010/11/16 09:50:05 UTC

JAXBEncoderDecoder.unmarshalWithBridge

Hi all,

In the DataReaderImpl class (line ~131 - 150) you will find the following code:

//The jaxb class contains XMLGregorianCalendar field also needs JAXB Bridge
        if (part != null && part.getTypeClass() != null) {
            boolean useJAXBBridge = false;
            for (Field field : part.getTypeClass().getDeclaredFields()) {
                if (field.getType().equals(XMLGregorianCalendar.class)) {
                    useJAXBBridge = true;
                    break;
                }
            }
            if (useJAXBBridge) {
                return JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(), 
                                                              part.getTypeClass(),
                                                              part.getTypeClass().getAnnotations(),
                                                              databinding.getContextClasses(), 
                                                              reader,
                                                              getAttachmentUnmarshaller());
            }
        }
        
        
        return JAXBEncoderDecoder.unmarshall(createUnmarshaller(), reader, part, 
                                             unwrapJAXBElement);

What is the reason to use a Bridge when a XMLGregorianCalendar is declared?

If an operation has a xs:dateTime as parameter, the bridge will be used and
no schema validation can be performed.

Kind regards

Marc



-- 

itServe AG
Marc Giger
Länggassstrasse 26
3000 Bern 9
Tel.: +41 31 305 16 16
Fax:  +41 31 305 16 17

Direkt +41 31 305 43 27
Email marc.giger@itserve.ch

http://www.itserve.ch

Re: JAXBEncoderDecoder.unmarshalWithBridge

Posted by Marc Giger <gi...@gmx.ch>.
Ok, good to know. I can confirm that the latest JAXB implementation
handles the XMLGregorianCalendar just fine.

Thanks

Marc


On Wed, 17 Nov 2010 13:59:57 +0800
Jim Ma <ma...@gmail.com> wrote:

> Thanks Dan ! That is really some special thing for
> XMLGregorianCalendar  in JAXB to handle the things as JAXWS 2.2 TCK
> expected.  Good to know it has been fixed in the latest JAXB impl.
> 
> Jim
> 
> On Wed, Nov 17, 2010 at 7:39 AM, Daniel Kulp <dk...@apache.org> wrote:
> > On Tuesday 16 November 2010 5:40:52 pm Daniel Kulp wrote:
> >> Honestly, I'm not sure.   The code was added as part of:
> >>
> >> https://issues.apache.org/jira/browse/CXF-2868
> >>
> >> but I'm not really sure why that doesn't work without the bridge.   Jim?
> >
> > I added a test case for CXF-2868  and it seems to pass fine.   Thus, it's
> > likely that it was a bug in JAXB that is now fixed with the latest JAXB
> > implementations.     I'll revert out the change for CXF-2868.
> >
> > Dan
> >
> >
> >>
> >> Dan
> >>
> >> On Tuesday 16 November 2010 3:50:05 am Marc Giger wrote:
> >> > Hi all,
> >> >
> >> > In the DataReaderImpl class (line ~131 - 150) you will find the following
> >> > code:
> >> >
> >> > //The jaxb class contains XMLGregorianCalendar field also needs JAXB
> >> > Bridge
> >> >
> >> >         if (part != null && part.getTypeClass() != null) {
> >> >
> >> >             boolean useJAXBBridge = false;
> >> >             for (Field field : part.getTypeClass().getDeclaredFields()) {
> >> >
> >> >                 if (field.getType().equals(XMLGregorianCalendar.class)) {
> >> >
> >> >                     useJAXBBridge = true;
> >> >                     break;
> >> >
> >> >                 }
> >> >
> >> >             }
> >> >             if (useJAXBBridge) {
> >> >
> >> >                 return
> >> >
> >> > JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(),
> >> > part.getTypeClass(), part.getTypeClass().getAnnotations(),
> >> > databinding.getContextClasses(), reader, getAttachmentUnmarshaller()); }
> >> >
> >> >         }
> >> >
> >> >
> >> >         return JAXBEncoderDecoder.unmarshall(createUnmarshaller(),
> >> >         reader,
> >> >
> >> > part, unwrapJAXBElement);
> >> >
> >> > What is the reason to use a Bridge when a XMLGregorianCalendar is
> >> > declared?
> >> >
> >> > If an operation has a xs:dateTime as parameter, the bridge will be used
> >> > and no schema validation can be performed.
> >> >
> >> > Kind regards
> >> >
> >> > Marc
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://dankulp.com/blog
> >


Re: JAXBEncoderDecoder.unmarshalWithBridge

Posted by Jim Ma <ma...@gmail.com>.
Thanks Dan ! That is really some special thing for
XMLGregorianCalendar  in JAXB to handle the things as JAXWS 2.2 TCK
expected.  Good to know it has been fixed in the latest JAXB impl.

Jim

On Wed, Nov 17, 2010 at 7:39 AM, Daniel Kulp <dk...@apache.org> wrote:
> On Tuesday 16 November 2010 5:40:52 pm Daniel Kulp wrote:
>> Honestly, I'm not sure.   The code was added as part of:
>>
>> https://issues.apache.org/jira/browse/CXF-2868
>>
>> but I'm not really sure why that doesn't work without the bridge.   Jim?
>
> I added a test case for CXF-2868  and it seems to pass fine.   Thus, it's
> likely that it was a bug in JAXB that is now fixed with the latest JAXB
> implementations.     I'll revert out the change for CXF-2868.
>
> Dan
>
>
>>
>> Dan
>>
>> On Tuesday 16 November 2010 3:50:05 am Marc Giger wrote:
>> > Hi all,
>> >
>> > In the DataReaderImpl class (line ~131 - 150) you will find the following
>> > code:
>> >
>> > //The jaxb class contains XMLGregorianCalendar field also needs JAXB
>> > Bridge
>> >
>> >         if (part != null && part.getTypeClass() != null) {
>> >
>> >             boolean useJAXBBridge = false;
>> >             for (Field field : part.getTypeClass().getDeclaredFields()) {
>> >
>> >                 if (field.getType().equals(XMLGregorianCalendar.class)) {
>> >
>> >                     useJAXBBridge = true;
>> >                     break;
>> >
>> >                 }
>> >
>> >             }
>> >             if (useJAXBBridge) {
>> >
>> >                 return
>> >
>> > JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(),
>> > part.getTypeClass(), part.getTypeClass().getAnnotations(),
>> > databinding.getContextClasses(), reader, getAttachmentUnmarshaller()); }
>> >
>> >         }
>> >
>> >
>> >         return JAXBEncoderDecoder.unmarshall(createUnmarshaller(),
>> >         reader,
>> >
>> > part, unwrapJAXBElement);
>> >
>> > What is the reason to use a Bridge when a XMLGregorianCalendar is
>> > declared?
>> >
>> > If an operation has a xs:dateTime as parameter, the bridge will be used
>> > and no schema validation can be performed.
>> >
>> > Kind regards
>> >
>> > Marc
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Re: JAXBEncoderDecoder.unmarshalWithBridge

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 16 November 2010 5:40:52 pm Daniel Kulp wrote:
> Honestly, I'm not sure.   The code was added as part of:
> 
> https://issues.apache.org/jira/browse/CXF-2868
> 
> but I'm not really sure why that doesn't work without the bridge.   Jim?

I added a test case for CXF-2868  and it seems to pass fine.   Thus, it's 
likely that it was a bug in JAXB that is now fixed with the latest JAXB 
implementations.     I'll revert out the change for CXF-2868.

Dan


> 
> Dan
> 
> On Tuesday 16 November 2010 3:50:05 am Marc Giger wrote:
> > Hi all,
> > 
> > In the DataReaderImpl class (line ~131 - 150) you will find the following
> > code:
> > 
> > //The jaxb class contains XMLGregorianCalendar field also needs JAXB
> > Bridge
> > 
> >         if (part != null && part.getTypeClass() != null) {
> >         
> >             boolean useJAXBBridge = false;
> >             for (Field field : part.getTypeClass().getDeclaredFields()) {
> >             
> >                 if (field.getType().equals(XMLGregorianCalendar.class)) {
> >                 
> >                     useJAXBBridge = true;
> >                     break;
> >                 
> >                 }
> >             
> >             }
> >             if (useJAXBBridge) {
> >             
> >                 return
> > 
> > JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(),
> > part.getTypeClass(), part.getTypeClass().getAnnotations(),
> > databinding.getContextClasses(), reader, getAttachmentUnmarshaller()); }
> > 
> >         }
> >         
> >         
> >         return JAXBEncoderDecoder.unmarshall(createUnmarshaller(),
> >         reader,
> > 
> > part, unwrapJAXBElement);
> > 
> > What is the reason to use a Bridge when a XMLGregorianCalendar is
> > declared?
> > 
> > If an operation has a xs:dateTime as parameter, the bridge will be used
> > and no schema validation can be performed.
> > 
> > Kind regards
> > 
> > Marc

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: JAXBEncoderDecoder.unmarshalWithBridge

Posted by Daniel Kulp <dk...@apache.org>.
Honestly, I'm not sure.   The code was added as part of:

https://issues.apache.org/jira/browse/CXF-2868

but I'm not really sure why that doesn't work without the bridge.   Jim?

Dan


On Tuesday 16 November 2010 3:50:05 am Marc Giger wrote:
> Hi all,
> 
> In the DataReaderImpl class (line ~131 - 150) you will find the following
> code:
> 
> //The jaxb class contains XMLGregorianCalendar field also needs JAXB Bridge
>         if (part != null && part.getTypeClass() != null) {
>             boolean useJAXBBridge = false;
>             for (Field field : part.getTypeClass().getDeclaredFields()) {
>                 if (field.getType().equals(XMLGregorianCalendar.class)) {
>                     useJAXBBridge = true;
>                     break;
>                 }
>             }
>             if (useJAXBBridge) {
>                 return
> JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(),
> part.getTypeClass(), part.getTypeClass().getAnnotations(),
> databinding.getContextClasses(), reader, getAttachmentUnmarshaller()); }
>         }
> 
> 
>         return JAXBEncoderDecoder.unmarshall(createUnmarshaller(), reader,
> part, unwrapJAXBElement);
> 
> What is the reason to use a Bridge when a XMLGregorianCalendar is declared?
> 
> If an operation has a xs:dateTime as parameter, the bridge will be used and
> no schema validation can be performed.
> 
> Kind regards
> 
> Marc

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog