Merge pull request #1158 from darren-fhf/master

Fix bug LOGSTASH-1225 "Cannot Clone Fixnum"
This commit is contained in:
Jordan Sissel 2014-03-12 15:21:24 -07:00
commit d30a9e5bfc
2 changed files with 17 additions and 1 deletions

View file

@ -85,7 +85,7 @@ class LogStash::Event
copy = {} copy = {}
@data.each do |k,v| @data.each do |k,v|
# TODO(sissel): Recurse if this is a hash/array? # TODO(sissel): Recurse if this is a hash/array?
copy[k] = v.clone copy[k] = begin v.clone rescue v end
end end
return self.class.new(copy) return self.class.new(copy)
end # def clone end # def clone

View file

@ -64,4 +64,20 @@ describe LogStash::Filters::Clone do
end end
end end
describe "Bug LOGSTASH-1225" do
### LOGSTASH-1225: Cannot clone events containing numbers.
config <<-CONFIG
filter {
clone {
clones => [ 'clone1' ]
}
}
CONFIG
sample("type" => "bug-1225", "message" => "unused", "number" => 5) do
insist { subject[0]["number"] } == 5
insist { subject[1]["number"] } == 5
end
end
end end