axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Davis" <...@us.ibm.com>
Subject RE: cvs commit: xml-axis/java/src/org/apache/axis/encoding TypeMa ppingRegistry.java
Date Wed, 12 Dec 2001 19:47:06 GMT
it fails - please replace the code with the old stuff.
The new Element test fails.
-Dug


Glen Daniels <gdaniels@macromedia.com> on 12/12/2001 02:38:30 PM

Please respond to axis-dev@xml.apache.org

To:   "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
cc:
Subject:  RE: cvs commit: xml-axis/java/src/org/apache/axis/encoding TypeMa
       ppingRegistry.java




I meant the code I added changed the semantics, which was bad.  I just
fixed
it, please do test.  The current code checks every directly implemented
interface, then all their parents, then does the same for the superclass.

--G

> -----Original Message-----
> From: Doug Davis [mailto:dug@us.ibm.com]
> Sent: Wednesday, December 12, 2001 2:34 PM
> To: axis-dev@xml.apache.org
> Subject: RE: cvs commit: xml-axis/java/src/org/apache/axis/encoding
> TypeMa ppingRegistry.java
>
>
> I'm confused - you're complaining about the code you added or
> the code I
> added?  The order of checking is *very* important - I found
> that I needed
> to checked everything at one level (including interfaces)
> before going up
> the hierarchy.  I'll update and test.
> -Dug
>
>
> Glen Daniels <gdaniels@macromedia.com> on 12/12/2001 02:24:52 PM
>
> Please respond to axis-dev@xml.apache.org
>
> To:   "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
> cc:
> Subject:  RE: cvs commit:
> xml-axis/java/src/org/apache/axis/encoding TypeMa
>       ppingRegistry.java
>
>
>
>
> Hm.  The semantics of this aren't right, are they....  You
> need to search
> all the lower level ones before going up the tree.  Sigh.  I
> was really
> hoping to avoid using collections here.
>
> --G
>
> > -----Original Message-----
> > From: gdaniels@apache.org [mailto:gdaniels@apache.org]
> > Sent: Wednesday, December 12, 2001 2:15 PM
> > To: xml-axis-cvs@apache.org
> > Subject: cvs commit: xml-axis/java/src/org/apache/axis/encoding
> > TypeMappingRegistry.java
> >
> >
> > gdaniels    01/12/12 11:14:47
> >
> >   Modified:    java/src/org/apache/axis/encoding
> > TypeMappingRegistry.java
> >   Log:
> >   Clean up / speed up search for Serializers.
> >
> >   Revision  Changes    Path
> >   1.41      +29 -27
> > xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java
> >
> >   Index: TypeMappingRegistry.java
> >
> ===================================================================
> >   RCS file:
> > /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappi
> > ngRegistry.java,v
> >   retrieving revision 1.40
> >   retrieving revision 1.41
> >   diff -u -r1.40 -r1.41
> >   --- TypeMappingRegistry.java   2001/12/12 18:54:08  1.40
> >   +++ TypeMappingRegistry.java   2001/12/12 19:14:47  1.41
> >   @@ -236,6 +236,34 @@
> >                               "CDATA", context.qName2String(type));
> >            return attrs;
> >        }
> >   +
> >   +    /**
> >   +     * Utility method to help us find an appropriate Serializer.
> >   +     *
> >   +     */
> >   +    private Serializer findSerializer(Class cls)
> >   +    {
> >   +        if ((cls == null) || (cls == Object.class))
> >   +            return null;
> >   +
> >   +        // If we find one for this class itself, use it.
> >   +        Serializer ser = getSerializer(cls);
> >   +        if (ser != null)
> >   +            return ser;
> >   +
> >   +        // Search implemented interfaces
> >   +        if (!cls.isInterface()) {
> >   +            Class [] interfaces = cls.getInterfaces();
> >   +            for (int i = 0 ; i < interfaces.length ; i++ ) {
> >   +                ser = findSerializer(interfaces[i]);
> >   +                if (ser != null)
> >   +                    return ser;
> >   +            }
> >   +        }
> >   +
> >   +        // Search up the inheritance tree from here
> >   +        return findSerializer(cls.getSuperclass());
> >   +    }
> >
> >        public void serialize(QName name, Attributes attributes,
> >                              Object value,
> > SerializationContext context)
> >   @@ -244,34 +272,8 @@
> >            if (value != null) {
> >                Serializer  ser     = null ;
> >                Class       _class  = null ;
> >   -
> >   -            // Check the most common case first
> >   -            ser = getSerializer( _class = value.getClass() );
> >   -            if ( ser == null ) {
> >   -                // Use a Vector and remove(0) because it MUST be
> >   -                // first-in-first-out
> >   -                Vector  classes = new Vector();
> >   -                classes.add( _class );
> >   -
> >   -                while( classes.size() != 0 ) {
> >   -                    _class = (Class) classes.remove( 0 );
> >   -                    if ( (ser = getSerializer(_class)) !=
> > null ) break ;
> >   -                    if ( classes == null ) classes = new
> Vector();
> >   -                    Class[] ifaces = _class.getInterfaces();
> >   -                    for (int i = 0 ; i < ifaces.length ; i++ )
> >   -                        classes.add( ifaces[i] );
> >   -                    _class = _class.getSuperclass();
> >
> >   -                    // Add any non-null (and non-Object)
> > class.  We skip
> >   -                    // the Object class because if we
> > reach that then
> >   -                    // there's an error and this error
> > message return
> >   -                    // here is better than the one
> returned by the
> >   -                    // ObjSerializer.
> >   -                    if ( _class != null &&
> >   -
> > !_class.getName().equals("java.lang.Object"))
> >   -                       classes.add( _class );
> >   -                }
> >   -            }
> >   +            ser = findSerializer( _class = value.getClass() );
> >
> >                if ( ser != null ) {
> >                    QName type = getTypeQName(_class);
> >
> >
> >
> >
>
>



Mime
View raw message