Files
openide/java/java-tests/testData/inspection/charsetObjectCanBeUsed/afterCharsetTryWithResources.java
Tagir Valeev a9a07c536f CharsetObjectCanBeUsedInspection: take into account exceptions thrown by resource list
Fixes IDEA-202559 "Replace with StandardCharsets.UTF_8" produces uncompilable source
2018-11-21 15:26:00 +07:00

14 lines
343 B
Java

// "Replace with 'StandardCharsets.UTF_8'" "true"
import java.io.*;
import java.nio.charset.StandardCharsets;
class Test {
void test(String inputFile) {
try (InputStream inputStream = new FileInputStream(inputFile)) {
new InputStreamReader(inputStream, StandardCharsets.UTF_8);
}
catch (IOException ignored) {
}
}
}