Merge pull request #178 from EagerLogic/fixed_atom_image

Fixed: SyndFeed image is missing if the feed is Atom feed.
This commit is contained in:
Patrick Gotthard 2014-03-20 19:51:34 +01:00
commit 5f9d3f1aa0
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());