xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/drt/drtcases MarshalTests.java
Date Fri, 16 Apr 2004 17:35:57 GMT
zieg        2004/04/16 10:35:57

  Modified:    v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        JaxrpcEnumRuntimeBindingType.java
                        MarshallerImpl.java
               v2/test/src/drt/drtcases MarshalTests.java
  Log:
  fix overly aggressive instance checking
  
  Revision  Changes    Path
  1.2       +4 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/JaxrpcEnumRuntimeBindingType.java
  
  Index: JaxrpcEnumRuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/JaxrpcEnumRuntimeBindingType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JaxrpcEnumRuntimeBindingType.java	13 Mar 2004 03:46:57 -0000	1.1
  +++ JaxrpcEnumRuntimeBindingType.java	16 Apr 2004 17:35:57 -0000	1.2
  @@ -135,10 +135,12 @@
               throws XmlException
           {
               final BindingTypeName base_name = jaxrpcEnumType.getBaseTypeName();
  -            assert base_name != null;
  +            if (base_name == null) {
  +                throw new XmlException("null base type for " + jaxrpcEnumType);
  +            }
               final BindingType item_type = loader.getBindingType(base_name);
               if (item_type == null) {
  -                final String msg = "unable to load type" + item_type +
  +                final String msg = "unable to load type " + base_name +
                       " for " + jaxrpcEnumType;
                   throw new XmlException(msg);
               }
  
  
  
  1.26      +3 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java
  
  Index: MarshallerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- MarshallerImpl.java	14 Apr 2004 23:03:50 -0000	1.25
  +++ MarshallerImpl.java	16 Apr 2004 17:35:57 -0000	1.26
  @@ -100,7 +100,9 @@
                                                                   typeTable,
                                                                   loader);
   
  -        if (obj != null && !runtime_type.getJavaType().isAssignableFrom(obj.getClass()))
{
  +        if (obj != null &&
  +            !runtime_type.isJavaPrimitive() &&
  +            !runtime_type.getJavaType().isInstance(obj)) {
               String m = "instance type: " + obj.getClass() +
                   " not an instance of expected type: " +
                   runtime_type.getJavaType();
  
  
  
  1.54      +10 -1     xml-xmlbeans/v2/test/src/drt/drtcases/MarshalTests.java
  
  Index: MarshalTests.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/drt/drtcases/MarshalTests.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- MarshalTests.java	16 Apr 2004 00:59:06 -0000	1.53
  +++ MarshalTests.java	16 Apr 2004 17:35:57 -0000	1.54
  @@ -176,6 +176,7 @@
           testSimpleTypeMarshal(new Byte((byte)125), "byte");
           testSimpleTypeMarshal(new Short((short)5543), "short");
           testSimpleTypeMarshal(new Integer(55434535), "int");
  +        testSimpleTypeMarshal(new Integer(75434535), "int", "int");
           testSimpleTypeMarshal(new Long(554345354445555555L), "long");
           testSimpleTypeMarshal(new BigInteger("55434535443332323245555555"), "integer");
           testSimpleTypeMarshal(new BigDecimal("43434343342.233434342"), "decimal");
  @@ -257,6 +258,14 @@
       public void testSimpleTypeMarshal(Object orig, String xsd_type)
           throws Exception
       {
  +        final String java_type = orig.getClass().getName();
  +        testSimpleTypeMarshal(orig, xsd_type, java_type);
  +    }
  +
  +    public void testSimpleTypeMarshal(Object orig, String xsd_type,
  +                                      final String java_type)
  +        throws Exception
  +    {
           BindingContext bindingContext =
               BindingContextFactory.newInstance().createBindingContext();
   
  @@ -274,7 +283,7 @@
   //                           new QName("uri", "lname"),
                               new QName("lname"),
                               new QName("http://www.w3.org/2001/XMLSchema", xsd_type),
  -                            orig.getClass().getName(), options);
  +                            java_type, options);
   
   
           inform("==================OBJ: " + orig);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message