From a4e069da132dcb8066e512ff4dce9edfc0c8b169 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Thu, 19 Jul 2007 10:27:25 +0000 Subject: [PATCH] Vincent's patch, that corrects the error when the favicon link points to a resource that does not exist: http 404 ERROR. This error can be produced by the http://ddj.com/rss/all.xml;jsessionid=OEVRSWPBVGBOQQSNDLRSKHSCJUNN2JVN RSS feed. The patch just creates a File with the url of the favicon and tests if this File really exists. If not, the function return the default RSS favicon. --- .../impl/protocol/rss/ContactRssImpl.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java index 7b67289ce..e59ca4905 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ContactRssImpl.java @@ -239,10 +239,18 @@ public byte[] getImage() try { - URL location = new URL(feedLocation.getProtocol() + "://" - + feedLocation.getHost() + "/favicon.ico"); - ICOFile favicon = new ICOFile(location); - + File fileLocation = new File(feedLocation.getProtocol() + "://" + + feedLocation.getHost() + "/favicon.ico"); + +// If the '.ico' resource is not found on the server (http 404 ERROR - +// File Not Found), we return the default RSS '.ico'. + if(!fileLocation.exists()) + { + return getDefaultRssIcon(); + } + + ICOFile favicon = new ICOFile(fileLocation.toURL()); + logger.trace("Icon has " + favicon.getImageCount() + " pages"); for (int i = 0; i < favicon.getDescriptors().size(); i++)