Cleaned up more PMD/Codacy warnings

This commit is contained in:
Jeroen van Erp
2017-01-23 10:46:01 +01:00
parent c883c87963
commit 8134113510
10 changed files with 54 additions and 56 deletions

View File

@@ -32,7 +32,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
/** {@link UserAuth} implementation. */
/**
* {@link UserAuth} implementation.
*/
public class UserAuthImpl
extends AbstractService
implements UserAuth {
@@ -111,22 +113,20 @@ public class UserAuthImpl
try {
switch (msg) {
case USERAUTH_BANNER: {
case USERAUTH_BANNER:
banner = buf.readString();
}
break;
break;
case USERAUTH_SUCCESS: {
case USERAUTH_SUCCESS:
// In order to prevent race conditions, we immediately set the authenticated flag on the transport
// And change the service before delivering the authenticated promise.
// Should fix https://github.com/hierynomus/sshj/issues/237
trans.setAuthenticated(); // So it can put delayed compression into force if applicable
trans.setService(nextService); // We aren't in charge anymore, next service is
authenticated.deliver(true);
}
break;
break;
case USERAUTH_FAILURE: {
case USERAUTH_FAILURE:
allowedMethods = Arrays.asList(buf.readString().split(","));
partialSuccess |= buf.readBoolean();
if (allowedMethods.contains(currentMethod.getName()) && currentMethod.shouldRetry()) {
@@ -134,18 +134,16 @@ public class UserAuthImpl
} else {
authenticated.deliver(false);
}
}
break;
break;
default: {
default:
log.debug("Asking `{}` method to handle {} packet", currentMethod.getName(), msg);
try {
currentMethod.handle(msg, buf);
} catch (UserAuthException e) {
authenticated.deliverError(e);
}
}
break;
}
} finally {
authenticated.unlock();