From f9c68dbfc0914284ba7a47b8639c4c35e4b5683b Mon Sep 17 00:00:00 2001 From: RaphC Date: Thu, 27 Oct 2016 21:52:02 +0200 Subject: [PATCH 1/3] #3908 make a copy of vendorExtensions map instead of copying the reference --- .../src/main/java/io/swagger/codegen/CodegenParameter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index 98770029381..73b9c1c1ec7 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -122,7 +122,9 @@ public CodegenParameter copy() { if (this.items != null) { output.items = this.items; } - output.vendorExtensions = this.vendorExtensions; + if(this.vendorExtensions != null){ + output.vendorExtensions = new HashMap(this.vendorExtensions); + } output.hasValidation = this.hasValidation; output.isBinary = this.isBinary; output.isByteArray = this.isByteArray; From e817524549d56d479fea96d12aa0a4b20fbfa5d3 Mon Sep 17 00:00:00 2001 From: RaphC Date: Fri, 4 Nov 2016 21:52:33 +0100 Subject: [PATCH 2/3] using 4-space instead of tab. --- .../src/main/java/io/swagger/codegen/CodegenParameter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index 73b9c1c1ec7..c282fb519a2 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -123,7 +123,7 @@ public CodegenParameter copy() { output.items = this.items; } if(this.vendorExtensions != null){ - output.vendorExtensions = new HashMap(this.vendorExtensions); + output.vendorExtensions = new HashMap(this.vendorExtensions); } output.hasValidation = this.hasValidation; output.isBinary = this.isBinary; From 3fe9f6b2afce43e28ce271bf29d44c06f61929c9 Mon Sep 17 00:00:00 2001 From: RaphC Date: Fri, 11 Nov 2016 22:43:08 +0100 Subject: [PATCH 3/3] make a copy of vendorExtensions map instead of copying the reference --- .../io/swagger/codegen/CodegenProperty.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java index b6a4b9d02da..66995f8d118 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java @@ -1,5 +1,7 @@ package io.swagger.codegen; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -283,9 +285,24 @@ public boolean equals(Object obj) { @Override public CodegenProperty clone() { try { - return (CodegenProperty) super.clone(); + CodegenProperty cp = (CodegenProperty) super.clone(); + if (this._enum != null) { + cp._enum = new ArrayList(this._enum); + } + if (this.allowableValues != null) { + cp.allowableValues = new HashMap(this.allowableValues); + } + if (this.items != null) { + cp.items = this.items; + } + if(this.vendorExtensions != null){ + cp.vendorExtensions = new HashMap(this.vendorExtensions); + } + return cp; } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } } + + }