add header if at least one element is set

This commit is contained in:
Jeremie Panzer 2015-03-10 08:27:59 +01:00
parent 8588d21adb
commit 74b85d9a2c

View file

@ -110,23 +110,23 @@ public class OPML10Generator extends BaseWireFeedGenerator implements WireFeedGe
boolean hasHead = false; boolean hasHead = false;
if (opml.getCreated() != null) { if (opml.getCreated() != null) {
hasHead = addNotNullSimpleElement(head, "dateCreated", DateParser.formatRFC822(opml.getCreated(), Locale.US)); hasHead |= addNotNullSimpleElement(head, "dateCreated", DateParser.formatRFC822(opml.getCreated(), Locale.US));
} }
hasHead = addNotNullSimpleElement(head, "expansionState", intArrayToCsvString(opml.getExpansionState())); hasHead |= addNotNullSimpleElement(head, "expansionState", intArrayToCsvString(opml.getExpansionState()));
if (opml.getModified() != null) { if (opml.getModified() != null) {
hasHead = addNotNullSimpleElement(head, "dateModified", DateParser.formatRFC822(opml.getModified(), Locale.US)); hasHead |= addNotNullSimpleElement(head, "dateModified", DateParser.formatRFC822(opml.getModified(), Locale.US));
} }
hasHead = addNotNullSimpleElement(head, "ownerEmail", opml.getOwnerEmail()); hasHead |= addNotNullSimpleElement(head, "ownerEmail", opml.getOwnerEmail());
hasHead = addNotNullSimpleElement(head, "ownerName", opml.getOwnerName()); hasHead |= addNotNullSimpleElement(head, "ownerName", opml.getOwnerName());
hasHead = addNotNullSimpleElement(head, "title", opml.getTitle()); hasHead |= addNotNullSimpleElement(head, "title", opml.getTitle());
hasHead = addNotNullSimpleElement(head, "vertScrollState", opml.getVerticalScrollState()); hasHead |= addNotNullSimpleElement(head, "vertScrollState", opml.getVerticalScrollState());
hasHead = addNotNullSimpleElement(head, "windowBottom", opml.getWindowBottom()); hasHead |= addNotNullSimpleElement(head, "windowBottom", opml.getWindowBottom());
hasHead = addNotNullSimpleElement(head, "windowLeft", opml.getWindowLeft()); hasHead |= addNotNullSimpleElement(head, "windowLeft", opml.getWindowLeft());
hasHead = addNotNullSimpleElement(head, "windowRight", opml.getWindowRight()); hasHead |= addNotNullSimpleElement(head, "windowRight", opml.getWindowRight());
hasHead = addNotNullSimpleElement(head, "windowTop", opml.getWindowTop()); hasHead |= addNotNullSimpleElement(head, "windowTop", opml.getWindowTop());
if (hasHead) { if (hasHead) {
return head; return head;