]> source.dussan.org Git - jgit.git/commitdiff
Constants: Initialize CHARSET and CHARACTER_ENCODING from StandardCharsets.UTF_8 45/118945/4
authorDavid Pursehouse <david.pursehouse@gmail.com>
Thu, 8 Mar 2018 00:42:02 +0000 (09:42 +0900)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 11 Mar 2018 21:28:30 +0000 (22:28 +0100)
Change-Id: Ib4e0a35429892fa1581db09a9b77717120d03275
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java

index bb85229f82effd0a5d9f48af10f4f56d2d76a326..29189a9d747e73408df7a3f436feaf6c9dc9ff16 100644 (file)
@@ -45,6 +45,8 @@
 
 package org.eclipse.jgit.lib;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 import java.security.MessageDigest;
@@ -226,10 +228,10 @@ public final class Constants {
        public static final byte[] PACK_SIGNATURE = { 'P', 'A', 'C', 'K' };
 
        /** Native character encoding for commit messages, file names... */
-       public static final String CHARACTER_ENCODING = "UTF-8";
+       public static final Charset CHARSET = UTF_8;
 
        /** Native character encoding for commit messages, file names... */
-       public static final Charset CHARSET;
+       public static final String CHARACTER_ENCODING = CHARSET.name();
 
        /** Default main branch name */
        public static final String MASTER = "master";
@@ -652,7 +654,6 @@ public final class Constants {
        static {
                if (OBJECT_ID_LENGTH != newMessageDigest().getDigestLength())
                        throw new LinkageError(JGitText.get().incorrectOBJECT_ID_LENGTH);
-               CHARSET = Charset.forName(CHARACTER_ENCODING);
        }
 
        /** name of the file containing the commit msg for a merge commit */