2008年4月10日木曜日

[JAVA>Rome, Itunes RSS/XML] When using Rome ITunes RSS Reader, ParsingFeedException(Invalid XML) error occured.

When using Rome's itunes module, the error "com.sun.syndication.io.ParsingFeedException: Invalid XML" sometimes occures.The error stack is as follows. This error isn't related to the Rome core program, this error is depended on the itunes module.
The Podcast RSS feeds has itunes:duration attribute which means the duration of the podcast file. The value format of this field is always similar to "09:30", but some site are including the invalid value(Long type value).

References
  1. Same error, but the root cause is different from this problem.
    http://taapps-javalibs.blogspot.com/2008/04/javarome-rssxml-when-using-rome-rss.html
  2. Itunes module site
    http://wiki.java.net/bin/view/Javawsxml/ITunes
  3. Source Code repository
    https://rome.dev.java.net/source/browse/rome/
Error Stack
  • Caused by: java.lang.RuntimeException: Illegal time value: 9174935
    at com.sun.syndication.feed.module.itunes.types.Duration.(Duration.java:98)
    at com.sun.syndication.feed.module.itunes.io.ITunesParser.parse(ITunesParser.java:149)
    at com.sun.syndication.io.impl.ModuleParsers.parseModules(ModuleParsers.java:51)
    at com.sun.syndication.io.impl.BaseWireFeedParser.parseItemModules(BaseWireFeedParser.java:57)
    at com.sun.syndication.io.impl.RSS090Parser.parseItem(RSS090Parser.java:289)
    at com.sun.syndication.io.impl.RSS091UserlandParser.parseItem(RSS091UserlandParser.java:222)
    at com.sun.syndication.io.impl.RSS092Parser.parseItem(RSS092Parser.java:81)
    at com.sun.syndication.io.impl.RSS093Parser.parseItem(RSS093Parser.java:39)
    at com.sun.syndication.io.impl.RSS094Parser.parseItem(RSS094Parser.java:68)
    at com.sun.syndication.io.impl.RSS090Parser.parseItems(RSS090Parser.java:263)
    at com.sun.syndication.io.impl.RSS090Parser.parseChannel(RSS090Parser.java:178)
    at com.sun.syndication.io.impl.RSS091UserlandParser.parseChannel(RSS091UserlandParser.java:84)
    at com.sun.syndication.io.impl.RSS092Parser.parseChannel(RSS092Parser.java:49)
    at com.sun.syndication.io.impl.RSS094Parser.parseChannel(RSS094Parser.java:45)
    at com.sun.syndication.io.impl.RSS090Parser.parse(RSS090Parser.java:82)
    at com.sun.syndication.io.WireFeedInput.build(WireFeedInput.java:252)
    at com.sun.syndication.io.WireFeedInput.build(WireFeedInput.java:179)
The reason why this error occures.
When system reads the RSS, Rome and itunes module parses the rss feed. In Duration field, ITuneParser tries to check whether the duration value includes the ":" character or not. But some duration field doesn't include the ":" character, ITuneParser will raise the ParseException.

Solution
Please download the latest source code from the CVS repository, this problem has already solved. I downloaded the latest source code and compiled it. You can get the jar file I compiled.
URL is http://groups.google.com/group/taapps-sourcecode-libraries/web/itunes-0.4-tafix2.jar
(I recompiled itues-0.4.jar file again at 2008/04/14)

0 件のコメント: