You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2022/06/20 01:53:14 UTC
[commons-configuration] branch master updated: Use charset predefined StandardCharsets.UTF_8 code.
This is an automated email from the ASF dual-hosted git repository.
mattjuntunen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
The following commit(s) were added to refs/heads/master by this push:
new 4f9a451f Use charset predefined StandardCharsets.UTF_8 code.
4f9a451f is described below
commit 4f9a451f2a43b0481903d0d0bb2088d711c63252
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Jun 19 21:00:55 2022 +0200
Use charset predefined StandardCharsets.UTF_8 code.
---
src/main/java/org/apache/commons/configuration2/io/FileUtils.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/configuration2/io/FileUtils.java b/src/main/java/org/apache/commons/configuration2/io/FileUtils.java
index c39f6114..1803ebad 100644
--- a/src/main/java/org/apache/commons/configuration2/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/configuration2/io/FileUtils.java
@@ -20,6 +20,7 @@ import java.io.File;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
/**
* This class is a subset of org.apache.commons.io.FileUtils, git-svn-id:
@@ -32,7 +33,7 @@ class FileUtils {
/**
* The UTF-8 character set, used to decode octets in URLs.
*/
- private static final Charset UTF8 = Charset.forName("UTF-8");
+ private static final Charset UTF8 = StandardCharsets.UTF_8;
/**
* Convert from a {@code URL} to a {@code File}.
@@ -85,7 +86,7 @@ class FileUtils {
} finally {
if (bytes.position() > 0) {
bytes.flip();
- buffer.append(UTF8.decode(bytes).toString());
+ buffer.append(UTF8.decode(bytes));
bytes.clear();
}
}