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 Mon, 08 Dec 2003 07:16:35 GMT
zieg        2003/12/07 23:16:35

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        BaseBindingLoader.java
               v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        BaseSimpleTypeConverter.java
                        ByNameRuntimeBindingType.java
                        ByNameUnmarshaller.java MarshalStreamUtils.java
                        UnmarshalContextImpl.java
               v2/src/xmlpublic/org/apache/xmlbeans UnmarshalContext.java
               v2/test/cases/marshal doc.xml example_config.xml
               v2/test/src/drt/drtcases MarshalTests.java
  Added:       v2/test/cases/marshal/com/mytest MySubClass.java
  Log:
  fix error handling -- recover and keep going from most lexical errors,
  and propgate location information into error collection
  
  add basic inheritance test for unmarshalling
  
  Revision  Changes    Path
  1.5       +2 -1      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BaseBindingLoader.java
  
  Index: BaseBindingLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BaseBindingLoader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BaseBindingLoader.java	4 Dec 2003 21:14:55 -0000	1.4
  +++ BaseBindingLoader.java	8 Dec 2003 07:16:35 -0000	1.5
  @@ -121,7 +121,8 @@
   
       protected void addElementFor(JavaTypeName jName, BindingTypeName btName)
       {
  -        assert(btName.getXmlName().getComponentType() == XmlTypeName.ELEMENT);
  +        assert(btName.getXmlName().getComponentType() == XmlTypeName.ELEMENT) :
  +            "not an element: " + btName;
           xmlFromJavaElement.put(jName, btName);
       }
       
  
  
  
  1.3       +5 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BaseSimpleTypeConverter.java
  
  Index: BaseSimpleTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BaseSimpleTypeConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseSimpleTypeConverter.java	6 Dec 2003 02:21:53 -0000	1.2
  +++ BaseSimpleTypeConverter.java	8 Dec 2003 07:16:35 -0000	1.3
  @@ -57,6 +57,7 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
   /**
    * Basic XmlStreamReader based impl that can handle converting
  @@ -75,6 +76,10 @@
       {
           try {
               return getObject(context);
  +        }
  +        catch(InvalidLexicalValueException ilve) {
  +            context.addError(ilve.getMessage());
  +            throw ilve;
           }
           finally {
               assert context.isEndElement();
  
  
  
  1.10      +7 -2      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ByNameRuntimeBindingType.java	4 Dec 2003 21:14:56 -0000	1.9
  +++ ByNameRuntimeBindingType.java	8 Dec 2003 07:16:35 -0000	1.10
  @@ -326,8 +326,13 @@
           {
               final QName xsi_type = context.getXsiType();
   
  -            if (xsi_type != null)
  -                return context.getTypeUnmarshaller(xsi_type);
  +            if (xsi_type != null) {
  +                TypeUnmarshaller typed_um = context.getTypeUnmarshaller(xsi_type);
  +                if (typed_um != null)
  +                    return typed_um;
  +                //reaching here means some problem with extracting the
  +                //marshaller for the xsi type, so just use the expected one
  +            }
   
               if (context.hasXsiNil())
                   return NullUnmarshaller.getInstance();
  
  
  
  1.6       +6 -6      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameUnmarshaller.java
  
  Index: ByNameUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameUnmarshaller.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ByNameUnmarshaller.java	6 Dec 2003 02:21:53 -0000	1.5
  +++ ByNameUnmarshaller.java	8 Dec 2003 07:16:35 -0000	1.6
  @@ -128,9 +128,9 @@
               prop.fill(inter, prop_val);
           }
           catch (InvalidLexicalValueException ilve) {
  -            //TODO: add location information
  -            XmlError err = XmlError.forMessage(ilve.getMessage());
  -            context.getErrorCollection().add(err);
  +            //error messages should have been added to the context by this
  +            //point, so we'll just skip calling any setters and keep on going
  +            assert !context.getErrors().isEmpty();
           }
       }
   
  @@ -147,9 +147,9 @@
               prop.fill(inter, prop_val);
           }
           catch (InvalidLexicalValueException ilve) {
  -            //TODO: add location information
  -            XmlError err = XmlError.forMessage(ilve.getMessage());
  -            context.getErrorCollection().add(err);
  +            //error messages should have been added to the context by this
  +            //point, so we'll just skip calling any setters and keep on going
  +            assert !context.getErrors().isEmpty();
           }
       }
   
  
  
  
  1.7       +44 -16    xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalStreamUtils.java
  
  Index: MarshalStreamUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalStreamUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MarshalStreamUtils.java	5 Dec 2003 02:45:54 -0000	1.6
  +++ MarshalStreamUtils.java	8 Dec 2003 07:16:35 -0000	1.7
  @@ -57,11 +57,15 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.XmlRuntimeException;
  +import org.apache.xmlbeans.XmlError;
   import org.apache.xmlbeans.impl.common.XsTypeConverter;
  +import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
  +import org.apache.xmlbeans.impl.richParser.XMLStreamReaderExt;
   
   import javax.xml.namespace.QName;
   import javax.xml.stream.XMLStreamException;
   import javax.xml.stream.XMLStreamReader;
  +import javax.xml.stream.Location;
   import java.util.Collection;
   
   final class MarshalStreamUtils
  @@ -77,8 +81,9 @@
   
   
       static void getXsiAttributes(XsiAttributeHolder holder,
  -                                 XMLStreamReader reader,
  +                                 XMLStreamReaderExt reader,
                                    Collection errors)
  +        throws XMLStreamException
       {
           assert reader.isStartElement();
   
  @@ -89,21 +94,31 @@
               if (!XSI_NS.equals(reader.getAttributeNamespace(att_idx)))
                   continue;
   
  -            final String lname = reader.getAttributeLocalName(att_idx);
  -            if (XSI_TYPE_ATTR.equals(lname)) {
  -                final String type_str = reader.getAttributeValue(att_idx);
  -                holder.xsiType =
  -                    XsTypeConverter.lexQName(type_str, errors,
  -                                             reader.getNamespaceContext());
  -            } else if (XSI_NIL_ATTR.equals(lname)) {
  -                final String nil_lex = reader.getAttributeValue(att_idx);
  -                holder.hasXsiNil =
  -                    XsTypeConverter.lexBoolean(nil_lex, errors);
  -            } else if (XSI_SCHEMA_LOCATION_ATTR.equals(lname)) {
  -                holder.schemaLocation = reader.getAttributeValue(att_idx);
  -            } else if (XSI_NO_NS_SCHEMA_LOCATION_ATTR.equals(lname)) {
  -                holder.noNamespaceSchemaLocation =
  -                    reader.getAttributeValue(att_idx);
  +            try {
  +                final String lname = reader.getAttributeLocalName(att_idx);
  +                if (XSI_TYPE_ATTR.equals(lname)) {
  +                    holder.xsiType = reader.getAttributeQNameValue(att_idx);
  +                } else if (XSI_NIL_ATTR.equals(lname)) {
  +                    holder.hasXsiNil = reader.getAttributeBooleanValue(att_idx);
  +                } else if (XSI_SCHEMA_LOCATION_ATTR.equals(lname)) {
  +                    //TODO: apply collapse whitespace facet somehow
  +                    holder.schemaLocation =
  +                        reader.getAttributeStringValue(att_idx);
  +                } else if (XSI_NO_NS_SCHEMA_LOCATION_ATTR.equals(lname)) {
  +                    //TODO: apply collapse whitespace facet somehow
  +                    holder.noNamespaceSchemaLocation =
  +                        reader.getAttributeStringValue(att_idx);
  +                }
  +            }
  +                //nothing should have been assigned, so keep going
  +                //TODO: use real location (maybe just pass context to this method).
  +            catch (InvalidLexicalValueException ilve) {
  +                addError(errors, ilve.getMessage(),
  +                         reader.getLocation(), "<unknown>");
  +            }
  +            catch (IllegalArgumentException iax) {   //thrown by lexBoolean
  +                addError(errors, iax.getMessage(),
  +                         reader.getLocation(), "<unknown>");
               }
           }
       }
  @@ -281,6 +296,19 @@
           catch (XMLStreamException e) {
               throw new XmlRuntimeException(e);
           }
  +    }
  +
  +    static void addError(Collection errors,
  +                         String msg,
  +                         Location location,
  +                         String sourceName)
  +    {
  +        final XmlError err = XmlError.forLocation(msg,
  +                                                  sourceName,
  +                                                  location.getLineNumber(),
  +                                                  location.getColumnNumber(),
  +                                                  location.getCharacterOffset());
  +        errors.add(err);
       }
   
   
  
  
  
  1.7       +24 -15    xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalContextImpl.java
  
  Index: UnmarshalContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalContextImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UnmarshalContextImpl.java	6 Dec 2003 02:21:53 -0000	1.6
  +++ UnmarshalContextImpl.java	8 Dec 2003 07:16:35 -0000	1.7
  @@ -62,6 +62,7 @@
   import org.apache.xmlbeans.UnmarshalContext;
   import org.apache.xmlbeans.XmlCalendar;
   import org.apache.xmlbeans.XmlRuntimeException;
  +import org.apache.xmlbeans.XmlError;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.binding.bts.XmlTypeName;
  @@ -71,11 +72,13 @@
   import javax.xml.namespace.QName;
   import javax.xml.stream.XMLStreamException;
   import javax.xml.stream.XMLStreamReader;
  +import javax.xml.stream.Location;
   import java.io.InputStream;
   import java.math.BigDecimal;
   import java.math.BigInteger;
   import java.util.Collection;
   import java.util.Date;
  +import java.util.Collections;
   
   /**
    * An UnmarshalContext holds the mutable state using by an Unmarshaller
  @@ -135,6 +138,11 @@
           updateAttributeState();
       }
   
  +    public Collection getErrors()
  +    {
  +        return Collections.unmodifiableCollection(errors);
  +    }
  +
       private static XMLStreamReaderExt createExtendedReader(XMLStreamReader reader)
       {
           if (reader instanceof XMLStreamReaderExt) {
  @@ -159,39 +167,35 @@
       }
   
   
  +    //returns null and updates errors if there was a problem.
       TypeUnmarshaller getTypeUnmarshaller(QName xsi_type)
       {
           XmlTypeName xname = XmlTypeName.forTypeNamed(xsi_type);
           BindingType binding_type =
               bindingLoader.getBindingType(bindingLoader.lookupPojoFor(xname));
           if (binding_type == null) {
  -            String msg = "unable to locate binding type for " + xsi_type;
  -            throw new XmlRuntimeException(msg);
  +            addError("unknown type: " + xsi_type);
  +            return null;
           }
           TypeUnmarshaller um =
               typeTable.getTypeUnmarshaller(binding_type);
           if (um == null) {
               String msg = "unable to locate unmarshaller for " +
                   binding_type.getName();
  -            throw new XmlRuntimeException(msg);
  +            addError(msg);
  +            return null;
           }
           return um;
       }
   
  -    //package only -- get read/write version of error collection
  -
  -    /**
  -     * package only -- get read/write version of error collection
  -     *
  -     * @return  read/write version of error collection
  -     */
  -    Collection getErrorCollection()
  +    void addError(String msg)
       {
  -        return errors;
  +        //TODO: fix this location information!
  +        MarshalStreamUtils.addError(errors, msg,
  +                                    baseReader.getLocation(), "<unknown>");
       }
   
   
  -
       // ======================= xml access methods =======================
   
       String getStringValue()
  @@ -489,8 +493,13 @@
   
       private void getXsiAttributes()
       {
  -        MarshalStreamUtils.getXsiAttributes(xsiAttributeHolder,
  -                                            baseReader, errors);
  +        try {
  +            MarshalStreamUtils.getXsiAttributes(xsiAttributeHolder,
  +                                                baseReader, errors);
  +        }
  +        catch (XMLStreamException e) {
  +            throw new XmlRuntimeException(e);
  +        }
           gotXsiAttributes = true;
       }
   
  
  
  
  1.2       +7 -0      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/UnmarshalContext.java
  
  Index: UnmarshalContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/UnmarshalContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnmarshalContext.java	14 Nov 2003 00:40:30 -0000	1.1
  +++ UnmarshalContext.java	8 Dec 2003 07:16:35 -0000	1.2
  @@ -57,6 +57,7 @@
   package org.apache.xmlbeans;
   
   import javax.xml.stream.XMLStreamReader;
  +import java.util.Collection;
   
   /**
    * An UnmarshalContext object represents the state of an unmarshal operation
  @@ -72,4 +73,10 @@
        * @param reader
        */
       void setXmlStream(XMLStreamReader reader);
  +
  +    /**
  +     *
  +     * @return  read-only collection of error objects
  +     */
  +    Collection getErrors();
   }
  
  
  
  1.7       +7 -4      xml-xmlbeans/v2/test/cases/marshal/doc.xml
  
  Index: doc.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/doc.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- doc.xml	6 Dec 2003 02:21:53 -0000	1.6
  +++ doc.xml	8 Dec 2003 07:16:35 -0000	1.7
  @@ -1,17 +1,20 @@
   <?xml version="1.0" encoding="utf-8"?>
   <My:load xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  -    xmlns:My="java:com.mytest" xsi:type="My:MyClass">
  +    xmlns:My="java:com.mytest" >
   
  -    <My:Myelt ignore="someval" My:Attrib="4444.123456789">
  +    <My:Myelt ignore="someval" My:Attrib="4444.123456789f">
           <My:MyFloat>111111165.34</My:MyFloat>
  -        <My:MyClass>
  +        <My:MyClass xsi:type="My:MySubClass">
               <My:Myatt xsi:type="xsd:token">inner-str</My:Myatt>
  +
  +            <My:BigInt>  7474747474747474747474747474747474  </My:BigInt>
  +
           </My:MyClass>
       </My:Myelt>
   
       <!--    test as-if for simple types-->
  -    <My:Myatt xsi:nil="0" xsi:type="My:custom-string">some string</My:Myatt>
  +    <My:Myatt xsi:nil=" false " xsi:type="My:custom-string">some string</My:Myatt>
   
   </My:load>
   
  
  
  
  1.11      +39 -0     xml-xmlbeans/v2/test/cases/marshal/example_config.xml
  
  Index: example_config.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/example_config.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- example_config.xml	5 Dec 2003 23:48:22 -0000	1.10
  +++ example_config.xml	8 Dec 2003 07:16:35 -0000	1.11
  @@ -10,6 +10,33 @@
           <bin:as-xml>t=string@http://www.w3.org/2001/XMLSchema</bin:as-xml>
       </bin:binding-type>
   
  +      <bin:binding-type xsi:type="bin:by-name-bean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  +          <bin:xmlcomponent>t=MySubClass@java:com.mytest</bin:xmlcomponent>
  +          <bin:javatype>com.mytest.MySubClass</bin:javatype>
  +          <bin:qname-property>
  +              <bin:xmlcomponent>t=YourClass@java:com.mytest</bin:xmlcomponent>
  +              <bin:javatype>com.mytest.YourClass</bin:javatype>
  +              <bin:getter>getMyelt</bin:getter>
  +              <bin:setter>setMyelt</bin:setter>
  +              <bin:qname>java:Myelt</bin:qname>
  +          </bin:qname-property>
  +          <bin:qname-property>
  +              <bin:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
  +              <bin:javatype>java.lang.String</bin:javatype>
  +              <bin:getter>getMyatt</bin:getter>
  +              <bin:setter>setMyatt</bin:setter>
  +              <bin:qname>java:Myatt</bin:qname>
  +              <bin:nillable>true</bin:nillable>
  +          </bin:qname-property>
  +          <bin:qname-property>
  +              <bin:xmlcomponent>t=integer@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
  +              <bin:javatype>java.math.BigInteger</bin:javatype>
  +              <bin:getter>getBigInt</bin:getter>
  +              <bin:setter>setBigInt</bin:setter>
  +              <bin:qname>java:BigInt</bin:qname>
  +          </bin:qname-property>
  +      </bin:binding-type>
  +
       <bin:binding-type xsi:type="bin:by-name-bean" >
         <bin:xmlcomponent>t=YourClass@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.YourClass</bin:javatype>
  @@ -117,6 +144,11 @@
         <bin:javatype>java.lang.String</bin:javatype>
       </bin:mapping>
   
  +    <bin:mapping>
  +        <bin:xmlcomponent>t=MySubClass@java:com.mytest</bin:xmlcomponent>
  +        <bin:javatype>com.mytest.MySubClass</bin:javatype>
  +    </bin:mapping>
  +
     </bin:xml-to-pojo>
   
     <bin:xml-to-xmlobj/>
  @@ -129,11 +161,18 @@
         <bin:xmlcomponent>t=MyClass@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.MyClass</bin:javatype>
       </bin:mapping>
  +
  +      <bin:mapping>
  +          <bin:xmlcomponent>t=MySubClass@java:com.mytest</bin:xmlcomponent>
  +          <bin:javatype>com.mytest.MySubClass</bin:javatype>
  +      </bin:mapping>
  +
     </bin:java-to-xml>
     <bin:java-to-element>
       <bin:mapping>
         <bin:xmlcomponent>e=load@java:com.mytest</bin:xmlcomponent>
         <bin:javatype>com.mytest.MyClass</bin:javatype>
       </bin:mapping>
  +
     </bin:java-to-element>
   </bin:binding-config>
  
  
  
  1.1                  xml-xmlbeans/v2/test/cases/marshal/com/mytest/MySubClass.java
  
  Index: MySubClass.java
  ===================================================================
  /*
  * The Apache Software License, Version 1.1
  *
  *
  * Copyright (c) 2003 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
  *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
  *    if and wherever such third-party acknowledgments normally appear.
  *
  * 4. The names "Apache" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
  *    software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache
  *    XMLBeans", nor may "Apache" appear in their name, without prior
  *    written permission of the Apache Software Foundation.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation and was
  * originally based on software copyright (c) 2000-2003 BEA Systems
  * Inc., <http://www.bea.com/>. For more information on the Apache Software
  * Foundation, please see <http://www.apache.org/>.
  */
  
  package com.mytest;
  
  import java.math.BigInteger;
  
  public class MySubClass
      extends MyClass
  {
  
      private BigInteger bigInt;
  
      public BigInteger getBigInt()
      {
          return bigInt;
      }
  
      public void setBigInt(BigInteger bigInt)
      {
          this.bigInt = bigInt;
      }
  
      //TODO: clean this up
      public String toString()
      {
          String parent = super.toString();
          return parent + " AND bigInt=" + bigInt;
      }
  
  }
  
  
  
  1.17      +8 -2      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MarshalTests.java	5 Dec 2003 23:48:22 -0000	1.16
  +++ MarshalTests.java	8 Dec 2003 07:16:35 -0000	1.17
  @@ -11,6 +11,7 @@
   import org.apache.xmlbeans.UnmarshalContext;
   import org.apache.xmlbeans.Unmarshaller;
   import org.apache.xmlbeans.XmlException;
  +import org.apache.xmlbeans.XmlError;
   import org.apache.xmlbeans.impl.common.XmlReaderToWriter;
   import org.apache.xmlbeans.impl.common.XmlStreamUtils;
   import org.apache.xmlbeans.impl.tool.PrettyPrinter;
  @@ -34,6 +35,7 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.Random;
  +import java.util.Collection;
   import java.math.BigInteger;
   import java.math.BigDecimal;
   
  @@ -488,9 +490,13 @@
           }
   
           Object obj = unmarshaller.unmarshallType(schemaType, javaType, ctx);
  -
  -
  +        final Collection errors = ctx.getErrors();
  +        for (Iterator itr = errors.iterator(); itr.hasNext();) {
  +            System.out.println("ERROR: " + itr.next());
  +        }
           System.out.println("+++++TYPE obj = " + obj);
  +
  +        Assert.assertTrue(errors.isEmpty());
       }
   
       public void DISABLED_testPerfByNameBeanUnmarshall()
  
  
  

---------------------------------------------------------------------
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