From f8f1959ebb3f96b66e75d7d83cd70ae9714e85bd Mon Sep 17 00:00:00 2001 From: luccioman Date: Tue, 11 Jul 2017 09:07:48 +0200 Subject: [PATCH] Added parsing within bounds implementation to the generic parser. --- source/net/yacy/document/parser/genericParser.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/net/yacy/document/parser/genericParser.java b/source/net/yacy/document/parser/genericParser.java index 0d6d64d6b..44d30413a 100644 --- a/source/net/yacy/document/parser/genericParser.java +++ b/source/net/yacy/document/parser/genericParser.java @@ -53,6 +53,19 @@ public class genericParser extends AbstractParser implements Parser { final int timezoneOffset, final InputStream source) throws Parser.Failure, InterruptedException { + /* Exactly the same implementation when applying limits as only tokens in the location URL are parsed */ + return parseWithLimits(location, mimeType, charset, scraper, timezoneOffset, source, Integer.MAX_VALUE, Long.MAX_VALUE); + } + + @Override + public boolean isParseWithLimitsSupported() { + return true; + } + + @Override + public Document[] parseWithLimits(final DigestURL location, final String mimeType, final String charset, + final VocabularyScraper scraper, final int timezoneOffset, final InputStream source, final int maxLinks, + final long maxBytes) throws Failure, InterruptedException, UnsupportedOperationException { String filename = location.getFileName(); final Document[] docs = new Document[]{new Document( location,