Add exceptions for remaing cases where XML::Parser.string is used, to catch for empty strings.
See also r14241
This commit is contained in:
parent
9c0f288bb7
commit
6442208841
3 changed files with 8 additions and 2 deletions
|
@ -114,6 +114,8 @@ class ChangesetController < ApplicationController
|
|||
render :nothing => true, :status => :method_not_allowed
|
||||
end
|
||||
|
||||
rescue LibXML::XML::Error, ArgumentError => ex
|
||||
raise OSM::APIBadXMLError.new("osm", xml, ex.message)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
rescue OSM::APIError => ex
|
||||
|
|
|
@ -52,7 +52,11 @@ class UserPreferenceController < ApplicationController
|
|||
|
||||
# update the entire set of preferences
|
||||
def update
|
||||
p = XML::Parser.string(request.raw_post)
|
||||
do
|
||||
p = XML::Parser.string(request.raw_post)
|
||||
rescue LibXML::XML::Error, ArgumentError => ex
|
||||
raise OSM::APIBadXMLError.new("preferences", xml, ex.message)
|
||||
end
|
||||
doc = p.parse
|
||||
|
||||
prefs = []
|
||||
|
|
|
@ -70,7 +70,7 @@ class Node < ActiveRecord::Base
|
|||
doc.find('//osm/node').each do |pt|
|
||||
return Node.from_xml_node(pt, create)
|
||||
end
|
||||
rescue LibXML::XML::Error => ex
|
||||
rescue LibXML::XML::Error, ArgumentError => ex
|
||||
raise OSM::APIBadXMLError.new("node", xml, ex.message)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue