From 15bff8f9111306812acc992b953d03aebea0af71 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 24 Mar 2017 11:07:01 +0100 Subject: [PATCH] HeaderValueHolder.toString() exposes underlying list of header values Issue: SPR-15375 --- .../org/springframework/mock/web/HeaderValueHolder.java | 9 +++++++-- .../springframework/mock/web/test/HeaderValueHolder.java | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/mock/web/HeaderValueHolder.java b/spring-test/src/main/java/org/springframework/mock/web/HeaderValueHolder.java index d26f7a1364a..9ef95c60b04 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/HeaderValueHolder.java +++ b/spring-test/src/main/java/org/springframework/mock/web/HeaderValueHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,12 @@ class HeaderValueHolder { } public String getStringValue() { - return (!this.values.isEmpty() ? this.values.get(0).toString() : null); + return (!this.values.isEmpty() ? String.valueOf(this.values.get(0)) : null); + } + + @Override + public String toString() { + return this.values.toString(); } diff --git a/spring-web/src/test/java/org/springframework/mock/web/test/HeaderValueHolder.java b/spring-web/src/test/java/org/springframework/mock/web/test/HeaderValueHolder.java index 71d1cc339e5..1ab85f56f1f 100644 --- a/spring-web/src/test/java/org/springframework/mock/web/test/HeaderValueHolder.java +++ b/spring-web/src/test/java/org/springframework/mock/web/test/HeaderValueHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,12 @@ class HeaderValueHolder { } public String getStringValue() { - return (!this.values.isEmpty() ? this.values.get(0).toString() : null); + return (!this.values.isEmpty() ? String.valueOf(this.values.get(0)) : null); + } + + @Override + public String toString() { + return this.values.toString(); }