1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Provide a better error if the parsed REXML document has no root [#3803 state:resolved]

This commit is contained in:
wycats 2010-03-28 23:21:19 -07:00
parent 41e7c68d87
commit 48c1d8c341

View file

@ -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