From 74b85d9a2c95cb135c6e40a9fc7a562462ebf4e5 Mon Sep 17 00:00:00 2001 From: Jeremie Panzer Date: Tue, 10 Mar 2015 08:27:59 +0100 Subject: [PATCH] add header if at least one element is set --- .../opml/io/impl/OPML10Generator.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/rometools/opml/io/impl/OPML10Generator.java b/src/main/java/com/rometools/opml/io/impl/OPML10Generator.java index 707b4c5..e9af30b 100644 --- a/src/main/java/com/rometools/opml/io/impl/OPML10Generator.java +++ b/src/main/java/com/rometools/opml/io/impl/OPML10Generator.java @@ -110,23 +110,23 @@ public class OPML10Generator extends BaseWireFeedGenerator implements WireFeedGe boolean hasHead = false; 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) { - 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, "ownerName", opml.getOwnerName()); - hasHead = addNotNullSimpleElement(head, "title", opml.getTitle()); - hasHead = addNotNullSimpleElement(head, "vertScrollState", opml.getVerticalScrollState()); - hasHead = addNotNullSimpleElement(head, "windowBottom", opml.getWindowBottom()); - hasHead = addNotNullSimpleElement(head, "windowLeft", opml.getWindowLeft()); - hasHead = addNotNullSimpleElement(head, "windowRight", opml.getWindowRight()); - hasHead = addNotNullSimpleElement(head, "windowTop", opml.getWindowTop()); + hasHead |= addNotNullSimpleElement(head, "ownerEmail", opml.getOwnerEmail()); + hasHead |= addNotNullSimpleElement(head, "ownerName", opml.getOwnerName()); + hasHead |= addNotNullSimpleElement(head, "title", opml.getTitle()); + hasHead |= addNotNullSimpleElement(head, "vertScrollState", opml.getVerticalScrollState()); + hasHead |= addNotNullSimpleElement(head, "windowBottom", opml.getWindowBottom()); + hasHead |= addNotNullSimpleElement(head, "windowLeft", opml.getWindowLeft()); + hasHead |= addNotNullSimpleElement(head, "windowRight", opml.getWindowRight()); + hasHead |= addNotNullSimpleElement(head, "windowTop", opml.getWindowTop()); if (hasHead) { return head;