You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2004/12/04 00:16:35 UTC

cvs commit: xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2 Locale.java

cezar       2004/12/03 15:16:35

  Modified:    v2/src/newstore2/org/apache/xmlbeans/impl/newstore2
                        Locale.java
  Log:
  Fix for loading aa store from a partial xmlstreamreader.
  
  Revision  Changes    Path
  1.36      +8 -1      xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java
  
  Index: Locale.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Locale.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- Locale.java	30 Nov 2004 00:02:03 -0000	1.35
  +++ Locale.java	3 Dec 2004 23:16:35 -0000	1.36
  @@ -948,6 +948,7 @@
           boolean standAlone = false;
           
           LoadContext context = new Cur.CurLoadContext( this, options );
  +        int depth = 0;
   
           events:
           for ( int eventType = xsr.getEventType() ; ; eventType = xsr.next() )
  @@ -956,6 +957,8 @@
               {
               case XMLStreamReader.START_DOCUMENT :
               {
  +                depth++;
  +
                   encoding   = xsr.getCharacterEncodingScheme();
                   version    = xsr.getVersion();
                   standAlone = xsr.isStandalone();
  @@ -968,6 +971,8 @@
               
               case XMLStreamReader.END_DOCUMENT :
               {
  +                depth--;
  +
                   if (lineNums)
                       lineNumber( xsr, context );
   
  @@ -976,6 +981,7 @@
               
               case XMLStreamReader.START_ELEMENT :
               {
  +                depth++;
                   context.startElement( xsr.getName() );
                   
                   if (lineNums)
  @@ -989,6 +995,7 @@
               
               case XMLStreamReader.END_ELEMENT :
               {
  +                depth--;
                   context.endElement();
                   
                   if (lineNums)
  @@ -1056,7 +1063,7 @@
                   throw new RuntimeException( "Unhandled xml event type: " + eventType );
               }
   
  -            if (!xsr.hasNext())
  +            if (!xsr.hasNext() || depth<=0)
                   break;
           }
           
  
  
  

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