aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.ssh.apache')
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/KnownHostEntryReader.java5
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java9
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java5
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java9
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java8
5 files changed, 18 insertions, 18 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/KnownHostEntryReader.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/KnownHostEntryReader.java
index 4db24a16b7..659ffae004 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/KnownHostEntryReader.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/KnownHostEntryReader.java
@@ -42,13 +42,13 @@
*/
package org.eclipse.jgit.internal.transport.sshd;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.text.MessageFormat.format;
import static org.apache.sshd.client.config.hosts.HostPatternsHolder.NON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIM;
import static org.apache.sshd.client.config.hosts.HostPatternsHolder.NON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIM;
import java.io.BufferedReader;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
@@ -99,8 +99,7 @@ public class KnownHostEntryReader {
public static List<KnownHostEntry> readFromFile(Path path)
throws IOException {
List<KnownHostEntry> result = new LinkedList<>();
- try (BufferedReader r = Files.newBufferedReader(path,
- StandardCharsets.UTF_8)) {
+ try (BufferedReader r = Files.newBufferedReader(path, UTF_8)) {
r.lines().forEachOrdered(l -> {
if (l == null) {
return;
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java
index cfd3d19a73..7d8f3fd39c 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.internal.transport.sshd;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.text.MessageFormat.format;
import java.io.BufferedReader;
@@ -52,7 +53,6 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
@@ -386,7 +386,7 @@ public class OpenSshServerKeyVerifier
try {
try (BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(lock.getOutputStream(),
- StandardCharsets.UTF_8))) {
+ UTF_8))) {
writer.newLine();
writer.write(entry.getConfigLine());
writer.newLine();
@@ -422,10 +422,9 @@ public class OpenSshServerKeyVerifier
if (lock.lock()) {
try {
try (BufferedWriter writer = new BufferedWriter(
- new OutputStreamWriter(lock.getOutputStream(),
- StandardCharsets.UTF_8));
+ new OutputStreamWriter(lock.getOutputStream(), UTF_8));
BufferedReader reader = Files.newBufferedReader(path,
- StandardCharsets.UTF_8)) {
+ UTF_8)) {
boolean done = false;
String line;
while ((line = reader.readLine()) != null) {
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java
index efb1f55867..a257a5ebc8 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/auth/BasicAuthentication.java
@@ -42,13 +42,14 @@
*/
package org.eclipse.jgit.internal.transport.sshd.auth;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.net.Authenticator;
import java.net.Authenticator.RequestorType;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.charset.StandardCharsets;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
@@ -99,7 +100,7 @@ public abstract class BasicAuthentication<ParameterType, TokenType>
if (pass == null) {
return new byte[0];
}
- ByteBuffer bytes = StandardCharsets.UTF_8.encode(CharBuffer.wrap(pass));
+ ByteBuffer bytes = UTF_8.encode(CharBuffer.wrap(pass));
byte[] pwd = new byte[bytes.remaining()];
bytes.get(pwd);
if (bytes.hasArray()) {
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java
index 46cdd52f5f..c66ee38ca2 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpClientConnector.java
@@ -42,12 +42,13 @@
*/
package org.eclipse.jgit.internal.transport.sshd.proxy;
+import static java.nio.charset.StandardCharsets.US_ASCII;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.text.MessageFormat.format;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@@ -164,7 +165,7 @@ public class HttpClientConnector extends AbstractClientProxyConnector {
}
private void send(StringBuilder msg, IoSession session) throws Exception {
- byte[] data = eol(msg).toString().getBytes(StandardCharsets.US_ASCII);
+ byte[] data = eol(msg).toString().getBytes(US_ASCII);
Buffer buffer = new ByteArrayBuffer(data.length, false);
buffer.putRawBytes(data);
session.writePacket(buffer).verify(getTimeout());
@@ -196,7 +197,7 @@ public class HttpClientConnector extends AbstractClientProxyConnector {
int length = buffer.available();
byte[] data = new byte[length];
buffer.getRawBytes(data, 0, length);
- String[] reply = new String(data, StandardCharsets.US_ASCII)
+ String[] reply = new String(data, US_ASCII)
.split("\r\n"); //$NON-NLS-1$
handleMessage(session, Arrays.asList(reply));
} catch (Exception e) {
@@ -348,7 +349,7 @@ public class HttpClientConnector extends AbstractClientProxyConnector {
throw new IOException(format(
SshdText.get().proxyHttpInvalidUserName, proxy, user));
}
- byte[] rawUser = user.getBytes(StandardCharsets.UTF_8);
+ byte[] rawUser = user.getBytes(UTF_8);
byte[] toEncode = new byte[rawUser.length + 1 + password.length];
System.arraycopy(rawUser, 0, toEncode, 0, rawUser.length);
toEncode[rawUser.length] = ':';
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
index 1844fdc794..27d6f418b8 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
@@ -42,12 +42,13 @@
*/
package org.eclipse.jgit.internal.transport.sshd.proxy;
+import static java.nio.charset.StandardCharsets.US_ASCII;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.text.MessageFormat.format;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
-import java.nio.charset.StandardCharsets;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.io.IoSession;
@@ -295,8 +296,7 @@ public class Socks5ClientConnector extends AbstractClientProxyConnector {
byte type;
int length = 0;
if (rawAddress == null) {
- remoteName = remoteAddress.getHostString()
- .getBytes(StandardCharsets.US_ASCII);
+ remoteName = remoteAddress.getHostString().getBytes(US_ASCII);
if (remoteName == null || remoteName.length == 0) {
throw new IOException(
format(SshdText.get().proxySocksNoRemoteHostName,
@@ -542,7 +542,7 @@ public class Socks5ClientConnector extends AbstractClientProxyConnector {
return null;
}
try {
- byte[] rawUser = user.getBytes(StandardCharsets.UTF_8);
+ byte[] rawUser = user.getBytes(UTF_8);
if (rawUser.length > 255) {
throw new IOException(format(
SshdText.get().proxySocksUsernameTooLong, proxy,