Utilize StandardCharsets

Closes gh-10972
This commit is contained in:
Johnny Lim
2017-11-10 05:43:06 +09:00
committed by Stephane Nicoll
parent e9c81bf702
commit bd0dcfb172
30 changed files with 77 additions and 85 deletions

View File

@@ -18,7 +18,7 @@ package org.springframework.boot.cli.command.init;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.json.JSONException;
import org.json.JSONObject;
@@ -31,7 +31,7 @@ import org.springframework.util.StreamUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link InitializrServiceMetadata}
* Tests for {@link InitializrServiceMetadata}.
*
* @author Stephane Nicoll
*/
@@ -94,7 +94,7 @@ public class InitializrServiceMetadataTests {
"metadata/service-metadata-" + version + ".json");
try (InputStream stream = resource.getInputStream()) {
return new JSONObject(
StreamUtils.copyToString(stream, Charset.forName("UTF-8")));
StreamUtils.copyToString(stream, StandardCharsets.UTF_8));
}
}

View File

@@ -19,7 +19,7 @@ package org.springframework.boot.cli.command.init;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Map;
@@ -36,7 +36,7 @@ import org.springframework.util.StreamUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ProjectGenerationRequest}
* Tests for {@link ProjectGenerationRequest}.
*
* @author Stephane Nicoll
* @author Eddú Meléndez
@@ -253,7 +253,7 @@ public class ProjectGenerationRequestTests {
Resource resource = new ClassPathResource(
"metadata/service-metadata-" + version + ".json");
String content = StreamUtils.copyToString(resource.getInputStream(),
Charset.forName("UTF-8"));
StandardCharsets.UTF_8);
JSONObject json = new JSONObject(content);
return new InitializrServiceMetadata(json);
}