diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-08 09:44:01 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-03-11 22:46:52 +0100 |
commit | f07b60239c3e3bca7c75705c678dd32a12047e09 (patch) | |
tree | cb8e5e3f5b494852a334551ee03d22b5d3377988 /org.eclipse.jgit.lfs.server | |
parent | 62bc48df60bc852f4f93a721b1599232133ad289 (diff) | |
download | jgit-f07b60239c3e3bca7c75705c678dd32a12047e09.tar.gz jgit-f07b60239c3e3bca7c75705c678dd32a12047e09.zip |
Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8
Change-Id: I6714fc3666e1bced22abba94ceb700477349586e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server')
3 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF index 690abb27e7..28b123165e 100644 --- a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF @@ -31,6 +31,7 @@ Import-Package: com.google.gson;version="[2.8.0,3.0.0)", org.eclipse.jgit.lfs.errors;version="[5.0.0,5.1.0)", org.eclipse.jgit.lfs.internal;version="[5.0.0,5.1.0)", org.eclipse.jgit.lfs.lib;version="[5.0.0,5.1.0)", + org.eclipse.jgit.lib;version="[5.0.0,5.1.0)", org.eclipse.jgit.nls;version="[5.0.0,5.1.0)", org.eclipse.jgit.transport.http;version="[5.0.0,5.1.0)", org.eclipse.jgit.transport.http.apache;version="[5.0.0,5.1.0)", diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java index c7f55dd3c1..d22d45967e 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java @@ -42,7 +42,7 @@ */ package org.eclipse.jgit.lfs.server; -import static java.nio.charset.StandardCharsets.UTF_8; +import static org.eclipse.jgit.lib.Constants.CHARSET; import static org.apache.http.HttpStatus.SC_FORBIDDEN; import static org.apache.http.HttpStatus.SC_INSUFFICIENT_STORAGE; import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR; @@ -202,10 +202,10 @@ public abstract class LfsProtocolServlet extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Writer w = new BufferedWriter( - new OutputStreamWriter(res.getOutputStream(), UTF_8)); + new OutputStreamWriter(res.getOutputStream(), CHARSET)); Reader r = new BufferedReader( - new InputStreamReader(req.getInputStream(), UTF_8)); + new InputStreamReader(req.getInputStream(), CHARSET)); LfsRequest request = LfsGson.fromJson(r, LfsRequest.class); String path = req.getPathInfo(); diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java index b21c94e4e6..374a560581 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java @@ -43,7 +43,7 @@ */ package org.eclipse.jgit.lfs.server.s3; -import static java.nio.charset.StandardCharsets.UTF_8; +import static org.eclipse.jgit.lib.Constants.CHARSET; import static org.eclipse.jgit.util.HttpSupport.HDR_AUTHORIZATION; import java.io.UnsupportedEncodingException; @@ -359,13 +359,13 @@ class SignerV4 { private static byte[] hash(String s) { MessageDigest md = Constants.newMessageDigest(); - md.update(s.getBytes(UTF_8)); + md.update(s.getBytes(CHARSET)); return md.digest(); } private static byte[] sign(String stringData, byte[] key) { try { - byte[] data = stringData.getBytes(UTF_8); + byte[] data = stringData.getBytes(CHARSET); Mac mac = Mac.getInstance(HMACSHA256); mac.init(new SecretKeySpec(key, HMACSHA256)); return mac.doFinal(data); @@ -395,7 +395,7 @@ class SignerV4 { private static String urlEncode(String url, boolean keepPathSlash) { String encoded; try { - encoded = URLEncoder.encode(url, UTF_8.name()); + encoded = URLEncoder.encode(url, CHARSET.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(LfsServerText.get().unsupportedUtf8, e); } |