Changeset 34960 in osm
- Timestamp:
- 2019-04-02T08:43:52+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/src/reverter/MultiOsmReader.java
r34917 r34960 5 5 import java.io.InputStreamReader; 6 6 7 import javax.xml.stream.XMLInputFactory;8 import javax.xml.stream.XMLStreamException;9 import javax.xml.stream.XMLStreamReader;10 11 7 import org.openstreetmap.josm.io.IllegalDataException; 12 8 import org.openstreetmap.josm.io.OsmReader; 13 9 import org.openstreetmap.josm.io.UTFInputStreamReader; 10 import org.openstreetmap.josm.tools.XmlUtils; 14 11 15 12 /** … … 19 16 public class MultiOsmReader extends OsmReader { 20 17 18 /** 19 * Parse data in source and add to existing dataset. 20 * @param source the input stream with OSM data 21 * @throws IllegalDataException in case of any exception 22 */ 21 23 public void addData(InputStream source) throws IllegalDataException { 22 try { 23 InputStreamReader ir = UTFInputStreamReader.create(source, "UTF-8"); 24 XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(ir); 25 setParser(parser); 24 try (InputStreamReader ir = UTFInputStreamReader.create(source)) { 25 setParser(XmlUtils.newSafeXMLInputFactory().createXMLStreamReader(ir)); 26 26 parse(); 27 } catch (XMLStreamException e) {28 throw new IllegalDataException(e);29 27 } catch (Exception e) { 30 28 throw new IllegalDataException(e);
Note:
See TracChangeset
for help on using the changeset viewer.