package org.opendaylight.netconf.topology.singleton.impl;
import static com.google.common.base.Preconditions.checkState;
-import static java.util.Objects.isNull;
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.VisibleForTesting;
NetconfDeviceCommunicator netconfDeviceCommunicator =
userCapabilities.isPresent() ? new NetconfDeviceCommunicator(remoteDeviceId, device,
new UserPreferences(userCapabilities.get(),
- isNull(node.getYangModuleCapabilities())
- ? false : node.getYangModuleCapabilities().isOverride(),
- isNull(node.getNonModuleCapabilities())
- ? false : node.getNonModuleCapabilities().isOverride()), rpcMessageLimit)
+ node.getYangModuleCapabilities() == null ? false : node.getYangModuleCapabilities().isOverride(),
+ node.getNonModuleCapabilities() == null ? false : node.getNonModuleCapabilities().isOverride()),
+ rpcMessageLimit)
: new NetconfDeviceCommunicator(remoteDeviceId, device, rpcMessageLimit);
if (salFacade instanceof KeepaliveSalFacade) {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.netconf.test.tool;
import static com.google.common.base.Preconditions.checkArgument;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.Objects;
import java.util.StringJoiner;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
if (!matcher.matches()) {
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line = reader.readLine();
- while (Objects.nonNull(line) && !REVISION_DATE_PATTERN.matcher(line).find()) {
+ while (line != null && !REVISION_DATE_PATTERN.matcher(line).find()) {
line = reader.readLine();
}
- if (Objects.nonNull(line)) {
+ if (line != null) {
final Matcher m = REVISION_DATE_PATTERN.matcher(line);
Preconditions.checkState(m.find());
String moduleName = file.getAbsolutePath();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.netconf.test.tool;
import java.security.GeneralSecurityException;
import java.security.KeyPairGenerator;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Collections;
-import java.util.Objects;
import org.apache.sshd.common.cipher.ECCurves;
import org.apache.sshd.common.config.keys.KeyUtils;
import org.apache.sshd.common.keyprovider.KeyPairProvider;
* If the key-pair has already been generated, the existing one is used.
*/
public class VirtualKeyPairProvider implements KeyPairProvider {
-
private static final Logger LOG = LoggerFactory.getLogger(VirtualKeyPairProvider.class);
private KeyPair generatedKeyPair;
* @param keySpecification Algorithm-specific settings.
* @param keySize To be generated key length (must be adjusted against selected algorithm).
*/
- @SuppressWarnings({"unused", "WeakerAccess"})
+ @SuppressWarnings("WeakerAccess")
VirtualKeyPairProvider(final String algorithm,
final AlgorithmParameterSpec keySpecification,
final Integer keySize) {
@Override
public synchronized Iterable<KeyPair> loadKeys(final SessionContext session) {
- if (Objects.isNull(generatedKeyPair)) {
+ if (generatedKeyPair == null) {
try {
generatedKeyPair = generateKeyPair();
- } catch (GeneralSecurityException exception) {
+ } catch (GeneralSecurityException e) {
LOG.error("Cannot generate key with algorithm '{}', key specification '{}', and key size '{}'.",
- algorithm, keySpecification, keySize, exception);
- throw new IllegalArgumentException("An error occurred during generation of a new ke pair.", exception);
+ algorithm, keySpecification, keySize, e);
+ throw new IllegalArgumentException("An error occurred during generation of a new ke pair.", e);
}
}
return Collections.singleton(generatedKeyPair);
*/
private KeyPair generateKeyPair() throws GeneralSecurityException {
final KeyPairGenerator generator = SecurityUtils.getKeyPairGenerator(algorithm);
- if (Objects.nonNull(keySpecification)) {
+ if (keySpecification != null) {
generator.initialize(keySpecification);
- } else if (Objects.nonNull(keySize)) {
+ } else if (keySize != null) {
generator.initialize(keySize);
} else if (KeyUtils.EC_ALGORITHM.equals(algorithm)) {
int numCurves = ECCurves.SORTED_KEY_SIZE.size();