You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by zi...@apache.org on 2004/02/12 01:30:12 UTC

cvs commit: xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal AnyUriToStringTypeConverter.java Base64BinaryTypeConverter.java BaseSimpleTypeConverter.java BooleanTypeConverter.java ByNameRuntimeBindingType.java ByNameTypeVisitor.java ByNameUnmarshaller.java ByteTypeConverter.java CharacterVisitor.java CollapseStringTypeConverter.java DateTimeTypeConverter.java DecimalTypeConverter.java DoubleTypeConverter.java FloatTypeConverter.java HexBinaryTypeConverter.java IntTypeConverter.java IntegerTypeConverter.java LongTypeConverter.java MarshalResult.java MarshalStreamUtils.java MarshallerImpl.java NullUnmarshaller.java PreserveStringTypeConverter.java QNameTypeConverter.java ReplaceStringTypeConverter.java RuntimeBindingProperty.java RuntimeBindingType.java RuntimeBindingTypeTable.java RuntimeGlobalProperty.java RuntimeTypeFactory.java ShortTypeConverter.java SimpleTypeVisitor.java StringTypeConverter.java TypeUnmarshaller.java UnmarshalResult.java XmlTypeVisitor.java

zieg        2004/02/11 16:30:12

  Modified:    v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        AnyUriToStringTypeConverter.java
                        Base64BinaryTypeConverter.java
                        BaseSimpleTypeConverter.java
                        BooleanTypeConverter.java
                        ByNameRuntimeBindingType.java
                        ByNameTypeVisitor.java ByNameUnmarshaller.java
                        ByteTypeConverter.java CharacterVisitor.java
                        CollapseStringTypeConverter.java
                        DateTimeTypeConverter.java
                        DecimalTypeConverter.java DoubleTypeConverter.java
                        FloatTypeConverter.java HexBinaryTypeConverter.java
                        IntTypeConverter.java IntegerTypeConverter.java
                        LongTypeConverter.java MarshalResult.java
                        MarshalStreamUtils.java MarshallerImpl.java
                        NullUnmarshaller.java
                        PreserveStringTypeConverter.java
                        QNameTypeConverter.java
                        ReplaceStringTypeConverter.java
                        RuntimeBindingProperty.java RuntimeBindingType.java
                        RuntimeBindingTypeTable.java
                        RuntimeGlobalProperty.java RuntimeTypeFactory.java
                        ShortTypeConverter.java SimpleTypeVisitor.java
                        StringTypeConverter.java TypeUnmarshaller.java
                        UnmarshalResult.java XmlTypeVisitor.java
  Log:
  replace most runtime exceptions with checked exceptions (XmlException).
  
  Revision  Changes    Path
  1.4       +3 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AnyUriToStringTypeConverter.java
  
  Index: AnyUriToStringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/AnyUriToStringTypeConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AnyUriToStringTypeConverter.java	22 Jan 2004 21:43:46 -0000	1.3
  +++ AnyUriToStringTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.4
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   
  @@ -64,11 +65,13 @@
   {
   
       protected Object getObject(UnmarshalResult context)
  +        throws XmlException
       {
           return context.getAnyUriValue();
       }
   
       public Object unmarshalAttribute(UnmarshalResult context)
  +        throws XmlException
       {
           return context.getAttributeAnyUriValue();
       }
  
  
  
  1.4       +16 -2     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/Base64BinaryTypeConverter.java
  
  Index: Base64BinaryTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/Base64BinaryTypeConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Base64BinaryTypeConverter.java	22 Jan 2004 21:43:46 -0000	1.3
  +++ Base64BinaryTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.4
  @@ -56,23 +56,37 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
  +import java.io.IOException;
   import java.io.InputStream;
   
   final class Base64BinaryTypeConverter
       extends BaseSimpleTypeConverter
   {
       protected Object getObject(UnmarshalResult context)
  +        throws XmlException
       {
           final InputStream val = context.getBase64Value();
  -        return MarshalStreamUtils.inputStreamToBytes(val);
  +        try {
  +            return MarshalStreamUtils.inputStreamToBytes(val);
  +        }
  +        catch (IOException e) {
  +            throw new XmlException(e);
  +        }
       }
   
       public Object unmarshalAttribute(UnmarshalResult context)
  +        throws XmlException
       {
           final InputStream val = context.getAttributeBase64Value();
  -        return MarshalStreamUtils.inputStreamToBytes(val);
  +        try {
  +            return MarshalStreamUtils.inputStreamToBytes(val);
  +        }
  +        catch (IOException e) {
  +            throw new XmlException(e);
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.7       +8 -2      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BaseSimpleTypeConverter.java	22 Jan 2004 21:43:46 -0000	1.6
  +++ BaseSimpleTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.7
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
  @@ -73,6 +74,7 @@
       }
   
       public final Object unmarshal(UnmarshalResult context)
  +        throws XmlException
       {
           try {
               return getObject(context);
  @@ -82,11 +84,15 @@
               throw ilve;
           }
           finally {
  -            assert context.isEndElement();
  +            //Note that this assertion can be trigger by invalid xml input,
  +            //so we've disabled it.
  +            //assert context.isEndElement();
  +
               if (context.hasNext()) context.next();
           }
       }
   
  -    protected abstract Object getObject(UnmarshalResult context);
  +    protected abstract Object getObject(UnmarshalResult context)
  +        throws XmlException;
   
   }
  
  
  
  1.6       +3 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BooleanTypeConverter.java
  
  Index: BooleanTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/BooleanTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BooleanTypeConverter.java	22 Jan 2004 21:43:46 -0000	1.5
  +++ BooleanTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,18 +56,21 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class BooleanTypeConverter
       extends BaseSimpleTypeConverter
   {
       protected Object getObject(UnmarshalResult context)
  +        throws XmlException
       {
           boolean b = context.getBooleanValue();
           return Boolean.valueOf(b);
       }
   
       public Object unmarshalAttribute(UnmarshalResult context)
  +        throws XmlException
       {
           boolean b = context.getAttributeBooleanValue();
           return Boolean.valueOf(b);
  
  
  
  1.25      +36 -26    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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ByNameRuntimeBindingType.java	30 Jan 2004 18:45:45 -0000	1.24
  +++ ByNameRuntimeBindingType.java	12 Feb 2004 00:30:11 -0000	1.25
  @@ -57,7 +57,6 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.XmlException;
  -import org.apache.xmlbeans.XmlRuntimeException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingProperty;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
  @@ -98,6 +97,7 @@
   
       //DO NOT CALL THIS CONSTRUCTOR, use the RuntimeTypeFactory
       ByNameRuntimeBindingType(ByNameBean btype)
  +        throws XmlException
       {
           byNameBean = btype;
           try {
  @@ -105,12 +105,12 @@
               if (javaClass.isPrimitive() || javaClass.isArray()) {
                   final String msg = "invalid ByNameBean java type: " + javaClass +
                       " found in " + btype;
  -                throw new XmlRuntimeException(msg);
  +                throw new XmlException(msg);
               }
           }
           catch (ClassNotFoundException e) {
               final String msg = "failed to load " + btype.getName().getJavaName();
  -            throw new XmlRuntimeException(msg, e);
  +            throw new XmlException(msg, e);
           }
   
           int elem_prop_cnt = 0;
  @@ -152,6 +152,7 @@
       //prepare internal data structures for use
       public void initialize(RuntimeBindingTypeTable typeTable,
                              BindingLoader loader)
  +        throws XmlException
       {
           int att_idx = 0;
           int elem_idx = 0;
  @@ -181,6 +182,7 @@
   
       Object getFinalObjectFromIntermediary(Object retval,
                                             UnmarshalResult context)
  +        throws XmlException
       {
           if (hasMulti) {
               UResultHolder rh = (UResultHolder)retval;
  @@ -282,6 +284,7 @@
       }
   
       public void fillDefaultAttributes(Object inter, UnmarshalResult context)
  +        throws XmlException
       {
           if (!hasDefaultAttributes) return;
   
  @@ -320,6 +323,7 @@
                    QNameProperty prop,
                    RuntimeBindingTypeTable typeTable,
                    BindingLoader loader)
  +            throws XmlException
           {
               if (prop.getQName() == null) {
                   final String msg = "property " + property_index + " of " +
  @@ -359,6 +363,7 @@
                                                      BindingType bindingType,
                                                      RuntimeBindingTypeTable typeTable,
                                                      BindingLoader loader)
  +            throws XmlException
           {
               final String xmldoc = "<a>" + value + "</a>";
               try {
  @@ -374,11 +379,8 @@
                   sr.close();
                   return obj;
               }
  -            catch (XmlException e) {
  -                throw new XmlRuntimeException(e);
  -            }
               catch (XMLStreamException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
           }
   
  @@ -443,14 +445,14 @@
           private TypeUnmarshaller lookupUnmarshaller(BindingProperty prop,
                                                       RuntimeBindingTypeTable table,
                                                       BindingLoader loader)
  +            throws XmlException
           {
               assert prop != null;
               final BindingTypeName type_name = prop.getTypeName();
               assert type_name != null;
               final BindingType binding_type = loader.getBindingType(type_name);
               if (binding_type == null) {
  -                throw new XmlRuntimeException("failed to load type: " +
  -                                              type_name);
  +                throw new XmlException("failed to load type: " + type_name);
               }
   
               TypeUnmarshaller um =
  @@ -498,6 +500,7 @@
   
   
           public TypeUnmarshaller getTypeUnmarshaller(UnmarshalResult context)
  +            throws XmlException
           {
               //don't need any xsi stuff for attributes.
               if (bindingProperty.isAttribute()) return unmarshaller;
  @@ -518,7 +521,7 @@
               return unmarshaller;
           }
   
  -        public void fill(final Object inter, final Object prop_obj)
  +        public void fill(final Object inter, final Object prop_obj) throws XmlException
           {
               //means xsi:nil was true but we're a primtive.
               //schema should have nillable="false" so this
  @@ -540,18 +543,19 @@
                   }
               }
               catch (SecurityException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (IllegalAccessException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (InvocationTargetException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
           }
   
   
           public void fillDefaultValue(Object inter)
  +            throws XmlException
           {
               assert (defaultValue != null);
   
  @@ -559,23 +563,25 @@
           }
   
           public void fillCollection(final Object inter, final Object prop_obj)
  +            throws XmlException
           {
               assert isMultiple();
               try {
                   setMethod.invoke(inter, new Object[]{prop_obj});
               }
               catch (SecurityException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (IllegalAccessException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (InvocationTargetException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
           }
   
           public CharSequence getLexical(Object value, MarshalResult result)
  +            throws XmlException
           {
               assert value != null :
                   "null value for " + bindingProperty + " class=" + beanClass;
  @@ -591,6 +597,7 @@
           }
   
           public Object getValue(Object parentObject, MarshalResult result)
  +            throws XmlException
           {
               assert parentObject != null;
               assert beanClass.isAssignableFrom(parentObject.getClass()) :
  @@ -599,18 +606,19 @@
                   return getMethod.invoke(parentObject, EMPTY_OBJECT_ARRAY);
               }
               catch (SecurityException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (IllegalAccessException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (InvocationTargetException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
           }
   
           //TODO: check isSet methods
           public boolean isSet(Object parentObject, MarshalResult result)
  +            throws XmlException
           {
               if (bindingProperty.isNillable())
                   return true;
  @@ -631,6 +639,7 @@
   
           private static Method getSetterMethod(QNameProperty binding_prop,
                                                 Class beanClass)
  +            throws XmlException
           {
               MethodName setterName = binding_prop.getSetterName();
               try {
  @@ -638,19 +647,20 @@
                   return set_method;
               }
               catch (NoSuchMethodException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (SecurityException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (ClassNotFoundException cnfe) {
  -                throw new XmlRuntimeException(cnfe);
  +                throw new XmlException(cnfe);
               }
           }
   
   
           private static Method getGetterMethod(QNameProperty binding_prop,
                                                 Class beanClass)
  +            throws XmlException
           {
               MethodName getterName = binding_prop.getGetterName();
               try {
  @@ -659,13 +669,13 @@
                   return get_method;
               }
               catch (NoSuchMethodException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (SecurityException e) {
  -                throw new XmlRuntimeException(e);
  +                throw new XmlException(e);
               }
               catch (ClassNotFoundException cnfe) {
  -                throw new XmlRuntimeException(cnfe);//should never happen
  +                throw new XmlException(cnfe);//should never happen
               }
           }
   
  @@ -692,7 +702,7 @@
           }
   
   
  -        Object getFinalValue()
  +        Object getFinalValue() throws XmlException
           {
               if (accumulators != null) {
                   final Property[] props = runtimeBindingType.elementProperties;
  
  
  
  1.14      +12 -2     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameTypeVisitor.java
  
  Index: ByNameTypeVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameTypeVisitor.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ByNameTypeVisitor.java	27 Jan 2004 01:30:16 -0000	1.13
  +++ ByNameTypeVisitor.java	12 Feb 2004 00:30:11 -0000	1.14
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
  @@ -80,6 +81,7 @@
   
       ByNameTypeVisitor(RuntimeBindingProperty property, Object obj,
                         MarshalResult result)
  +        throws XmlException
       {
           super(obj, property, result);
           final BindingType pt = property.getType();
  @@ -101,13 +103,15 @@
       }
   
       protected int advance()
  +        throws XmlException
       {
           assert elemPropIdx < maxElementPropCount; //ensure we don't go past the end
   
           do {
               boolean hit_end = advanceToNextItem();
               if (hit_end) return END;
  -        } while (!currentPropHasMore());
  +        }
  +        while (!currentPropHasMore());
   
           assert elemPropIdx >= 0;
   
  @@ -115,6 +119,7 @@
       }
   
       private boolean advanceToNextItem()
  +        throws XmlException
       {
           if (haveMultipleItem && currMultipleIterator.hasNext()) {
               currMultipleItem = currMultipleIterator.next();
  @@ -127,6 +132,7 @@
   
       //return true if we hit the end of our properties
       private boolean advanceToNextProperty()
  +        throws XmlException
       {
           elemPropIdx++;
           currMultipleIterator = null;
  @@ -140,6 +146,7 @@
       }
   
       private void updateCurrIterator()
  +        throws XmlException
       {
           final RuntimeBindingProperty property = getCurrentElementProperty();
           if (property.isMultiple()) {
  @@ -156,6 +163,7 @@
       }
   
       private boolean currentPropHasMore()
  +        throws XmlException
       {
           if (elemPropIdx < 0) return false;
   
  @@ -172,7 +180,7 @@
           return set;
       }
   
  -    public XmlTypeVisitor getCurrentChild()
  +    public XmlTypeVisitor getCurrentChild() throws XmlException
       {
           final RuntimeBindingProperty property = getCurrentElementProperty();
   
  @@ -196,6 +204,7 @@
       }
   
       protected int getAttributeCount()
  +        throws XmlException
       {
           if (attributeValues == null) initAttributes();
   
  @@ -205,6 +214,7 @@
       }
   
       protected void initAttributes()
  +        throws XmlException
       {
           assert attributeNames == null;
           assert attributeValues == null;
  
  
  
  1.13      +6 -0      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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ByNameUnmarshaller.java	29 Jan 2004 03:48:28 -0000	1.12
  +++ ByNameUnmarshaller.java	12 Feb 2004 00:30:11 -0000	1.13
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.common.InvalidLexicalValueException;
   
  @@ -69,6 +70,7 @@
       }
   
       public Object unmarshal(UnmarshalResult context)
  +        throws XmlException
       {
           final Object inter = type.createIntermediary(context);
           deserializeAttributes(inter, context);
  @@ -84,6 +86,7 @@
   
       //TODO: cleanup this code.  We are doing extra work for assertion checking
       private void deserializeContents(Object inter, UnmarshalResult context)
  +        throws XmlException
       {
           assert context.isStartElement();
           final String ourStartUri = context.getNamespaceURI();
  @@ -117,6 +120,7 @@
       private static void fillElementProp(RuntimeBindingProperty prop,
                                           UnmarshalResult context,
                                           Object inter)
  +        throws XmlException
       {
           final TypeUnmarshaller um = prop.getTypeUnmarshaller(context);
           assert um != null;
  @@ -135,6 +139,7 @@
       private static void fillAttributeProp(RuntimeBindingProperty prop,
                                             UnmarshalResult context,
                                             Object inter)
  +        throws XmlException
       {
           final TypeUnmarshaller um = prop.getTypeUnmarshaller(context);
           assert um != null;
  @@ -152,6 +157,7 @@
       }
   
       private void deserializeAttributes(Object inter, UnmarshalResult context)
  +        throws XmlException
       {
           while (context.hasMoreAttributes()) {
               RuntimeBindingProperty prop = findMatchingAttributeProperty(context);
  
  
  
  1.6       +3 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByteTypeConverter.java
  
  Index: ByteTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByteTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ByteTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ ByteTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,18 +56,21 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class ByteTypeConverter
       extends BaseSimpleTypeConverter
   {
       protected Object getObject(UnmarshalResult context)
  +        throws XmlException
       {
           byte val = context.getByteValue();
           return new Byte(val);
       }
   
       public Object unmarshalAttribute(UnmarshalResult context)
  +        throws XmlException
       {
           byte val = context.getAttributeByteValue();
           return new Byte(val);
  
  
  
  1.10      +7 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/CharacterVisitor.java
  
  Index: CharacterVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/CharacterVisitor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CharacterVisitor.java	22 Jan 2004 21:43:47 -0000	1.9
  +++ CharacterVisitor.java	12 Feb 2004 00:30:11 -0000	1.10
  @@ -56,6 +56,8 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
  +
   import javax.xml.namespace.QName;
   import java.util.Collection;
   
  @@ -67,6 +69,7 @@
       CharacterVisitor(RuntimeBindingProperty property,
                        Object parentObject,
                        MarshalResult result)
  +        throws XmlException
       {
           super(parentObject, property, result);
           assert (!(parentObject instanceof Collection));
  @@ -90,11 +93,13 @@
       }
   
       protected int advance()
  +        throws XmlException
       {
           return CHARS;
       }
   
       public XmlTypeVisitor getCurrentChild()
  +        throws XmlException
       {
           throw new AssertionError("no children");
       }
  @@ -105,6 +110,7 @@
       }
   
       protected int getAttributeCount()
  +        throws XmlException
       {
           return 0;
       }
  @@ -125,6 +131,7 @@
       }
   
       private CharSequence grabChars()
  +        throws XmlException
       {
           final Object parent = getParentObject();
           assert parent != null : "bad visitor: this=" + this;
  
  
  
  1.3       +2 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/CollapseStringTypeConverter.java
  
  Index: CollapseStringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/CollapseStringTypeConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CollapseStringTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.2
  +++ CollapseStringTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.3
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.common.XmlWhitespace;
   
   
  @@ -74,6 +75,7 @@
       }
   
       protected Object getObject(UnmarshalResult context)
  +        throws XmlException
       {
           return context.getStringValue(XmlWhitespace.WS_COLLAPSE);
       }
  
  
  
  1.4       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DateTimeTypeConverter.java
  
  Index: DateTimeTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DateTimeTypeConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DateTimeTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.3
  +++ DateTimeTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.4
  @@ -57,6 +57,7 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.XmlCalendar;
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   import java.util.Calendar;
  @@ -66,13 +67,13 @@
       extends BaseSimpleTypeConverter
   {
   
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           XmlCalendar val = context.getCalendarValue();
           return val;
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeCalendarValue();
       }
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DecimalTypeConverter.java
  
  Index: DecimalTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DecimalTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DecimalTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ DecimalTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   import java.math.BigDecimal;
  @@ -64,13 +65,13 @@
       extends BaseSimpleTypeConverter
   {
   
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           BigDecimal val = context.getBigDecimalValue();
           return val;
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeBigDecimalValue();
       }
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DoubleTypeConverter.java
  
  Index: DoubleTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/DoubleTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DoubleTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ DoubleTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,18 +56,19 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class DoubleTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           double val = context.getDoubleValue();
           return new Double(val);
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           double val = context.getAttributeDoubleValue();
           return new Double(val);
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/FloatTypeConverter.java
  
  Index: FloatTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/FloatTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FloatTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ FloatTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,13 +56,14 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class FloatTypeConverter
       extends BaseSimpleTypeConverter
   {
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           float val = context.getAttributeFloatValue();
           return new Float(val);
  @@ -75,7 +76,7 @@
           return XsTypeConverter.printFloat(val.floatValue());
       }
   
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           float val = context.getFloatValue();
           return new Float(val);
  
  
  
  1.4       +16 -4     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/HexBinaryTypeConverter.java
  
  Index: HexBinaryTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/HexBinaryTypeConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HexBinaryTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.3
  +++ HexBinaryTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.4
  @@ -56,23 +56,35 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
  +import java.io.IOException;
   import java.io.InputStream;
   
   final class HexBinaryTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           final InputStream val = context.getHexBinaryValue();
  -        return MarshalStreamUtils.inputStreamToBytes(val);
  +        try {
  +            return MarshalStreamUtils.inputStreamToBytes(val);
  +        }
  +        catch (IOException e) {
  +            throw new XmlException(e);
  +        }
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           final InputStream val = context.getAttributeHexBinaryValue();
  -        return MarshalStreamUtils.inputStreamToBytes(val);
  +        try {
  +            return MarshalStreamUtils.inputStreamToBytes(val);
  +        }
  +        catch (IOException e) {
  +            throw new XmlException(e);
  +        }
       }
   
       //non simple types can throw a runtime exception
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntTypeConverter.java
  
  Index: IntTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- IntTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ IntTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,18 +56,19 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class IntTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           int val = context.getIntValue();
           return new Integer(val);
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           int val = context.getAttributeIntValue();
           return new Integer(val);
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntegerTypeConverter.java
  
  Index: IntegerTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/IntegerTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- IntegerTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ IntegerTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   import java.math.BigInteger;
  @@ -63,13 +64,13 @@
   final class IntegerTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           BigInteger val = context.getBigIntegerValue();
           return val;
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeBigIntegerValue();
       }
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/LongTypeConverter.java
  
  Index: LongTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/LongTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LongTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ LongTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,18 +56,19 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class LongTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           long val = context.getLongValue();
           return new Long(val);
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           long val = context.getAttributeLongValue();
           return new Long(val);
  
  
  
  1.12      +27 -3     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java
  
  Index: MarshalResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MarshalResult.java	22 Jan 2004 21:43:47 -0000	1.11
  +++ MarshalResult.java	12 Feb 2004 00:30:11 -0000	1.12
  @@ -56,7 +56,9 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.XmlOptions;
  +import org.apache.xmlbeans.XmlRuntimeException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  @@ -109,6 +111,7 @@
                     RuntimeBindingProperty property,
                     Object obj,
                     XmlOptions options)
  +        throws XmlException
       {
           this.runtimeTypeFactory = runtimeTypeFactory;
           bindingLoader = loader;
  @@ -126,6 +129,7 @@
       protected static XmlTypeVisitor createVisitor(RuntimeBindingProperty property,
                                                     Object obj,
                                                     MarshalResult result)
  +        throws XmlException
       {
           BindingType btype = property.getType();
   
  @@ -160,7 +164,12 @@
                   throw new AssertionError("invalid: " + currVisitor.getState());
           }
   
  -        return (currentEventType = advanceToNext());
  +        try {
  +            return (currentEventType = advanceToNext());
  +        }
  +        catch (XmlException e) {
  +            throw new XMLStreamException(e);
  +        }
       }
   
   
  @@ -192,6 +201,7 @@
   
   
       RuntimeBindingType createRuntimeBindingType(BindingType type, Object instance)
  +        throws XmlException
       {
           final BindingTypeName type_name = type.getName();
           String expectedJavaClass = type_name.getJavaName().toString();
  @@ -212,6 +222,7 @@
   
   
       private int advanceToNext()
  +        throws XmlException
       {
           final int next_state = currVisitor.advance();
           switch (next_state) {
  @@ -323,7 +334,13 @@
       public int getAttributeCount()
       {
           initAttributes();
  -        return currVisitor.getAttributeCount();
  +        try {
  +            return currVisitor.getAttributeCount();
  +        }
  +        catch (XmlException e) {
  +            //interface forces us into this...
  +            throw new XmlRuntimeException(e);
  +        }
       }
   
       public QName getAttributeName(int i)
  @@ -564,7 +581,14 @@
       private void initAttributes()
       {
           if (!initedAttributes) {
  -            currVisitor.initAttributes();
  +            try {
  +                currVisitor.initAttributes();
  +            }
  +            catch (XmlException e) {
  +                //public attribute interfaces of XMLStreamReader
  +                //force us into this behavior
  +                throw new XmlRuntimeException(e);
  +            }
               initedAttributes = true;
           }
       }
  
  
  
  1.15      +90 -101   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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MarshalStreamUtils.java	30 Jan 2004 17:28:31 -0000	1.14
  +++ MarshalStreamUtils.java	12 Feb 2004 00:30:11 -0000	1.15
  @@ -156,37 +156,34 @@
        * @return
        */
       static boolean advanceToNextStartElement(XMLStreamReader reader)
  +        throws XMLStreamException
       {
  -        try {
  -            for (int state = reader.getEventType();
  -                 reader.hasNext();
  -                 state = reader.next()) {
  -                switch (state) {
  -                    case XMLStreamReader.START_ELEMENT:
  -                        return true;
  -                    case XMLStreamReader.END_ELEMENT:
  -                        return false;
  -                    case XMLStreamReader.END_DOCUMENT:
  -                        throw new XmlRuntimeException("unexpected end of XML");
  -
  -                    case XMLStreamReader.PROCESSING_INSTRUCTION:
  -                    case XMLStreamReader.CHARACTERS:
  -                        //TODO: what about mixed content models
  -                    case XMLStreamReader.COMMENT:
  -                    case XMLStreamReader.SPACE:
  -                    case XMLStreamReader.ENTITY_REFERENCE:
  -                    case XMLStreamReader.DTD:
  -                    case XMLStreamReader.NOTATION_DECLARATION:
  -                    case XMLStreamReader.ENTITY_DECLARATION:
  -                        break;
  -                    default:
  -                        throw new AssertionError("unexpected xml state " + state);
  -                }
  +        for (int state = reader.getEventType();
  +             reader.hasNext();
  +             state = reader.next()) {
  +            switch (state) {
  +                case XMLStreamReader.START_ELEMENT:
  +                    return true;
  +                case XMLStreamReader.END_ELEMENT:
  +                    return false;
  +                case XMLStreamReader.END_DOCUMENT:
  +                    throw new XmlRuntimeException("unexpected end of XML");
  +
  +                case XMLStreamReader.PROCESSING_INSTRUCTION:
  +                case XMLStreamReader.CHARACTERS:
  +                    //TODO: what about mixed content models
  +                case XMLStreamReader.COMMENT:
  +                case XMLStreamReader.SPACE:
  +                case XMLStreamReader.ENTITY_REFERENCE:
  +                case XMLStreamReader.DTD:
  +                case XMLStreamReader.NOTATION_DECLARATION:
  +                case XMLStreamReader.ENTITY_DECLARATION:
  +                    break;
  +                default:
  +                    throw new AssertionError("unexpected xml state " + state);
               }
           }
  -        catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  -        }
  +
   
           //end of the steam
           return false;
  @@ -202,6 +199,7 @@
        * @param reader
        */
       static void skipElement(XMLStreamReader reader)
  +        throws XMLStreamException
       {
           assert reader.isStartElement();
   
  @@ -209,33 +207,30 @@
   
           //TODO: seem to be rechecking assertion, why not skip one ahead...
   
  -        try {
  -            for (int state = reader.getEventType(); reader.hasNext();
  -                 state = reader.next()) {
  -                switch (state) {
  -                    case XMLStreamReader.START_ELEMENT:
  -                        cnt++;
  -                        break;
  -                    case XMLStreamReader.END_ELEMENT:
  -                        if (cnt == 0) {
  -                            assert reader.hasNext();
  -                            reader.next();
  -                            return;
  -                        } else {
  -                            cnt--;
  -                        }
  -                        break;
  -                    case XMLStreamReader.END_DOCUMENT:
  -                        //should not happen for well-formed xml
  -                        throw new XmlRuntimeException("unexpected end of xml document");
  -                    default:
  -                        break;
  -                }
  +
  +        for (int state = reader.getEventType(); reader.hasNext();
  +             state = reader.next()) {
  +            switch (state) {
  +                case XMLStreamReader.START_ELEMENT:
  +                    cnt++;
  +                    break;
  +                case XMLStreamReader.END_ELEMENT:
  +                    if (cnt == 0) {
  +                        assert reader.hasNext();
  +                        reader.next();
  +                        return;
  +                    } else {
  +                        cnt--;
  +                    }
  +                    break;
  +                case XMLStreamReader.END_DOCUMENT:
  +                    //should not happen for well-formed xml
  +                    throw new XmlRuntimeException("unexpected end of xml document");
  +                default:
  +                    break;
               }
           }
  -        catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  -        }
  +
   
           //should not happen for well-formed xml
           throw new XmlRuntimeException("unexpected end of xml stream");
  @@ -268,50 +263,46 @@
       }
   
       static void advanceToFirstItemOfInterest(XMLStreamReader rdr)
  +        throws XMLStreamException
       {
  -        try {
  -            for (int state = rdr.getEventType(); rdr.hasNext(); state = rdr.next()) {
  -                switch (state) {
  -                    case XMLStreamReader.START_ELEMENT:
  -                        return;
  -                    case XMLStreamReader.END_ELEMENT:
  -                        throw new XmlRuntimeException("unexpected end of XML");
  -
  -                    case XMLStreamReader.PROCESSING_INSTRUCTION:
  -                        break;
  -                    case XMLStreamReader.CHARACTERS:
  -                        if (rdr.isWhiteSpace()) break;
  -                        throw new AssertionError("NAKED CHARDATA UNIMPLEMENTED");
  -                    case XMLStreamReader.COMMENT:
  -                    case XMLStreamReader.SPACE:
  -                    case XMLStreamReader.START_DOCUMENT:
  -                        break;
  -                    case XMLStreamReader.END_DOCUMENT:
  -                        throw new XmlRuntimeException("unexpected end of XML");
  -
  -                    case XMLStreamReader.ENTITY_REFERENCE:
  -                        break;
  -
  -                    case XMLStreamReader.ATTRIBUTE:
  -                        throw new AssertionError("NAKED ATTRIBUTE UNIMPLEMENTED");
  -
  -                    case XMLStreamReader.DTD:
  -                    case XMLStreamReader.CDATA:
  -                    case XMLStreamReader.NAMESPACE:
  -                    case XMLStreamReader.NOTATION_DECLARATION:
  -                    case XMLStreamReader.ENTITY_DECLARATION:
  -                        break;
  -
  -                    default:
  -                        throw new XmlRuntimeException("unexpected xml state:" + state +
  -                                                      "in" + rdr);
  -                }
  +        for (int state = rdr.getEventType(); rdr.hasNext(); state = rdr.next()) {
  +            switch (state) {
  +                case XMLStreamReader.START_ELEMENT:
  +                    return;
  +                case XMLStreamReader.END_ELEMENT:
  +                    throw new XmlRuntimeException("unexpected end of XML");
  +
  +                case XMLStreamReader.PROCESSING_INSTRUCTION:
  +                    break;
  +                case XMLStreamReader.CHARACTERS:
  +                    if (rdr.isWhiteSpace()) break;
  +                    throw new AssertionError("NAKED CHARDATA UNIMPLEMENTED");
  +                case XMLStreamReader.COMMENT:
  +                case XMLStreamReader.SPACE:
  +                case XMLStreamReader.START_DOCUMENT:
  +                    break;
  +                case XMLStreamReader.END_DOCUMENT:
  +                    throw new XmlRuntimeException("unexpected end of XML");
  +
  +                case XMLStreamReader.ENTITY_REFERENCE:
  +                    break;
  +
  +                case XMLStreamReader.ATTRIBUTE:
  +                    throw new AssertionError("NAKED ATTRIBUTE UNIMPLEMENTED");
  +
  +                case XMLStreamReader.DTD:
  +                case XMLStreamReader.CDATA:
  +                case XMLStreamReader.NAMESPACE:
  +                case XMLStreamReader.NOTATION_DECLARATION:
  +                case XMLStreamReader.ENTITY_DECLARATION:
  +                    break;
  +
  +                default:
  +                    throw new XmlRuntimeException("unexpected xml state:" + state +
  +                                                  "in" + rdr);
               }
  -            throw new XmlRuntimeException("unexpected end of xml stream");
  -        }
  -        catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
           }
  +        throw new XmlRuntimeException("unexpected end of xml stream");
       }
   
       static void addError(Collection errors,
  @@ -333,18 +324,16 @@
       }
   
       static Object inputStreamToBytes(final InputStream val)
  +        throws IOException
       {
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
   
           int b;
  -        try {
  -            while ((b = val.read()) != -1) {
  -                baos.write(b);
  -            }
  -        }
  -        catch (IOException e) {
  -            throw new XmlRuntimeException(e);
  +
  +        while ((b = val.read()) != -1) {
  +            baos.write(b);
           }
  +
           return baos.toByteArray();
       }
   
  
  
  
  1.17      +3 -3      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MarshallerImpl.java	30 Jan 2004 17:28:31 -0000	1.16
  +++ MarshallerImpl.java	12 Feb 2004 00:30:11 -0000	1.17
  @@ -60,7 +60,6 @@
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.XmlObject;
   import org.apache.xmlbeans.XmlOptions;
  -import org.apache.xmlbeans.XmlRuntimeException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  @@ -108,7 +107,7 @@
           if (root_elem_btype == null) {
               final String msg = "failed to find root " +
                   "element corresponding to " + jname;
  -            throw new XmlRuntimeException(msg);
  +            throw new XmlException(msg);
           }
   
           final XmlTypeName elem = root_elem_btype.getXmlName();
  @@ -346,6 +345,7 @@
                                            JavaTypeName java_type,
                                            XmlTypeName xml_type,
                                            BindingLoader loader)
  +        throws XmlException
       {
           //look first for exact match
           {
  @@ -369,7 +369,7 @@
                       String e = "binding configuration inconsistency: found " +
                           btype_name + " defined for " + jname + " but failed " +
                           "to load the type";
  -                    throw new XmlRuntimeException(e);
  +                    throw new XmlException(e);
                   } else {
                       return binding_type; //success!
                   }
  
  
  
  1.6       +2 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/NullUnmarshaller.java
  
  Index: NullUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/NullUnmarshaller.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NullUnmarshaller.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ NullUnmarshaller.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   
   /**
  @@ -72,6 +73,7 @@
       }
   
       public Object unmarshal(UnmarshalResult context)
  +        throws XmlException
       {
           context.skipElement();
           return null;
  
  
  
  1.3       +2 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/PreserveStringTypeConverter.java
  
  Index: PreserveStringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/PreserveStringTypeConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PreserveStringTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.2
  +++ PreserveStringTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.3
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.common.XmlWhitespace;
   
   
  @@ -73,7 +74,7 @@
       {
       }
   
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           return context.getStringValue(XmlWhitespace.WS_PRESERVE);
       }
  
  
  
  1.5       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/QNameTypeConverter.java
  
  Index: QNameTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/QNameTypeConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- QNameTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.4
  +++ QNameTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.5
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   import javax.xml.namespace.QName;
  @@ -64,13 +65,13 @@
       extends BaseSimpleTypeConverter
   {
   
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           QName val = context.getQNameValue();
           return val;
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeQNameValue();
       }
  
  
  
  1.3       +2 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ReplaceStringTypeConverter.java
  
  Index: ReplaceStringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ReplaceStringTypeConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ReplaceStringTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.2
  +++ ReplaceStringTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.3
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.common.XmlWhitespace;
   
   
  @@ -74,6 +75,7 @@
       }
   
       protected Object getObject(UnmarshalResult context)
  +        throws XmlException
       {
           return context.getStringValue(XmlWhitespace.WS_REPLACE);
       }
  
  
  
  1.11      +11 -5     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingProperty.java
  
  Index: RuntimeBindingProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingProperty.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RuntimeBindingProperty.java	27 Jan 2004 01:30:16 -0000	1.10
  +++ RuntimeBindingProperty.java	12 Feb 2004 00:30:11 -0000	1.11
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   
   import javax.xml.namespace.QName;
  @@ -67,16 +68,21 @@
   
       QName getName();
   
  -    TypeUnmarshaller getTypeUnmarshaller(UnmarshalResult context);
  +    TypeUnmarshaller getTypeUnmarshaller(UnmarshalResult context)
  +        throws XmlException;
   
  -    void fill(Object inter, Object prop_obj);
  +    void fill(Object inter, Object prop_obj)
  +        throws XmlException;
   
       //non simple type props can throw some runtime exception.
  -    CharSequence getLexical(Object parent, MarshalResult result);
  +    CharSequence getLexical(Object parent, MarshalResult result)
  +        throws XmlException;
   
  -    Object getValue(Object parentObject, MarshalResult result);
  +    Object getValue(Object parentObject, MarshalResult result)
  +        throws XmlException;
   
  -    boolean isSet(Object parentObject, MarshalResult result);
  +    boolean isSet(Object parentObject, MarshalResult result)
  +        throws XmlException;
   
       boolean isMultiple();
   
  
  
  
  1.7       +3 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingType.java
  
  Index: RuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingType.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RuntimeBindingType.java	15 Dec 2003 05:03:30 -0000	1.6
  +++ RuntimeBindingType.java	12 Feb 2004 00:30:11 -0000	1.7
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   
   /**
  @@ -72,6 +73,7 @@
        * @param bindingLoader
        */
       void initialize(RuntimeBindingTypeTable typeTable,
  -                    BindingLoader bindingLoader);
  +                    BindingLoader bindingLoader)
  +        throws XmlException;
   
   }
  
  
  
  1.11      +7 -4      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingTypeTable.java
  
  Index: RuntimeBindingTypeTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingTypeTable.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RuntimeBindingTypeTable.java	26 Jan 2004 03:34:36 -0000	1.10
  +++ RuntimeBindingTypeTable.java	12 Feb 2004 00:30:11 -0000	1.11
  @@ -56,7 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  -import org.apache.xmlbeans.XmlRuntimeException;
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  @@ -126,6 +126,7 @@
   
       private TypeUnmarshaller createTypeUnmarshaller(BindingType type,
                                                       BindingLoader loader)
  +        throws XmlException
       {
           TypeUnmarshaller type_um;
           //TODO: cleanup this nasty instanceof stuff (Visitor?)
  @@ -153,6 +154,7 @@
   
       TypeUnmarshaller getOrCreateTypeUnmarshaller(BindingType type,
                                                    BindingLoader loader)
  +        throws XmlException
       {
           TypeUnmarshaller um = (TypeUnmarshaller)unmarshallerMap.get(type);
           if (um == null) {
  @@ -288,6 +290,7 @@
       private static TypeUnmarshaller createSimpleTypeUnmarshaller(SimpleBindingType stype,
                                                                    BindingLoader loader,
                                                                    RuntimeBindingTypeTable table)
  +        throws XmlException
       {
           TypeUnmarshaller um = table.getTypeUnmarshaller(stype);
           if (um != null) return um;
  @@ -314,11 +317,11 @@
                   } else {
                       String msg = "invalid as-xml type: " + asif_name +
                           " on type: " + curr.getName();
  -                    throw new XmlRuntimeException(msg);
  +                    throw new XmlException(msg);
                   }
               } else {
  -                throw new XmlRuntimeException("missing as-xml type on " +
  -                                              curr.getName());
  +                throw new XmlException("missing as-xml type on " +
  +                                       curr.getName());
               }
           }
           assert resolved != null;
  
  
  
  1.10      +6 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeGlobalProperty.java
  
  Index: RuntimeGlobalProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeGlobalProperty.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RuntimeGlobalProperty.java	27 Jan 2004 01:30:16 -0000	1.9
  +++ RuntimeGlobalProperty.java	12 Feb 2004 00:30:11 -0000	1.10
  @@ -56,7 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  -import org.apache.xmlbeans.XmlRuntimeException;
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   
   import javax.xml.namespace.QName;
  @@ -90,12 +90,14 @@
       }
   
       public void fill(Object inter, Object prop_obj)
  +        throws XmlException
       {
           throw new UnsupportedOperationException();
       }
   
       //non simple type props can throw some runtime exception.
       public CharSequence getLexical(Object parent, MarshalResult result)
  +        throws XmlException
       {
           //TODO: polymorphism checks
   
  @@ -103,7 +105,7 @@
               result.getTypeTable().getTypeMarshaller(type);
   
           if (tm == null) {
  -            throw new XmlRuntimeException("lookup failed for " + type);
  +            throw new XmlException("lookup failed for " + type);
           }
   
           final CharSequence retval = tm.print(parent, result);
  @@ -111,11 +113,13 @@
       }
   
       public Object getValue(Object parent_obj, MarshalResult result)
  +        throws XmlException
       {
           throw new AssertionError("UNIMP: " + this);
       }
   
       public boolean isSet(Object parentObject, MarshalResult result)
  +        throws XmlException
       {
           return true;
       }
  
  
  
  1.7       +3 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeTypeFactory.java
  
  Index: RuntimeTypeFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeTypeFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RuntimeTypeFactory.java	26 Jan 2004 03:34:36 -0000	1.6
  +++ RuntimeTypeFactory.java	12 Feb 2004 00:30:11 -0000	1.7
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.binding.bts.ByNameBean;
  @@ -85,6 +86,7 @@
       public RuntimeBindingType createRuntimeType(BindingType type,
                                                   RuntimeBindingTypeTable type_table,
                                                   BindingLoader binding_loader)
  +        throws XmlException
       {
           RuntimeBindingType rtype = (RuntimeBindingType)initedTypeMap.get(type);
           if (rtype != null) return rtype;
  @@ -105,6 +107,7 @@
       }
   
       private static RuntimeBindingType allocateType(BindingType type)
  +        throws XmlException
       {
           //TODO: fix instanceof nastiness
           if (type instanceof ByNameBean) {
  
  
  
  1.6       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ShortTypeConverter.java
  
  Index: ShortTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ShortTypeConverter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ShortTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.5
  +++ ShortTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.6
  @@ -56,18 +56,19 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   final class ShortTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           short val = context.getShortValue();
           return new Short(val);
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           short val = context.getAttributeShortValue();
           return new Short(val);
  
  
  
  1.10      +6 -0      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/SimpleTypeVisitor.java
  
  Index: SimpleTypeVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/SimpleTypeVisitor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SimpleTypeVisitor.java	22 Jan 2004 21:43:47 -0000	1.9
  +++ SimpleTypeVisitor.java	12 Feb 2004 00:30:11 -0000	1.10
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   import javax.xml.namespace.QName;
  @@ -71,6 +72,7 @@
   
       public SimpleTypeVisitor(RuntimeBindingProperty property, Object obj,
                                MarshalResult result)
  +        throws XmlException
       {
           super(obj, property, result);
           charVisitor = new CharacterVisitor(property, obj, result);
  @@ -82,6 +84,7 @@
       }
   
       protected int advance()
  +        throws XmlException
       {
           final int newstate;
           switch (state) {
  @@ -103,12 +106,14 @@
       }
   
       public XmlTypeVisitor getCurrentChild()
  +        throws XmlException
       {
           assert state == CHARS;
           return charVisitor;
       }
   
       protected void initAttributes()
  +        throws XmlException
       {
           if (getParentObject() == null) {
               attributeName = fillPrefix(MarshalStreamUtils.XSI_NIL_QNAME);
  @@ -116,6 +121,7 @@
       }
   
       protected int getAttributeCount()
  +        throws XmlException
       {
           //TODO: xsi:type for polymorphism
           return attributeName == null ? 0 : 1;
  
  
  
  1.7       +3 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/StringTypeConverter.java
  
  Index: StringTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/StringTypeConverter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StringTypeConverter.java	22 Jan 2004 21:43:47 -0000	1.6
  +++ StringTypeConverter.java	12 Feb 2004 00:30:11 -0000	1.7
  @@ -56,17 +56,18 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.util.XsTypeConverter;
   
   class StringTypeConverter
       extends BaseSimpleTypeConverter
   {
  -    protected Object getObject(UnmarshalResult context)
  +    protected Object getObject(UnmarshalResult context) throws XmlException
       {
           return context.getStringValue();
       }
   
  -    public Object unmarshalAttribute(UnmarshalResult context)
  +    public Object unmarshalAttribute(UnmarshalResult context) throws XmlException
       {
           return context.getAttributeStringValue();
       }
  
  
  
  1.8       +5 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/TypeUnmarshaller.java
  
  Index: TypeUnmarshaller.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/TypeUnmarshaller.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TypeUnmarshaller.java	26 Jan 2004 03:34:36 -0000	1.7
  +++ TypeUnmarshaller.java	12 Feb 2004 00:30:11 -0000	1.8
  @@ -56,6 +56,7 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   
   /**
  @@ -76,7 +77,8 @@
        * @param result  contains that state of the document unmarshal process
        * @return  Object representing the converted xml
        */
  -    Object unmarshal(UnmarshalResult result);
  +    Object unmarshal(UnmarshalResult result)
  +        throws XmlException;
   
       /**
        * unmarshal the lexical value of an instance of xsd:anySimpleType.
  @@ -89,7 +91,8 @@
        *            <tt>unmarshalSimpleType</tt> operation is not supported
        *            by this TypeUnmarshaller.
        */
  -    Object unmarshalAttribute(UnmarshalResult result);
  +    Object unmarshalAttribute(UnmarshalResult result)
  +        throws XmlException;
   
   
       /**
  
  
  
  1.4       +105 -86   xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalResult.java
  
  Index: UnmarshalResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/UnmarshalResult.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnmarshalResult.java	29 Jan 2004 03:48:28 -0000	1.3
  +++ UnmarshalResult.java	12 Feb 2004 00:30:11 -0000	1.4
  @@ -62,7 +62,6 @@
   import org.apache.xmlbeans.XmlCalendar;
   import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.XmlOptions;
  -import org.apache.xmlbeans.XmlRuntimeException;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   import org.apache.xmlbeans.impl.binding.bts.BindingType;
   import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  @@ -193,6 +192,7 @@
   
   
       private Object unmarshalBindingType(BindingType bindingType)
  +        throws XmlException
       {
           TypeUnmarshaller um =
               typeTable.getOrCreateTypeUnmarshaller(bindingType, bindingLoader);
  @@ -271,376 +271,376 @@
   
       // ======================= xml access methods =======================
   
  -    String getStringValue()
  +    String getStringValue() throws XmlException
       {
           try {
               return baseReader.getStringValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    String getStringValue(int ws)
  +    String getStringValue(int ws) throws XmlException
       {
           try {
               return baseReader.getStringValue(ws);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    boolean getBooleanValue()
  +    boolean getBooleanValue() throws XmlException
       {
           try {
               return baseReader.getBooleanValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    byte getByteValue()
  +    byte getByteValue() throws XmlException
       {
           try {
               return baseReader.getByteValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    short getShortValue()
  +    short getShortValue() throws XmlException
       {
           try {
               return baseReader.getShortValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    int getIntValue()
  +    int getIntValue() throws XmlException
       {
           try {
               return baseReader.getIntValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    long getLongValue()
  +    long getLongValue() throws XmlException
       {
           try {
               return baseReader.getLongValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    BigInteger getBigIntegerValue()
  +    BigInteger getBigIntegerValue() throws XmlException
       {
           try {
               return baseReader.getBigIntegerValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    BigDecimal getBigDecimalValue()
  +    BigDecimal getBigDecimalValue() throws XmlException
       {
           try {
               return baseReader.getBigDecimalValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    float getFloatValue()
  +    float getFloatValue() throws XmlException
       {
           try {
               return baseReader.getFloatValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    double getDoubleValue()
  +    double getDoubleValue() throws XmlException
       {
           try {
               return baseReader.getDoubleValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    InputStream getHexBinaryValue()
  +    InputStream getHexBinaryValue() throws XmlException
       {
           try {
               return baseReader.getHexBinaryValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    InputStream getBase64Value()
  +    InputStream getBase64Value() throws XmlException
       {
           try {
               return baseReader.getBase64Value();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    XmlCalendar getCalendarValue()
  +    XmlCalendar getCalendarValue() throws XmlException
       {
           try {
               return baseReader.getCalendarValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    String getAnyUriValue()
  +    String getAnyUriValue() throws XmlException
       {
           try {
               return baseReader.getStringValue(XMLStreamReaderExt.WS_COLLAPSE);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    Date getDateValue()
  +    Date getDateValue() throws XmlException
       {
           try {
               final GDate val = baseReader.getGDateValue();
               return val == null ? null : val.getDate();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    GDate getGDateValue()
  +    GDate getGDateValue() throws XmlException
       {
           try {
               return baseReader.getGDateValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    GDuration getGDurationValue()
  +    GDuration getGDurationValue() throws XmlException
       {
           try {
               return baseReader.getGDurationValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    QName getQNameValue()
  +    QName getQNameValue() throws XmlException
       {
           try {
               return baseReader.getQNameValue();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    String getAttributeStringValue()
  +    String getAttributeStringValue() throws XmlException
       {
           try {
               return baseReader.getAttributeStringValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    boolean getAttributeBooleanValue()
  +    boolean getAttributeBooleanValue() throws XmlException
       {
           try {
               return baseReader.getAttributeBooleanValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    byte getAttributeByteValue()
  +    byte getAttributeByteValue() throws XmlException
       {
           try {
               return baseReader.getAttributeByteValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    short getAttributeShortValue()
  +    short getAttributeShortValue() throws XmlException
       {
           try {
               return baseReader.getAttributeShortValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    int getAttributeIntValue()
  +    int getAttributeIntValue() throws XmlException
       {
           try {
               return baseReader.getAttributeIntValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    long getAttributeLongValue()
  +    long getAttributeLongValue() throws XmlException
       {
           try {
               return baseReader.getAttributeLongValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    BigInteger getAttributeBigIntegerValue()
  +    BigInteger getAttributeBigIntegerValue() throws XmlException
       {
           try {
               return baseReader.getAttributeBigIntegerValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    BigDecimal getAttributeBigDecimalValue()
  +    BigDecimal getAttributeBigDecimalValue() throws XmlException
       {
           try {
               return baseReader.getAttributeBigDecimalValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    float getAttributeFloatValue()
  +    float getAttributeFloatValue() throws XmlException
       {
           try {
               return baseReader.getAttributeFloatValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    double getAttributeDoubleValue()
  +    double getAttributeDoubleValue() throws XmlException
       {
           try {
               return baseReader.getAttributeDoubleValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    String getAttributeAnyUriValue()
  +    String getAttributeAnyUriValue() throws XmlException
       {
           try {
               return baseReader.getAttributeStringValue(currentAttributeIndex,
                                                         XMLStreamReaderExt.WS_COLLAPSE);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    InputStream getAttributeHexBinaryValue()
  +    InputStream getAttributeHexBinaryValue() throws XmlException
       {
           try {
               return baseReader.getAttributeHexBinaryValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    InputStream getAttributeBase64Value()
  +    InputStream getAttributeBase64Value() throws XmlException
       {
           try {
               return baseReader.getAttributeBase64Value(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    XmlCalendar getAttributeCalendarValue()
  +    XmlCalendar getAttributeCalendarValue() throws XmlException
       {
           try {
               return baseReader.getAttributeCalendarValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    Date getAttributeDateValue()
  +    Date getAttributeDateValue() throws XmlException
       {
           try {
               GDate val = baseReader.getAttributeGDateValue(currentAttributeIndex);
               return val == null ? null : val.getDate();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    GDate getAttributeGDateValue()
  +    GDate getAttributeGDateValue() throws XmlException
       {
           try {
               return baseReader.getAttributeGDateValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    GDuration getAttributeGDurationValue()
  +    GDuration getAttributeGDurationValue() throws XmlException
       {
           try {
               return baseReader.getAttributeGDurationValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    QName getAttributeQNameValue()
  +    QName getAttributeQNameValue() throws XmlException
       {
           try {
               return baseReader.getAttributeQNameValue(currentAttributeIndex);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  @@ -649,7 +649,7 @@
        * return the QName value found for xsi:type
        * or null if neither one was found
        */
  -    QName getXsiType()
  +    QName getXsiType() throws XmlException
       {
           if (!gotXsiAttributes) {
               getXsiAttributes();
  @@ -658,7 +658,7 @@
           return xsiAttributeHolder.xsiType;
       }
   
  -    boolean hasXsiNil()
  +    boolean hasXsiNil() throws XmlException
       {
           if (!gotXsiAttributes) {
               getXsiAttributes();
  @@ -667,14 +667,14 @@
           return xsiAttributeHolder.hasXsiNil;
       }
   
  -    private void getXsiAttributes()
  +    private void getXsiAttributes() throws XmlException
       {
           try {
               MarshalStreamUtils.getXsiAttributes(xsiAttributeHolder,
                                                   baseReader, errors);
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
           gotXsiAttributes = true;
       }
  @@ -684,20 +684,33 @@
        * @return  false if we hit an end element (any end element at all)
        */
       boolean advanceToNextStartElement()
  +        throws XmlException
       {
  -        boolean ret = MarshalStreamUtils.advanceToNextStartElement(baseReader);
  +        final boolean ret;
  +        try {
  +            ret = MarshalStreamUtils.advanceToNextStartElement(baseReader);
  +        }
  +        catch (XMLStreamException e) {
  +            throw new XmlException(e);
  +        }
           updateAttributeState();
           return ret;
       }
   
   
       void advanceToFirstItemOfInterest()
  +        throws XmlException
       {
           assert baseReader != null;
  -        MarshalStreamUtils.advanceToFirstItemOfInterest(baseReader);
  +        try {
  +            MarshalStreamUtils.advanceToFirstItemOfInterest(baseReader);
  +        }
  +        catch (XMLStreamException e) {
  +            throw new XmlException(e);
  +        }
       }
   
  -    int next()
  +    int next() throws XmlException
       {
           try {
               final int new_state = baseReader.next();
  @@ -705,17 +718,17 @@
               return new_state;
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  -    boolean hasNext()
  +    boolean hasNext() throws XmlException
       {
           try {
               return baseReader.hasNext();
           }
           catch (XMLStreamException e) {
  -            throw new XmlRuntimeException(e);
  +            throw new XmlException(e);
           }
       }
   
  @@ -765,8 +778,14 @@
       }
   
       void skipElement()
  +        throws XmlException
       {
  -        MarshalStreamUtils.skipElement(baseReader);
  +        try {
  +            MarshalStreamUtils.skipElement(baseReader);
  +        }
  +        catch (XMLStreamException e) {
  +            throw new XmlException(e);
  +        }
           updateAttributeState();
       }
   
  
  
  
  1.7       +9 -3      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/XmlTypeVisitor.java
  
  Index: XmlTypeVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/XmlTypeVisitor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlTypeVisitor.java	22 Jan 2004 21:43:47 -0000	1.6
  +++ XmlTypeVisitor.java	12 Feb 2004 00:30:11 -0000	1.7
  @@ -56,6 +56,8 @@
   
   package org.apache.xmlbeans.impl.marshal;
   
  +import org.apache.xmlbeans.XmlException;
  +
   import javax.xml.namespace.QName;
   
   abstract class XmlTypeVisitor
  @@ -96,19 +98,23 @@
        *
        * @return  next state
        */
  -    protected abstract int advance();
  +    protected abstract int advance()
  +        throws XmlException;
   
  -    public abstract XmlTypeVisitor getCurrentChild();
  +    public abstract XmlTypeVisitor getCurrentChild()
  +        throws XmlException;
   
   
       protected abstract QName getName();
   
       //guaranteed to be called before any getAttribute* or getNamespace* method
       protected void initAttributes()
  +        throws XmlException
       {
       }
   
  -    protected abstract int getAttributeCount();
  +    protected abstract int getAttributeCount() 
  +        throws XmlException;
   
       protected abstract String getAttributeValue(int idx);
   
  
  
  

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