Skip to content

Commit 88e95b9

Browse files
committed
SWS-230 in 1.0 branch
1 parent b932905 commit 88e95b9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

xml/src/main/java/org/springframework/xml/stream/AbstractStaxXmlReader.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
import javax.xml.stream.Location;
2020
import javax.xml.stream.XMLStreamException;
2121

22-
import org.springframework.xml.sax.AbstractXmlReader;
2322
import org.xml.sax.ContentHandler;
2423
import org.xml.sax.InputSource;
2524
import org.xml.sax.Locator;
2625
import org.xml.sax.SAXException;
2726
import org.xml.sax.SAXParseException;
2827

28+
import org.springframework.xml.sax.AbstractXmlReader;
29+
2930
/**
3031
* Abstract base class for SAX <code>XMLReader</code> implementations that use StAX as a basis.
3132
*
@@ -67,8 +68,11 @@ private void parse() throws SAXException {
6768
parseInternal();
6869
}
6970
catch (XMLStreamException ex) {
70-
SAXParseException saxException = new SAXParseException(ex.getMessage(), null, null,
71-
ex.getLocation().getLineNumber(), ex.getLocation().getColumnNumber(), ex);
71+
Locator locator = null;
72+
if (ex.getLocation() != null) {
73+
locator = new StaxLocator(ex.getLocation());
74+
}
75+
SAXParseException saxException = new SAXParseException(ex.getMessage(), locator, ex);
7276
if (getErrorHandler() != null) {
7377
getErrorHandler().fatalError(saxException);
7478
}

0 commit comments

Comments
 (0)