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 e8f5e91dfb6..ac74d3e42d6 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-2012 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 35731b02c3d..324074e9a65 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-2012 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(); }