Skip to content

Commit 2d8abc1

Browse files
EcljpseB0Tjukzi
authored andcommitted
Replace "UTF8" with StandardCharsets.UTF_8
Avoids NON-NLS and possible UnsupportedEncodingException
1 parent 9fa486f commit 2d8abc1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

debug/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.io.ByteArrayInputStream;
1818
import java.io.ByteArrayOutputStream;
1919
import java.io.IOException;
20-
import java.io.UnsupportedEncodingException;
2120
import java.nio.charset.StandardCharsets;
2221
import java.util.ArrayList;
2322
import java.util.HashMap;
@@ -465,9 +464,8 @@ private Document getDocument() throws ParserConfigurationException {
465464
* @param doc document to serialize
466465
* @return the document as a string
467466
* @throws TransformerException if an unrecoverable error occurs during the serialization
468-
* @throws UnsupportedEncodingException if the encoding attempted to be used is not supported
469467
*/
470-
private String serializeDocument(Document doc) throws TransformerException, UnsupportedEncodingException {
468+
private String serializeDocument(Document doc) throws TransformerException {
471469
ByteArrayOutputStream s= new ByteArrayOutputStream();
472470

473471
@SuppressWarnings("restriction")
@@ -480,7 +478,7 @@ private String serializeDocument(Document doc) throws TransformerException, Unsu
480478
StreamResult outputTarget= new StreamResult(s);
481479
transformer.transform(source, outputTarget);
482480

483-
return s.toString("UTF8"); //$NON-NLS-1$
481+
return s.toString(StandardCharsets.UTF_8);
484482
}
485483

486484
/**

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ private static void modifyInFileSystem(IFile file) throws FileNotFoundException,
492492
String originalContent = readStringInFileSystem(file);
493493
String newContent = originalContent + "f";
494494
try (FileOutputStream outputStream = new FileOutputStream(file.getLocation().toFile())) {
495-
outputStream.write(newContent.getBytes("UTF8"));
495+
outputStream.write(newContent.getBytes(StandardCharsets.UTF_8));
496496
}
497497
}
498498

0 commit comments

Comments
 (0)