« Return to Thread: Bug in AbstractSchemeValue (Media RSS module)

Re: Bug in AbstractSchemeValue (Media RSS module)

by Robert (kebernet) Cooper :: Rate this Message:

Reply to Author | View in Thread

Yeah, it looks like they have added "urn:simple" as a default scheme on rating since this was implemented. I will look into correcting this soon.

On Mon, Apr 13, 2009 at 11:33 PM, Nick Lothian <nlothian@...> wrote:
I think you are probably correct - what does the specification say?

> -----Original Message-----
> From: dontspamterry [mailto:dontspamterry@...]
> Sent: Tuesday, 14 April 2009 8:18 AM
> To: users@...
> Subject: Bug in AbstractSchemeValue (Media RSS module)
>
>
> Hi there,
>
> I recently downloaded the modules-0.3.2.jar, wrote a test case using an
> example media RSS 2.0 from http://search.yahoo.com/mrss, and got the
> following exception:
>
> Apr 13, 2009 12:30:22 PM
> com.sun.syndication.feed.module.mediarss.io.MediaModuleParser
> parseMetadata
> WARNING: Exception parsing rating tag.
> java.lang.NullPointerException: Scheme and value cannot be null.
>         at
> com.sun.syndication.feed.module.mediarss.types.AbstractSchemeValue.<ini
> t>(AbstractSchemeValue.java:40)
>         at
> com.sun.syndication.feed.module.mediarss.types.Rating.<init>(Rating.jav
> a:66)
>         at
> com.sun.syndication.feed.module.mediarss.io.MediaModuleParser.parseMeta
> data(MediaModuleParser.java:331)
>         at
> com.sun.syndication.feed.module.mediarss.io.MediaModuleParser.parseGrou
> p(MediaModuleParser.java:226)
>         at
> com.sun.syndication.feed.module.mediarss.io.MediaModuleParser.parse(Med
> iaModuleParser.java:97)
>         at
> com.sun.syndication.io.impl.ModuleParsers.parseModules(ModuleParsers.ja
> va:51)
>         at
> com.sun.syndication.io.impl.BaseWireFeedParser.parseItemModules(BaseWir
> eFeedParser.java:68)
>         at
> com.sun.syndication.io.impl.RSS090Parser.parseItem(RSS090Parser.java:29
> 0)
>         at
> com.sun.syndication.io.impl.RSS091UserlandParser.parseItem(RSS091Userla
> ndParser.java:228)
>         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:2
> 63)
>         at
> com.sun.syndication.io.impl.RSS090Parser.parseChannel(RSS090Parser.java
> :178)
>         at
> com.sun.syndication.io.impl.RSS091UserlandParser.parseChannel(RSS091Use
> rlandParser.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:277)
>         at
> com.sun.syndication.io.WireFeedInput.build(WireFeedInput.java:195)
>         at
> com.sun.syndication.io.SyndFeedInput.build(SyndFeedInput.java:123)
>
> I downloaded the sources, took a look at the line in question, and
> noticed
> the following condition:
>
> if ((scheme == null) || (value == null)) {
>             throw new NullPointerException("Scheme and value cannot be
> null.");
> }
>
> Shouldn't the OR operator actually be an AND operator? The exception
> (even
> though it's just logged as a warning message) occurs when it tries to
> handle
> the following tag:
>
> <media:rating>nonadult</media:rating>
>
> The optional 'scheme' attribute for the media:rating tag turns out to
> be
> null causing the condition above to evaluate to true and the exception
> to be
> thrown. From reading the media RSS spec, it says that "If this
> attribute is
> not included, the default scheme is urn:simple (adult | nonadult)". So
> either this value is not getting set to "urn:simple" somewhere upstream
> in
> the call stack or the conditional operator should be changed to AND.
> Another
> thing I noticed is that the parser getting used is RSS090Parser and not
> the
> RSS20YahooParser which might also be causing the problem. Haven't
> figured
> that out yet, but here's the example which I used:
>
> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
> <channel>
> <title>Song Site</title>
> <link>http://www.foo.com</link>
> <description>Songs galore at different bitrates</description>
>       <item>
>               <title>Cool song by an artist</title>
>               <link>http://www.foo.com/item1.htm</link>
>               <media:group>
>                       <media:content
> url="http://www.foo.com/song64kbps.mp3"
>                       fileSize="1000" bitrate="64" type="audio/mpeg"
>                       isDefault="true" expression="full"/>
>                       <media:content
> url="http://www.foo.com/song128kbps.mp3"
>                       fileSize="2000" bitrate="128" type="audio/mpeg"
>                       expression="full"/>
>                       <media:content
> url="http://www.foo.com/song256kbps.mp3"
>                       fileSize="4000" bitrate="256" type="audio/mpeg"
>                       expression="full"/>
>                       <media:content
> url="http://www.foo.com/song512kbps.mp3.torrent"
>                       fileSize="8000" type="application/x-
> bittorrent;enclosed=audio/mpeg"
>                       expression="full"/>
>                       <media:content url="http://www.foo.com/song.wav"
>                       fileSize="16000" type="audio/x-wav"
> expression="full"/>
>                       <media:credit role="musician">band member
> 1</media:credit>
>                       <media:credit role="musician">band member
> 2</media:credit>
>                       <media:category>music/artist
> name/album/song</media:category>
>                       <media:rating>nonadult</media:rating>
>               </media:group>
>       </item>
> </channel>
> </rss>
>
> Anybody provide any insights into this? I can simply patch it by
> changing
> the conditional operator, but if someone knows of the "proper"
> solution,
> then I'd like to hear it.
>
> Thanks,
> -Terry
> --
> View this message in context: http://www.nabble.com/Bug-in-
> AbstractSchemeValue-%28Media-RSS-module%29-tp23030294p23030294.html
> Sent from the Rome - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


IMPORTANT: This e-mail, including any attachments, may contain private or confidential information. If you think you may not be the intended recipient, or if you have received this e-mail in error, please contact the sender immediately and delete all copies of this e-mail. If you are not the intended recipient, you must not reproduce any part of this e-mail or disclose its contents to any other party. This email represents the views of the individual sender, which do not necessarily reflect those of Education.au except where the sender expressly states otherwise. It is your responsibility to scan this email and any files transmitted with it for viruses or any other defects. education.au limited will not be liable for any loss, damage or consequence caused directly or indirectly by this email.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
:Robert "kebernet" Cooper
::kebernet@...
Alice's cleartext
Charlie is the attacker
Bob signs and encrypts
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x9E8759F8

 « Return to Thread: Bug in AbstractSchemeValue (Media RSS module)