Fixed: SyndFeed image is missing if the feed is Atom feed.

This commit is contained in:
David Ipacs 2014-02-09 08:43:16 +01:00
parent 8ded48b469
commit ae8a615f37
2 changed files with 24 additions and 0 deletions

View file

@ -36,6 +36,8 @@ import com.sun.syndication.feed.synd.SyndEnclosureImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndImage;
import com.sun.syndication.feed.synd.SyndImageImpl;
import com.sun.syndication.feed.synd.SyndLink;
import com.sun.syndication.feed.synd.SyndLinkImpl;
import com.sun.syndication.feed.synd.SyndPerson;
@ -71,6 +73,16 @@ public class ConverterForAtom03 implements Converter {
syndFeed.setEncoding(aFeed.getEncoding());
syndFeed.setStyleSheet(aFeed.getStyleSheet());
if (aFeed.getLogo() != null) {
SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getLogo());
syndFeed.setImage(image);
} else if (aFeed.getIcon() != null) {
SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getIcon());
syndFeed.setImage(image);
}
syndFeed.setUri(aFeed.getId());

View file

@ -39,6 +39,8 @@ import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.feed.synd.SyndImage;
import com.sun.syndication.feed.synd.SyndImageImpl;
import com.sun.syndication.feed.synd.SyndLink;
import com.sun.syndication.feed.synd.SyndLinkImpl;
import com.sun.syndication.feed.synd.SyndPerson;
@ -73,6 +75,16 @@ public class ConverterForAtom10 implements Converter {
syndFeed.setEncoding(aFeed.getEncoding());
syndFeed.setStyleSheet(aFeed.getStyleSheet());
if (aFeed.getLogo() != null) {
SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getLogo());
syndFeed.setImage(image);
} else if (aFeed.getIcon() != null) {
SyndImage image = new SyndImageImpl();
image.setUrl(aFeed.getIcon());
syndFeed.setImage(image);
}
syndFeed.setUri(aFeed.getId());