From 9d8f426890a4926db2debdb279e6999e2328459a Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Fri, 8 May 2015 10:38:33 +0200 Subject: [PATCH] adding a try-catch to link graph processing to prevent that a single malformed url interrupts the storage process --- source/net/yacy/search/index/Segment.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.java index 236be7537..2c4f82a5c 100644 --- a/source/net/yacy/search/index/Segment.java +++ b/source/net/yacy/search/index/Segment.java @@ -620,13 +620,15 @@ public class Segment { Collection inboundlinks_urlstub = vector.getFieldValues(CollectionSchema.inboundlinks_urlstub_sxt.getSolrFieldName()); List inboundlinks_protocol = inboundlinks_urlstub == null ? null : CollectionConfiguration.indexedList2protocolList(vector.getFieldValues(CollectionSchema.inboundlinks_protocol_sxt.getSolrFieldName()), inboundlinks_urlstub.size()); if (inboundlinks_protocol != null && inboundlinks_urlstub != null && inboundlinks_protocol.size() == inboundlinks_urlstub.size() && inboundlinks_urlstub instanceof List) { - for (int i = 0; i < inboundlinks_protocol.size(); i++) { + for (int i = 0; i < inboundlinks_protocol.size(); i++) try { String targetURL = inboundlinks_protocol.get(i) + "://" + ((String) ((List) inboundlinks_urlstub).get(i)); String referrerhash = id; String anchorhash = ASCII.String(new DigestURL(targetURL).hash()); if (referrerhash != null && anchorhash != null) { urlCitationIndex.add(ASCII.getBytes(anchorhash), new CitationReference(ASCII.getBytes(referrerhash), loadDate.getTime())); } + } catch (Throwable e) { + ConcurrentLog.logException(e); } } } @@ -634,13 +636,15 @@ public class Segment { Collection outboundlinks_urlstub = vector.getFieldValues(CollectionSchema.outboundlinks_urlstub_sxt.getSolrFieldName()); List outboundlinks_protocol = outboundlinks_urlstub == null ? null : CollectionConfiguration.indexedList2protocolList(vector.getFieldValues(CollectionSchema.outboundlinks_protocol_sxt.getSolrFieldName()), outboundlinks_urlstub.size()); if (outboundlinks_protocol != null && outboundlinks_urlstub != null && outboundlinks_protocol.size() == outboundlinks_urlstub.size() && outboundlinks_urlstub instanceof List) { - for (int i = 0; i < outboundlinks_protocol.size(); i++) { + for (int i = 0; i < outboundlinks_protocol.size(); i++) try { String targetURL = outboundlinks_protocol.get(i) + "://" + ((String) ((List) outboundlinks_urlstub).get(i)); String referrerhash = id; String anchorhash = ASCII.String(new DigestURL(targetURL).hash()); if (referrerhash != null && anchorhash != null) { urlCitationIndex.add(ASCII.getBytes(anchorhash), new CitationReference(ASCII.getBytes(referrerhash), loadDate.getTime())); } + } catch (Throwable e) { + ConcurrentLog.logException(e); } } }