Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

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)

reger2f51baff4f29
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;
}