Consistent use of Charset.forName over JDK 7 StandardCharsets in 4.x line

This commit is contained in:
Juergen Hoeller
2016-08-26 13:11:39 +02:00
parent 696f687419
commit 2a82b8fed9
5 changed files with 50 additions and 51 deletions

View File

@@ -20,7 +20,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.Principal;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -539,7 +538,7 @@ public class SendToMethodReturnValueHandlerTests {
Message<?> message = this.messageCaptor.getValue();
assertNotNull(message);
String bytes = new String((byte[]) message.getPayload(), StandardCharsets.UTF_8);
String bytes = new String((byte[]) message.getPayload(), Charset.forName("UTF-8"));
assertEquals("{\"withView1\":\"with\"}", bytes);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -18,7 +18,6 @@ package org.springframework.messaging.simp.annotation.support;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.Principal;
import com.fasterxml.jackson.annotation.JsonView;
@@ -179,7 +178,7 @@ public class SubscriptionMethodReturnValueHandlerTests {
Message<?> message = this.messageCaptor.getValue();
assertNotNull(message);
assertEquals("{\"withView1\":\"with\"}", new String((byte[]) message.getPayload(), StandardCharsets.UTF_8));
assertEquals("{\"withView1\":\"with\"}", new String((byte[]) message.getPayload(), Charset.forName("UTF-8")));
}