summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.test/src/org/eclipse
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-12-07 10:23:38 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2017-12-07 20:02:59 +0900
commit171f84a04117cfd02446f67565073a05128777a4 (patch)
treede60805128113634bc7d92cce426db59a0a96b52 /org.eclipse.jgit.lfs.test/src/org/eclipse
parent5f94e4430800f6e1352733a3ff684e959341984d (diff)
downloadjgit-171f84a04117cfd02446f67565073a05128777a4.tar.gz
jgit-171f84a04117cfd02446f67565073a05128777a4.zip
Use constants from StandardCharsets instead of hard-coded strings
Instead of hard-coding the charset strings "US-ASCII", "UTF-8", and "ISO-8859-1", use the corresponding constants from StandardCharsets. UnsupportedEncodingException is not thrown when the StandardCharset constants are used, so remove the now redundant handling. Because the encoding names are no longer hard-coded strings, also remove redundant $NON-NLS warning suppressions. Also replace existing usages of the constants with static imports. Change-Id: I0a4510d3d992db5e277f009a41434276f95bda4e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.test/src/org/eclipse')
-rw-r--r--org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java b/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java
index 6c6400f293..c3c3859467 100644
--- a/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java
+++ b/org.eclipse.jgit.lfs.test/src/org/eclipse/jgit/lfs/test/LongObjectIdTestUtils.java
@@ -42,11 +42,12 @@
*/
package org.eclipse.jgit.lfs.test;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
@@ -65,7 +66,7 @@ public class LongObjectIdTestUtils {
*/
public static LongObjectId hash(String s) {
MessageDigest md = Constants.newMessageDigest();
- md.update(s.getBytes(StandardCharsets.UTF_8));
+ md.update(s.getBytes(UTF_8));
return LongObjectId.fromRaw(md.digest());
}