Bugs item #2727, was opened at 2005-10-27 23:44
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2727&group_id=426

Category: Standard Library
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Luke Kanies (lkanies)
Assigned to: Nobody (None)
Summary: XMLRPC::ParseContentType#parse_content_type raises non-XMLRPC exception

Initial Comment:
I have now run into this problem multiple times.  I keep managing to send data that XMLRPC is not expecting, and the call to 'split' in this method (XMLRPC::ParseContentType#parse_content_type) raises a NoMethodError exception instead of an XMLRPC exception:

test_logclient(TestLogger)
    [logger.rb:140:in `test_logclient'
     logger.rb:135:in `each'
     logger.rb:135:in `test_logclient']:
Exception raised:
Class: <NoMethodError>
Message: <"private method `split' called for nil:NilClass">
---Backtrace---
/usr/lib/ruby/1.8/xmlrpc/utils.rb:166:in `parse_content_type'
/usr/lib/ruby/1.8/xmlrpc/client.rb:538:in `do_rpc'
/usr/lib/ruby/1.8/xmlrpc/client.rb:409:in `call2'
/usr/lib/ruby/1.8/xmlrpc/client.rb:399:in `call'


This call to 'split' should be protected with begin/rescue blocks, so that it raises the correct kind of exception, or the parent call should do so.

This time the problem occurred because I have an xmlrpc method that does not have a return value, so I wasn't returning anything, which resulted in nil content, which threw everything off.  Having the XMLRPC method return "" fixed the bug, but it seems like error handling for this case should be better.

Thanks,
Luke

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2727&group_id=426