You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by zi...@apache.org on 2003/12/19 19:08:31 UTC

cvs commit: xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal ByNameRuntimeBindingType.java

zieg        2003/12/19 10:08:31

  Modified:    v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        ByNameRuntimeBindingType.java
  Log:
  increased assertion checking to catch more bugs
  
  DRT: passed
  
  Revision  Changes    Path
  1.15      +28 -4     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameRuntimeBindingType.java
  
  Index: ByNameRuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameRuntimeBindingType.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ByNameRuntimeBindingType.java	17 Dec 2003 00:17:53 -0000	1.14
  +++ ByNameRuntimeBindingType.java	19 Dec 2003 18:08:31 -0000	1.15
  @@ -357,11 +357,16 @@
                       assert asif_name != null : "no asif for " + stype;
                       BindingType asif = loader.getBindingType(asif_name);
                       if (asif == null) {
  -                        throw new AssertionError("unable to get asif type for " + asif_name);
  +                        throw new AssertionError("unable to get asif type" +
  +                                                 " for " + asif_name);
                       }
                       m = typeTable.getTypeMarshaller(asif);
   
  -                    assert m != null : "asif type marshaller not found for " + stype;
  +                    if (m == null) {
  +                        final String msg = "asif type marshaller not found" +
  +                            " for" + stype + " asif=" + asif;
  +                        throw new AssertionError(msg);
  +                    }
                   }
               }
   
  @@ -439,8 +444,27 @@
           //non simple type props can throw some runtime exception.
           public CharSequence getLexical(Object value, MarshallerImpl context)
           {
  -            assert value != null;
  -            assert marshaller != null : "no marhsaller for " + bindingProperty.getTypeName();
  +
  +            //TODO: after marshalling table is refactored
  +            //turn these into assertions   zieg Dec 19 2003.
  +
  +            if (value == null) {
  +                throw new AssertionError("null value for " + bindingProperty +
  +                                         " class=" + beanClass);
  +            }
  +
  +            if (context == null) {
  +                throw new AssertionError("null value for " + bindingProperty +
  +                                         " class=" + beanClass);
  +            }
  +
  +            if (marshaller == null) {
  +                String msg = "null marshaller for prop=" + bindingProperty +
  +                    " class=" + beanClass + " propType=" +
  +                    bindingProperty.getTypeName();
  +                throw new AssertionError(msg);
  +            }
  +
               return marshaller.print(value, context);
           }
   
  
  
  

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