diff options
author | wycats <wycats@gmail.com> | 2010-03-28 23:21:19 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-28 23:21:35 -0700 |
commit | 48c1d8c341e1fe09111424131f7d223ad032b7e1 (patch) | |
tree | b6ab6d861371be2337fe0741670a380015934d57 /activesupport/lib/active_support/xml_mini/rexml.rb | |
parent | 41e7c68d87903d0596228b6c1ae2c5d87b209280 (diff) | |
download | rails-48c1d8c341e1fe09111424131f7d223ad032b7e1.tar.gz rails-48c1d8c341e1fe09111424131f7d223ad032b7e1.tar.bz2 rails-48c1d8c341e1fe09111424131f7d223ad032b7e1.zip |
Provide a better error if the parsed REXML document has no root [#3803 state:resolved]
Diffstat (limited to 'activesupport/lib/active_support/xml_mini/rexml.rb')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/rexml.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/xml_mini/rexml.rb b/activesupport/lib/active_support/xml_mini/rexml.rb index 3db48ce5a3..863d66a91d 100644 --- a/activesupport/lib/active_support/xml_mini/rexml.rb +++ b/activesupport/lib/active_support/xml_mini/rexml.rb @@ -27,7 +27,13 @@ module ActiveSupport data.ungetc(char) silence_warnings { require 'rexml/document' } unless defined?(REXML::Document) doc = REXML::Document.new(data) - merge_element!({}, doc.root) + + if doc.root + merge_element!({}, doc.root) + else + raise REXML::ParseException, + "The document #{doc.to_s.inspect} does not have a valid root" + end end end |