aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java4
15 files changed, 43 insertions, 33 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index a0fc57ca1f..f6ec4b90eb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -635,7 +635,7 @@ public class AmazonS3 {
try {
final Mac m = Mac.getInstance(HMAC);
m.init(privateKey);
- sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes(CHARSET)));
+ sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes(UTF_8)));
} catch (NoSuchAlgorithmException e) {
throw new IOException(MessageFormat.format(JGitText.get().noHMACsupport, HMAC, e.getMessage()));
} catch (InvalidKeyException e) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
index 449f529447..4b20f6c8b0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
@@ -47,6 +47,8 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -66,7 +68,6 @@ import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.PackLock;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdRef;
@@ -173,7 +174,7 @@ class BundleFetchConnection extends BaseFetchConnection {
IO.skipFully(bin, 1);
done = true;
}
- line.append(RawParseUtils.decode(Constants.CHARSET, hdrbuf, 0, lf));
+ line.append(RawParseUtils.decode(UTF_8, hdrbuf, 0, lf));
}
return line.toString();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
index f2a261bbe6..56aaede80d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -231,7 +233,7 @@ public class BundleWriter {
packWriter.setTagTargets(tagTargets);
packWriter.preparePack(monitor, inc, exc);
- final Writer w = new OutputStreamWriter(os, Constants.CHARSET);
+ final Writer w = new OutputStreamWriter(os, UTF_8);
w.write(TransportBundle.V2_BUNDLE_SIGNATURE);
w.write('\n');
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
index 1415334c63..6c26b7026a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.File;
import java.security.InvalidKeyException;
@@ -102,7 +102,7 @@ public class HMACSHA1NonceGenerator implements NonceGenerator {
}
String input = path + ":" + String.valueOf(timestamp); //$NON-NLS-1$
- byte[] rawHmac = mac.doFinal(input.getBytes(CHARSET));
+ byte[] rawHmac = mac.doFinal(input.getBytes(UTF_8));
return Long.toString(timestamp) + "-" + toHex(rawHmac); //$NON-NLS-1$
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
index fb03190b02..69745eb310 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.util.HttpSupport.HDR_AUTHORIZATION;
import static org.eclipse.jgit.util.HttpSupport.HDR_WWW_AUTHENTICATE;
@@ -315,7 +315,7 @@ abstract class HttpAuthMethod {
@Override
void configureRequest(HttpConnection conn) throws IOException {
String ident = user + ":" + pass; //$NON-NLS-1$
- String enc = Base64.encodeBytes(ident.getBytes(CHARSET));
+ String enc = Base64.encodeBytes(ident.getBytes(UTF_8));
conn.setRequestProperty(HDR_AUTHORIZATION, type.getSchemeName()
+ " " + enc); //$NON-NLS-1$
}
@@ -430,15 +430,15 @@ abstract class HttpAuthMethod {
private static String H(String data) {
MessageDigest md = newMD5();
- md.update(data.getBytes(CHARSET));
+ md.update(data.getBytes(UTF_8));
return LHEX(md.digest());
}
private static String KD(String secret, String data) {
MessageDigest md = newMD5();
- md.update(secret.getBytes(CHARSET));
+ md.update(secret.getBytes(UTF_8));
md.update((byte) ':');
- md.update(data.getBytes(CHARSET));
+ md.update(data.getBytes(UTF_8));
return LHEX(md.digest());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
index cc556f8af6..c6e19d5762 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
@@ -45,13 +45,14 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.MutableObjectId;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils;
@@ -186,7 +187,7 @@ public class PacketLineIn {
if (raw[len - 1] == '\n')
len--;
- String s = RawParseUtils.decode(Constants.CHARSET, raw, 0, len);
+ String s = RawParseUtils.decode(UTF_8, raw, 0, len);
log.debug("git< " + s); //$NON-NLS-1$
return s;
}
@@ -218,7 +219,7 @@ public class PacketLineIn {
IO.readFully(in, raw, 0, len);
- String s = RawParseUtils.decode(Constants.CHARSET, raw, 0, len);
+ String s = RawParseUtils.decode(UTF_8, raw, 0, len);
log.debug("git< " + s); //$NON-NLS-1$
return s;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java
index a26d1d77d6..e9400919a8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineOut.java
@@ -45,6 +45,8 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
import java.io.OutputStream;
@@ -141,7 +143,7 @@ public class PacketLineOut {
out.write(lenbuffer, 0, 4);
out.write(buf, pos, len);
if (log.isDebugEnabled()) {
- String s = RawParseUtils.decode(Constants.CHARSET, buf, pos, len);
+ String s = RawParseUtils.decode(UTF_8, buf, pos, len);
log.debug("git> " + s); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
index 2364434b0f..41af8078c8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProgressSpinner.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.IOException;
import java.io.OutputStream;
@@ -141,7 +141,7 @@ public class ProgressSpinner {
private void write(String s) {
if (write) {
try {
- out.write(s.getBytes(CHARSET));
+ out.write(s.getBytes(UTF_8));
out.flush();
} catch (IOException e) {
write = false;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
index 178c80d22e..f9fddbe889 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateIdent.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.util.RawParseUtils.lastIndexOfTrim;
import java.text.SimpleDateFormat;
@@ -95,7 +95,7 @@ public class PushCertificateIdent {
*/
public static PushCertificateIdent parse(String str) {
MutableInteger p = new MutableInteger();
- byte[] raw = str.getBytes(CHARSET);
+ byte[] raw = str.getBytes(UTF_8);
int tzBegin = raw.length - 1;
tzBegin = lastIndexOfTrim(raw, ' ', tzBegin);
if (tzBegin < 0 || raw[tzBegin] != ' ') {
@@ -129,7 +129,7 @@ public class PushCertificateIdent {
idEnd = raw.length;
}
}
- String id = new String(raw, 0, idEnd, CHARSET);
+ String id = new String(raw, 0, idEnd, UTF_8);
return new PushCertificateIdent(str, id, when * 1000L, tz);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
index 7f5a3408e3..aeca63500a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT;
import static org.eclipse.jgit.lib.FileMode.TYPE_FILE;
@@ -292,7 +292,8 @@ public class PushCertificateStore implements AutoCloseable {
ObjectLoader loader =
tw.getObjectReader().open(tw.getObjectId(0), OBJ_BLOB);
try (InputStream in = loader.openStream();
- Reader r = new BufferedReader(new InputStreamReader(in, CHARSET))) {
+ Reader r = new BufferedReader(
+ new InputStreamReader(in, UTF_8))) {
return PushCertificateParser.fromReader(r);
}
}
@@ -473,7 +474,7 @@ public class PushCertificateStore implements AutoCloseable {
DirCacheEditor editor = dc.editor();
String certText = pc.cert.toText() + pc.cert.getSignature();
- final ObjectId certId = inserter.insert(OBJ_BLOB, certText.getBytes(CHARSET));
+ final ObjectId certId = inserter.insert(OBJ_BLOB, certText.getBytes(UTF_8));
boolean any = false;
for (ReceiveCommand cmd : pc.cert.getCommands()) {
if (byRef != null && !commandsEqual(cmd, byRef.get(cmd.getRefName()))) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
index dc1871b729..4662435ea7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SYMREF;
@@ -74,7 +74,7 @@ import org.eclipse.jgit.lib.Repository;
public abstract class RefAdvertiser {
/** Advertiser which frames lines in a {@link PacketLineOut} format. */
public static class PacketLineOutRefAdvertiser extends RefAdvertiser {
- private final CharsetEncoder utf8 = CHARSET.newEncoder();
+ private final CharsetEncoder utf8 = UTF_8.newEncoder();
private final PacketLineOut pckOut;
private byte[] binArr = new byte[256];
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
index 3100cb444a..90600cbb98 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.transport.SideBandOutputStream.HDR_SIZE;
import java.io.IOException;
@@ -57,7 +58,6 @@ import java.util.regex.Pattern;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils;
@@ -257,6 +257,6 @@ public class SideBandInputStream extends InputStream {
private String readString(int len) throws IOException {
final byte[] raw = new byte[len];
IO.readFully(rawIn, raw, 0, len);
- return RawParseUtils.decode(Constants.CHARSET, raw, 0, len);
+ return RawParseUtils.decode(UTF_8, raw, 0, len);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
index d342ef46df..621c2ea56c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
@@ -46,7 +46,7 @@
package org.eclipse.jgit.transport;
-import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.BufferedReader;
import java.io.IOException;
@@ -144,7 +144,7 @@ public abstract class Transport implements AutoCloseable {
private static void scan(ClassLoader ldr, URL url) {
try (BufferedReader br = new BufferedReader(
- new InputStreamReader(url.openStream(), CHARSET))) {
+ new InputStreamReader(url.openStream(), UTF_8))) {
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index ee64a87f76..8b41ab0466 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -46,6 +46,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.Constants.HEAD;
import static org.eclipse.jgit.util.HttpSupport.ENCODING_GZIP;
import static org.eclipse.jgit.util.HttpSupport.ENCODING_X_GZIP;
@@ -426,7 +427,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
}
private BufferedReader toBufferedReader(InputStream in) {
- return new BufferedReader(new InputStreamReader(in, Constants.CHARSET));
+ return new BufferedReader(new InputStreamReader(in, UTF_8));
}
/** {@inheritDoc} */
@@ -952,7 +953,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
// Line oriented readable content is likely to compress well.
// Request gzip encoding.
InputStream is = open(path, AcceptEncoding.GZIP).in;
- return new BufferedReader(new InputStreamReader(is, Constants.CHARSET));
+ return new BufferedReader(new InputStreamReader(is, UTF_8));
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java
index aa71c9445a..6d4df4fbad 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
@@ -363,7 +365,7 @@ abstract class WalkRemoteObjectDatabase {
*/
BufferedReader openReader(String path) throws IOException {
final InputStream is = open(path).in;
- return new BufferedReader(new InputStreamReader(is, Constants.CHARSET));
+ return new BufferedReader(new InputStreamReader(is, UTF_8));
}
/**