From 1f004c646f27f91a0191fd6ce94c1afcaa8f26a5 Mon Sep 17 00:00:00 2001 From: Armin Date: Thu, 27 Jul 2017 00:09:07 +0200 Subject: [PATCH] MINOR: Remove complicated utility method call from RubyEvent initialize method Fixes #7825 --- .../src/main/java/org/logstash/ext/JrubyEventExtLibrary.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/logstash-core/src/main/java/org/logstash/ext/JrubyEventExtLibrary.java b/logstash-core/src/main/java/org/logstash/ext/JrubyEventExtLibrary.java index 4ddb21e58..d6be98e45 100644 --- a/logstash-core/src/main/java/org/logstash/ext/JrubyEventExtLibrary.java +++ b/logstash-core/src/main/java/org/logstash/ext/JrubyEventExtLibrary.java @@ -15,7 +15,6 @@ import org.jruby.anno.JRubyMethod; import org.jruby.exceptions.RaiseException; import org.jruby.java.proxies.MapJavaProxy; import org.jruby.javasupport.JavaUtil; -import org.jruby.runtime.Arity; import org.jruby.runtime.ObjectAllocator; import org.jruby.runtime.ThreadContext; import org.jruby.runtime.builtin.IRubyObject; @@ -99,8 +98,7 @@ public class JrubyEventExtLibrary implements Library { // def initialize(data = {}) @JRubyMethod(name = "initialize", optional = 1) public IRubyObject ruby_initialize(ThreadContext context, IRubyObject[] args) { - args = Arity.scanArgs(context.runtime, args, 0, 1); - IRubyObject data = args[0]; + final IRubyObject data = args.length > 0 ? args[0] : null; if (data instanceof RubyHash) { this.event = new Event(ConvertedMap.newFromRubyHash((RubyHash) data)); } else {