diff --git a/src/main/java/com/sun/syndication/io/impl/OPML10Generator.java b/src/main/java/com/sun/syndication/io/impl/OPML10Generator.java index c8a497f..008bef1 100644 --- a/src/main/java/com/sun/syndication/io/impl/OPML10Generator.java +++ b/src/main/java/com/sun/syndication/io/impl/OPML10Generator.java @@ -20,6 +20,7 @@ package com.sun.syndication.io.impl; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import org.jdom2.Document; import org.jdom2.Element; @@ -106,13 +107,13 @@ public class OPML10Generator extends BaseWireFeedGenerator implements WireFeedGe boolean hasHead = false; if (opml.getCreated() != null) { - hasHead = addNotNullSimpleElement(head, "dateCreated", DateParser.formatRFC822(opml.getCreated())); + hasHead = addNotNullSimpleElement(head, "dateCreated", DateParser.formatRFC822(opml.getCreated(), Locale.US)); } hasHead = addNotNullSimpleElement(head, "expansionState", intArrayToCsvString(opml.getExpansionState())); if (opml.getModified() != null) { - hasHead = addNotNullSimpleElement(head, "dateModified", DateParser.formatRFC822(opml.getModified())); + hasHead = addNotNullSimpleElement(head, "dateModified", DateParser.formatRFC822(opml.getModified(), Locale.US)); } hasHead = addNotNullSimpleElement(head, "ownerEmail", opml.getOwnerEmail()); diff --git a/src/main/java/com/sun/syndication/io/impl/OPML10Parser.java b/src/main/java/com/sun/syndication/io/impl/OPML10Parser.java index 70c9a23..ab540d6 100644 --- a/src/main/java/com/sun/syndication/io/impl/OPML10Parser.java +++ b/src/main/java/com/sun/syndication/io/impl/OPML10Parser.java @@ -19,6 +19,7 @@ package com.sun.syndication.io.impl; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; @@ -81,7 +82,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser { * @throws FeedException thrown if a feed bean cannot be created out of the XML document (JDOM). */ @Override - public WireFeed parse(final Document document, final boolean validate) throws IllegalArgumentException, FeedException { + public WireFeed parse(final Document document, final boolean validate, final Locale locale) throws IllegalArgumentException, FeedException { final Opml opml = new Opml(); opml.setFeedType("opml_1.0"); @@ -92,11 +93,11 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser { opml.setTitle(head.getChildText("title")); if (head.getChildText("dateCreated") != null) { - opml.setCreated(DateParser.parseRFC822(head.getChildText("dateCreated"))); + opml.setCreated(DateParser.parseRFC822(head.getChildText("dateCreated"), Locale.US)); } if (head.getChildText("dateModified") != null) { - opml.setModified(DateParser.parseRFC822(head.getChildText("dateModified"))); + opml.setModified(DateParser.parseRFC822(head.getChildText("dateModified"), Locale.US)); } opml.setOwnerName(head.getChildTextTrim("ownerName")); @@ -160,13 +161,13 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser { } } - opml.setOutlines(parseOutlines(root.getChild("body").getChildren("outline"), validate)); - opml.setModules(parseFeedModules(root)); + opml.setOutlines(parseOutlines(root.getChild("body").getChildren("outline"), validate, locale)); + opml.setModules(parseFeedModules(root, locale)); return opml; } - protected Outline parseOutline(final Element e, final boolean validate) throws FeedException { + protected Outline parseOutline(final Element e, final boolean validate, final Locale locale) throws FeedException { if (!e.getName().equals("outline")) { throw new RuntimeException("Not an outline element."); } @@ -211,17 +212,17 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser { } final List children = e.getChildren("outline"); - outline.setModules(parseItemModules(e)); - outline.setChildren(parseOutlines(children, validate)); + outline.setModules(parseItemModules(e, locale)); + outline.setChildren(parseOutlines(children, validate, locale)); return outline; } - protected List parseOutlines(final List elements, final boolean validate) throws FeedException { + protected List parseOutlines(final List elements, final boolean validate, final Locale locale) throws FeedException { final ArrayList results = new ArrayList(); for (int i = 0; i < elements.size(); i++) { - results.add(parseOutline((Element) elements.get(i), validate)); + results.add(parseOutline((Element) elements.get(i), validate, locale)); } return results; diff --git a/src/main/java/com/sun/syndication/io/impl/OPML20Generator.java b/src/main/java/com/sun/syndication/io/impl/OPML20Generator.java index 9f6df0d..c88826e 100644 --- a/src/main/java/com/sun/syndication/io/impl/OPML20Generator.java +++ b/src/main/java/com/sun/syndication/io/impl/OPML20Generator.java @@ -8,6 +8,8 @@ */ package com.sun.syndication.io.impl; +import java.util.Locale; + import org.jdom2.Document; import org.jdom2.Element; @@ -76,7 +78,7 @@ public class OPML20Generator extends OPML10Generator { retValue = super.generateOutline(outline); if (outline.getCreated() != null) { - retValue.setAttribute("created", DateParser.formatRFC822(outline.getCreated())); + retValue.setAttribute("created", DateParser.formatRFC822(outline.getCreated(), Locale.US)); } return retValue; diff --git a/src/main/java/com/sun/syndication/io/impl/OPML20Parser.java b/src/main/java/com/sun/syndication/io/impl/OPML20Parser.java index 6461b53..5ddba37 100644 --- a/src/main/java/com/sun/syndication/io/impl/OPML20Parser.java +++ b/src/main/java/com/sun/syndication/io/impl/OPML20Parser.java @@ -18,6 +18,7 @@ package com.sun.syndication.io.impl; import java.util.List; +import java.util.Locale; import org.jdom2.Document; import org.jdom2.Element; @@ -71,9 +72,9 @@ public class OPML20Parser extends OPML10Parser { * @throws FeedException thrown if a feed bean cannot be created out of the XML document (JDOM). */ @Override - public WireFeed parse(final Document document, final boolean validate) throws IllegalArgumentException, FeedException { + public WireFeed parse(final Document document, final boolean validate, final Locale locale) throws IllegalArgumentException, FeedException { Opml opml; - opml = (Opml) super.parse(document, validate); + opml = (Opml) super.parse(document, validate, locale); final Element head = document.getRootElement().getChild("head"); @@ -92,13 +93,13 @@ public class OPML20Parser extends OPML10Parser { } @Override - protected Outline parseOutline(final Element e, final boolean validate) throws FeedException { + protected Outline parseOutline(final Element e, final boolean validate, final Locale locale) throws FeedException { Outline retValue; - retValue = super.parseOutline(e, validate); + retValue = super.parseOutline(e, validate, locale); if (e.getAttributeValue("created") != null) { - retValue.setCreated(DateParser.parseRFC822(e.getAttributeValue("created"))); + retValue.setCreated(DateParser.parseRFC822(e.getAttributeValue("created"), locale)); } final List atts = retValue.getAttributes();