From 2f51baff4f29d8825d25a9ce7da0f10a455dbde0 Mon Sep 17 00:00:00 2001 From: reger Date: Thu, 24 Sep 2015 01:58:19 +0200 Subject: [PATCH] check for loading error (includs unsupported formats) to prevent blank thumbnail display in image search because of not handled source which don't load on click. Now the cross icon indicates the problem (inlcuding not supported format) --- source/net/yacy/document/ImageParser.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/net/yacy/document/ImageParser.java b/source/net/yacy/document/ImageParser.java index 69c25e576..ef1fd3580 100644 --- a/source/net/yacy/document/ImageParser.java +++ b/source/net/yacy/document/ImageParser.java @@ -69,7 +69,16 @@ public class ImageParser { final int handle = image.hashCode(); mediaTracker.addImage(image, handle); - try {mediaTracker.waitForID(handle);} catch (final InterruptedException e) {} + try { + mediaTracker.waitForID(handle); + + if (mediaTracker.isErrorID(handle)) { // true if status ERRORD during loading (happens on not supported formats too) + mediaTracker.removeImage(image, handle); + image = null; // return null to indicate source not handled + } + } catch (final InterruptedException e) { + return null; + } return image; }