From ae8a615f37375768f1d2a5a78a9a23dd470ca898 Mon Sep 17 00:00:00 2001 From: David Ipacs Date: Sun, 9 Feb 2014 08:43:16 +0100 Subject: [PATCH] Fixed: SyndFeed image is missing if the feed is Atom feed. --- .../feed/synd/impl/ConverterForAtom03.java | 12 ++++++++++++ .../feed/synd/impl/ConverterForAtom10.java | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java b/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java index baea28b..dab8725 100644 --- a/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java +++ b/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java @@ -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()); diff --git a/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java b/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java index 87ffe49..9f42648 100644 --- a/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java +++ b/src/main/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java @@ -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());