summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.lfs.server/src')
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java48
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java2
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java8
3 files changed, 8 insertions, 50 deletions
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 6968d75636..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;
@@ -112,48 +112,6 @@ public abstract class LfsProtocolServlet extends HttpServlet {
* the request
* @param path
* the path
- * @return the large file repository storing large files.
- * @throws org.eclipse.jgit.lfs.errors.LfsException
- * implementations should throw more specific exceptions to
- * signal which type of error occurred:
- * <dl>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsValidationError}</dt>
- * <dd>when there is a validation error with one or more of the
- * objects in the request</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsRepositoryNotFound}</dt>
- * <dd>when the repository does not exist for the user</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsRepositoryReadOnly}</dt>
- * <dd>when the user has read, but not write access. Only
- * applicable when the operation in the request is "upload"</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsRateLimitExceeded}</dt>
- * <dd>when the user has hit a rate limit with the server</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsBandwidthLimitExceeded}</dt>
- * <dd>when the bandwidth limit for the user or repository has
- * been exceeded</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsInsufficientStorage}</dt>
- * <dd>when there is insufficient storage on the server</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsUnavailable}</dt>
- * <dd>when LFS is not available</dd>
- * <dt>{@link org.eclipse.jgit.lfs.errors.LfsException}</dt>
- * <dd>when an unexpected internal server error occurred</dd>
- * </dl>
- * @since 4.5
- * @deprecated use
- * {@link #getLargeFileRepository(LfsRequest, String, String)}
- */
- @Deprecated
- protected LargeFileRepository getLargeFileRepository(LfsRequest request,
- String path) throws LfsException {
- return getLargeFileRepository(request, path, null);
- }
-
- /**
- * Get the large file repository for the given request and path.
- *
- * @param request
- * the request
- * @param path
- * the path
* @param auth
* the Authorization HTTP header
* @return the large file repository storing large files.
@@ -244,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/fs/FileLfsRepository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
index 688aef2af7..55d9093241 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
@@ -170,7 +170,7 @@ public class FileLfsRepository implements LargeFileRepository {
private static final char[] hexchar = { '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- private static void formatHexChar(final char[] dst, final int p, int b) {
+ private static void formatHexChar(char[] dst, int p, int b) {
int o = p + 1;
while (o >= p && b != 0) {
dst[o--] = hexchar[b & 0xf];
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);
}