You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by to...@apache.org on 2004/10/11 20:58:26 UTC

cvs commit: ws-axis/java/src/org/apache/axis/encoding DefaultTypeMappingImpl.java TypeMappingImpl.java

tomj        2004/10/11 11:58:26

  Modified:    java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java TypeMappingImpl.java
  Log:
  Fix more regressions from Axis 1.1.
  
  - Always register the xmlType and javaType in the type mapping, even
  if they already existed.  This goes along with the "last one wins" phillosophy
  of the type mapping registry.  Otherwise only the first entry for java.lang.Object
  goes in to the class2Pair map, which means that the 1999 Schema is emitted
  in WSDL for this type.
  
  - As a side effect of this, the Map type for HashMap needs to be registered
  last in the default type mapping, so it is the preferred class to implement Map.
  
  Revision  Changes    Path
  1.80      +8 -7      ws-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
  
  Index: DefaultTypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- DefaultTypeMappingImpl.java	30 Jun 2004 18:32:40 -0000	1.79
  +++ DefaultTypeMappingImpl.java	11 Oct 2004 18:58:26 -0000	1.80
  @@ -289,13 +289,7 @@
           );
   
           // Serialize all extensions of Map to SOAP_MAP
  -        // The SOAP_MAP will be deserialized into a HashMap by default.
  -        myRegister(Constants.SOAP_MAP,       java.util.HashMap.class,
  -                   new MapSerializerFactory(java.util.Map.class,
  -                                            Constants.SOAP_MAP),
  -                   new MapDeserializerFactory(java.util.HashMap.class,
  -                                              Constants.SOAP_MAP)
  -        );
  +        // Order counts here, HashMap should be last.
           myRegister(Constants.SOAP_MAP,       java.util.Hashtable.class,
                      new MapSerializerFactory(java.util.Hashtable.class,
                                               Constants.SOAP_MAP),
  @@ -305,6 +299,13 @@
                      new MapSerializerFactory(java.util.Map.class,
                                               Constants.SOAP_MAP),
                      null  // Make sure not to override the deser mapping
  +        );
  +        // The SOAP_MAP will be deserialized into a HashMap by default.
  +        myRegister(Constants.SOAP_MAP,       java.util.HashMap.class,
  +                   new MapSerializerFactory(java.util.Map.class,
  +                                            Constants.SOAP_MAP),
  +                   new MapDeserializerFactory(java.util.HashMap.class,
  +                                              Constants.SOAP_MAP)
           );
   
           // Use the Element Serializeration for elements
  
  
  
  1.51      +9 -5      ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
  
  Index: TypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- TypeMappingImpl.java	2 Jul 2004 13:00:31 -0000	1.50
  +++ TypeMappingImpl.java	11 Oct 2004 18:58:26 -0000	1.51
  @@ -255,11 +255,15 @@
   
           Pair pair = new Pair(javaType, xmlType);
   
  -        // Only register the appropriate mappings.
  -        if ((dsf != null) || (qName2Pair.get(xmlType) == null))
  -            qName2Pair.put(xmlType, pair);
  -        if ((sf != null) || (class2Pair.get(javaType) == null))
  -            class2Pair.put(javaType, pair);
  +        // This code used to not put the xmlType and the JavaType
  +        // in the maps if it already existed:
  +        //    if ((dsf != null) || (qName2Pair.get(xmlType) == null))
  +        // This goes against the philosphy that "last one registered wins".
  +        // In particular, the mapping for java.lang.Object --> anyType
  +        // was coming out in WSDL generation under the 1999 XML Schema
  +        // namespace, which .NET doesn't understand (and is not great anyway).
  +        qName2Pair.put(xmlType, pair);
  +        class2Pair.put(javaType, pair);
   
           if (sf != null)
               pair2SF.put(pair, sf);