only add enclosure if there's one

This commit is contained in:
Athou
2014-12-11 08:32:48 +01:00
parent a19b5090bf
commit ece38c9e59

View File

@@ -77,10 +77,12 @@ public class Entry implements Serializable {
content.setValue(getContent());
entry.setContents(Arrays.<SyndContent> asList(content));
SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
enclosure.setType(getEnclosureType());
enclosure.setUrl(getEnclosureUrl());
entry.setEnclosures(Arrays.<SyndEnclosure> asList(enclosure));
if (getEnclosureUrl() != null) {
SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
enclosure.setType(getEnclosureType());
enclosure.setUrl(getEnclosureUrl());
entry.setEnclosures(Arrays.<SyndEnclosure> asList(enclosure));
}
entry.setLink(getUrl());
entry.setPublishedDate(getDate());