undefined method `match' for {}:Hash in itunes_duration=

Bug #675061 reported by Brad Folkens
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ruby-syndication
Status tracked in Trunk
Trunk
Fix Released
Undecided
Unassigned

Bug Description

Getting the following while trying to parse a podcast:

undefined method `match' for {}:Hash
/Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/podcast.rb:34:in `itunes_duration='
/Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:52:in `send'
/Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:52:in `tag_start'
/Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:236:in `tag_start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in `parse'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:201:in `parse_stream'
/Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:188:in `parse'

Attached a patch, works and passes all tests, but I'm not sure if this is an "appropriate" fix.

Revision history for this message
Brad Folkens (bfolkens) wrote :
Revision history for this message
mathew (meta23) wrote :

Can you tell me the URL of the podcast, so I can check exactly what's going on? Thanks.

Revision history for this message
Brad Folkens (bfolkens) wrote :
Revision history for this message
mathew (meta23) wrote : Re: [Bug 675061] Re: undefined method `match' for {}:Hash in itunes_duration=

> http://www.npr.org/rss/podcast.php?id=510284

Hmm. I'm not getting an error running the code below with syndication 0.6.2:

require 'syndication/rss'
require 'open-uri'

url = 'http://www.npr.org/rss/podcast.php?id=510284'

parser = Syndication::RSS::Parser.new

xml = nil

open(url) { |http|
  xml = http.read
}

feed = parser.parse(xml)

for i in feed.items
  puts i.enclosure.url
  puts i.enclosure.type
  puts i.enclosure.length
  puts
end

mathew
--
<URL:http://www.pobox.com/~meta/>

Revision history for this message
Brad Folkens (bfolkens) wrote :

I was using the podcast module.

On Nov 16, 2010, at 8:03 PM, mathew <email address hidden> wrote:

>> http://www.npr.org/rss/podcast.php?id=510284
>
> Hmm. I'm not getting an error running the code below with syndication
> 0.6.2:
>
> require 'syndication/rss'
> require 'open-uri'
>
> url = 'http://www.npr.org/rss/podcast.php?id=510284'
>
> parser = Syndication::RSS::Parser.new
>
> xml = nil
>
> open(url) { |http|
> xml = http.read
> }
>
> feed = parser.parse(xml)
>
> for i in feed.items
> puts i.enclosure.url
> puts i.enclosure.type
> puts i.enclosure.length
> puts
> end
>
>
> mathew
> --
> <URL:http://www.pobox.com/~meta/>
>
> --
> undefined method `match' for {}:Hash in itunes_duration=
> https://bugs.launchpad.net/bugs/675061
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Web Syndication for Ruby: New
>
> Bug description:
> Getting the following while trying to parse a podcast:
>
> undefined method `match' for {}:Hash
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/podcast.rb:34:in `itunes_duration='
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:52:in `send'
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:52:in `tag_start'
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:236:in `tag_start'
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in `parse'
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:201:in `parse_stream'
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:188:in `parse'
>
> Attached a patch, works and passes all tests, but I'm not sure if this is an "appropriate" fix.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ruby-syndication/+bug/675061/+subscribe

Revision history for this message
mathew (meta23) wrote :

OK, it seems to be a change in REXML behavior. It used to pass nil when there were no attributes for an opened XML element, now it (at least sometimes) passes an empty list. So it's a more general problem than just the podcast module, I think.

I've uploaded a patch which makes the common.rb code check for empty attribute lists rather than just nil, before dispatching. I'll push it out as a new gem release. Thanks again.

Revision history for this message
Brad Folkens (bfolkens) wrote :

Thanks a ton!

On Wed, Nov 17, 2010 at 8:47 PM, mathew <email address hidden> wrote:

> OK, it seems to be a change in REXML behavior. It used to pass nil when
> there were no attributes for an opened XML element, now it (at least
> sometimes) passes an empty list. So it's a more general problem than
> just the podcast module, I think.
>
> I've uploaded a patch which makes the common.rb code check for empty
> attribute lists rather than just nil, before dispatching. I'll push it
> out as a new gem release. Thanks again.
>
> --
> undefined method `match' for {}:Hash in itunes_duration=
> https://bugs.launchpad.net/bugs/675061
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Web Syndication for Ruby: Fix Committed
> Status in ruby-syndication trunk series: Fix Committed
>
> Bug description:
> Getting the following while trying to parse a podcast:
>
> undefined method `match' for {}:Hash
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/podcast.rb:34:in
> `itunes_duration='
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:52:in
> `send'
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:52:in
> `tag_start'
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:236:in
> `tag_start'
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in
> `parse'
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:201:in
> `parse_stream'
> /Users/bfolkens/.gems/gems/syndication-0.6.2/lib/syndication/common.rb:188:in
> `parse'
>
> Attached a patch, works and passes all tests, but I'm not sure if this is
> an "appropriate" fix.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ruby-syndication/+bug/675061/+subscribe
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.