Project

Profile

Help

Revision 141f78c0

Added by Michael Kay over 12 years ago

Fix bug 2723114 - pull from tinytree node crashes JAXB Unmarshaller

View differences:

latest9.1/bj/net/sf/saxon/evpull/EventToStaxBridge.java
1 1
package net.sf.saxon.evpull;
2 2

  
3
import net.sf.saxon.event.LocationProvider;
4
import net.sf.saxon.event.PipelineConfiguration;
3 5
import net.sf.saxon.om.*;
4 6
import net.sf.saxon.pull.NamespaceContextImpl;
5 7
import net.sf.saxon.trans.XPathException;
6 8
import net.sf.saxon.type.Type;
7 9
import net.sf.saxon.value.AtomicValue;
8 10
import net.sf.saxon.value.Whitespace;
9
import net.sf.saxon.event.PipelineConfiguration;
10
import net.sf.saxon.event.LocationProvider;
11 11

  
12 12
import javax.xml.namespace.NamespaceContext;
13 13
import javax.xml.namespace.QName;
......
15 15
import javax.xml.stream.XMLStreamConstants;
16 16
import javax.xml.stream.XMLStreamException;
17 17
import javax.xml.stream.XMLStreamReader;
18
import javax.xml.transform.SourceLocator;
19 18
import java.util.Iterator;
20 19
import java.util.Stack;
20
import java.util.NoSuchElementException;
21 21

  
22 22
/**
23 23
 * This class bridges EventIterator events to XMLStreamReader (Stax) events. That is, it acts
......
223 223
        } catch (XPathException e) {
224 224
            throw new XMLStreamException(e);
225 225
        }
226
        if (p == null) {
227
            // The spec is ambivalent here; it also says IllegalStateException is appropriate
228
            throw new NoSuchElementException("end of stream");
229
        }
226 230
        startElementEvent = null;
227 231
        if (p instanceof StartDocumentEvent) {
228 232
            // STAX doesn't actually report START_DOCUMENT: it's the initial state before reading any events

Also available in: Unified diff