Fixed some Java7 warnings

This commit is contained in:
Jeroen van Erp
2016-03-21 10:15:47 +01:00
parent eb8b7b51ca
commit 8e55e50fd9

View File

@@ -221,7 +221,7 @@ public class SSHClient
public void auth(String username, Iterable<AuthMethod> methods) public void auth(String username, Iterable<AuthMethod> methods)
throws UserAuthException, TransportException { throws UserAuthException, TransportException {
checkConnected(); checkConnected();
final Deque<UserAuthException> savedEx = new LinkedList<UserAuthException>(); final Deque<UserAuthException> savedEx = new LinkedList<>();
for (AuthMethod method: methods) { for (AuthMethod method: methods) {
try { try {
if (auth.authenticate(username, (Service) conn, method, trans.getTimeoutMs())) if (auth.authenticate(username, (Service) conn, method, trans.getTimeoutMs()))
@@ -342,7 +342,7 @@ public class SSHClient
*/ */
public void authPublickey(String username, Iterable<KeyProvider> keyProviders) public void authPublickey(String username, Iterable<KeyProvider> keyProviders)
throws UserAuthException, TransportException { throws UserAuthException, TransportException {
final List<AuthMethod> am = new LinkedList<AuthMethod>(); final List<AuthMethod> am = new LinkedList<>();
for (KeyProvider kp : keyProviders) for (KeyProvider kp : keyProviders)
am.add(new AuthPublickey(kp)); am.add(new AuthPublickey(kp));
auth(username, am); auth(username, am);
@@ -385,7 +385,7 @@ public class SSHClient
*/ */
public void authPublickey(String username, String... locations) public void authPublickey(String username, String... locations)
throws UserAuthException, TransportException { throws UserAuthException, TransportException {
final List<KeyProvider> keyProviders = new LinkedList<KeyProvider>(); final List<KeyProvider> keyProviders = new LinkedList<>();
for (String loc : locations) { for (String loc : locations) {
try { try {
log.debug("Attempting to load key from: {}", loc); log.debug("Attempting to load key from: {}", loc);
@@ -415,7 +415,7 @@ public class SSHClient
public void authGssApiWithMic(String username, LoginContext context, Oid supportedOid, Oid... supportedOids) public void authGssApiWithMic(String username, LoginContext context, Oid supportedOid, Oid... supportedOids)
throws UserAuthException, TransportException { throws UserAuthException, TransportException {
// insert supportedOid to the front of the list since ordering matters // insert supportedOid to the front of the list since ordering matters
List<Oid> oids = new ArrayList<Oid>(Arrays.asList(supportedOids)); List<Oid> oids = new ArrayList<>(Arrays.asList(supportedOids));
oids.add(0, supportedOid); oids.add(0, supportedOid);
auth(username, new AuthGssApiWithMic(context, oids)); auth(username, new AuthGssApiWithMic(context, oids));