enhanced RSS parsing by ensuring that it is parsed with a buffered input

stream
pull/1/head
Michael Peter Christen 13 years ago
parent 7c1feefb28
commit 07ca7e4dd1

@ -25,6 +25,7 @@
package net.yacy.cora.document;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -1967,8 +1968,8 @@ public class MultiProtocolURI implements Serializable, Comparable<MultiProtocolU
}
public InputStream getInputStream(final String userAgent, final int timeout) throws IOException {
if (isFile()) return new FileInputStream(getFSFile());
if (isSMB()) return new SmbFileInputStream(getSmbFile());
if (isFile()) return new BufferedInputStream(new FileInputStream(getFSFile()));
if (isSMB()) return new BufferedInputStream(new SmbFileInputStream(getSmbFile()));
if (isFTP()) {
final FTPClient client = new FTPClient();
client.open(this.host, this.port < 0 ? 21 : this.port);

@ -20,6 +20,7 @@
package net.yacy.cora.document;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@ -57,9 +58,10 @@ public class RSSReader extends DefaultHandler {
this.type = Type.none;
}
public RSSReader(final int maxsize, final InputStream stream, final Type type) throws IOException {
public RSSReader(final int maxsize, InputStream stream, final Type type) throws IOException {
this(maxsize);
this.type = type;
if (!(stream instanceof ByteArrayInputStream) && !(stream instanceof BufferedInputStream)) stream = new BufferedInputStream(stream);
final SAXParserFactory factory = SAXParserFactory.newInstance();
try {
final SAXParser saxParser = factory.newSAXParser();

Loading…
Cancel
Save