Skip to content

Commit bad40b6

Browse files
committed
Replace Charset.defaultCharset() with StandardCharsets.UTF_8
Replace Charset.defaultCharset() with StandardCharsets.UTF_8
1 parent 5bccfed commit bad40b6

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/file/builder/FlatFileItemWriterBuilderTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2022 the original author or authors.
2+
* Copyright 2016-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
1919
import java.io.File;
2020
import java.io.IOException;
2121
import java.io.InputStreamReader;
22-
import java.nio.charset.Charset;
22+
import java.nio.charset.StandardCharsets;
2323

2424
import org.junit.jupiter.api.Test;
2525

@@ -266,7 +266,7 @@ void testFlags() throws Exception {
266266

267267
WritableResource output = new FileSystemResource(File.createTempFile("foo", "txt"));
268268

269-
String encoding = Charset.defaultCharset().name();
269+
String encoding = StandardCharsets.UTF_8.name();
270270

271271
FlatFileItemWriter<Foo> writer = new FlatFileItemWriterBuilder<Foo>().name("foo")
272272
.resource(output)

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/json/JsonFileItemWriterFunctionalTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.File;
2020
import java.io.IOException;
2121
import java.math.BigDecimal;
22-
import java.nio.charset.Charset;
2322
import java.nio.file.Files;
2423
import java.nio.file.Path;
2524
import java.nio.file.Paths;
@@ -334,7 +333,7 @@ private void assertFileEquals(File expected, File actual) throws Exception {
334333
}
335334

336335
private String getContent(File file) throws IOException {
337-
return Files.readString(file.toPath(), Charset.defaultCharset());
336+
return Files.readString(file.toPath());
338337
}
339338

340339
}

spring-batch-infrastructure/src/test/java/org/springframework/batch/item/json/builder/JsonFileItemWriterBuilderTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2022 the original author or authors.
2+
* Copyright 2018-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
package org.springframework.batch.item.json.builder;
1818

1919
import java.io.File;
20-
import java.nio.charset.Charset;
20+
import java.nio.charset.StandardCharsets;
2121
import java.nio.file.Files;
2222

2323
import org.junit.jupiter.api.BeforeEach;
@@ -112,7 +112,7 @@ void testJsonFileItemWriterCreationDefaultEncoding() {
112112
boolean transactional = true;
113113
boolean shouldDeleteIfEmpty = true;
114114
boolean shouldDeleteIfExists = true;
115-
String encoding = Charset.defaultCharset().name();
115+
String encoding = StandardCharsets.UTF_8.name();
116116
String lineSeparator = "#";
117117
FlatFileHeaderCallback headerCallback = Mockito.mock(FlatFileHeaderCallback.class);
118118
FlatFileFooterCallback footerCallback = Mockito.mock(FlatFileFooterCallback.class);

0 commit comments

Comments
 (0)