Skip to content

Commit

Permalink
Changed implementation of clone method in SettingExt, previous was sh…
Browse files Browse the repository at this point in the history
…allow copy now it's deep
  • Loading branch information
andsel committed Jan 12, 2021
1 parent 280a95c commit 68feccc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions logstash-core/src/main/java/org/logstash/settings/SettingExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@JRubyClass(name = "Setting")
public class SettingExt extends RubyObject {

private static final long serialVersionUID = 1L;
private static final long serialVersionUID = -4283509226931417677L;

private ProxyJavaSetting setting;

Expand Down Expand Up @@ -309,9 +309,16 @@ public IRubyObject setDefault(ThreadContext context, IRubyObject rubyDefaultValu

@JRubyMethod(name = "clone")
public IRubyObject rubyClone(ThreadContext context) {
final SettingExt settingExt = new SettingExt(context.runtime, RubyUtil.SETTING_CLASS);
settingExt.setting = new ProxyJavaSetting(setting);
return settingExt;
// this doesn't work
// final SettingExt settingExt = new SettingExt(context.runtime, RubyUtil.SETTING_CLASS);
// settingExt.setting = new ProxyJavaSetting(setting);
// return settingExt;
// this works
try {
return (IRubyObject) this.clone();
} catch (CloneNotSupportedException ex) {
throw new RuntimeException(ex);
}
}

@JRubyMethod(name = "klass")
Expand Down

0 comments on commit 68feccc

Please sign in to comment.