- Timestamp:
- 2014-01-30T18:02:53+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/InvalidXmlCharacterFilter.java
r6080 r6787 36 36 } 37 37 38 /** 39 * Constructs a new {@code InvalidXmlCharacterFilter} for the given Reader. 40 * @param reader The reader to filter 41 */ 38 42 public InvalidXmlCharacterFilter(Reader reader) { 39 43 this.reader = reader; … … 60 64 if (in < 0x20 && in >= 0 && INVALID_CHARS[in]) { 61 65 if (firstWarning) { 62 Main.warn("Invalid xml character encountered."); 66 Main.warn("Invalid xml character encountered: '"+in+"'."); 63 67 firstWarning = false; 64 68 } … … 67 71 return in; 68 72 } 69 70 73 } -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r6552 r6787 154 154 } 155 155 156 @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 156 @Override 157 public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 157 158 if (qName.equals("osm")) { 158 159 if (atts == null) { … … 215 216 progressMonitor.beginTask(""); 216 217 progressMonitor.indeterminateSubTask(tr("Parsing list of changesets...")); 217 InputSource inputSource = new InputSource(new InputStreamReader(source, Utils.UTF_8)); 218 InputSource inputSource = new InputSource(new InvalidXmlCharacterFilter(new InputStreamReader(source, Utils.UTF_8))); 218 219 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser.new Parser()); 219 220 return parser.getChangesets(); -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r6716 r6787 87 87 return getInputStreamRaw(urlStr, progressMonitor, null); 88 88 } 89 89 90 90 /** 91 91 * Open a connection to the given url and return a reader on the input stream … … 151 151 String errorHeader = activeConnection.getHeaderField("Error"); 152 152 StringBuilder errorBody = new StringBuilder(); 153 try 154 { 155 InputStream i = FixEncoding(activeConnection.getErrorStream(), encoding); 153 try { 154 InputStream i = fixEncoding(activeConnection.getErrorStream(), encoding); 156 155 if (i != null) { 157 156 BufferedReader in = new BufferedReader(new InputStreamReader(i)); … … 170 169 } 171 170 172 return FixEncoding(new ProgressInputStream(activeConnection, progressMonitor), encoding);171 return fixEncoding(new ProgressInputStream(activeConnection, progressMonitor), encoding); 173 172 } catch (OsmTransferException e) { 174 173 throw e; … … 181 180 } 182 181 183 private InputStream FixEncoding(InputStream stream, String encoding) throws IOException 184 { 182 private InputStream fixEncoding(InputStream stream, String encoding) throws IOException { 185 183 if ("gzip".equalsIgnoreCase(encoding)) { 186 184 stream = new GZIPInputStream(stream); 187 } 188 else if ("deflate".equalsIgnoreCase(encoding)) { 185 } else if ("deflate".equalsIgnoreCase(encoding)) { 189 186 stream = new InflaterInputStream(stream, new Inflater(true)); 190 187 }
Note:
See TracChangeset
for help on using the changeset viewer.