GUACAMOLE-1218: Use diamond operator and multi-catch where possible.

This commit is contained in:
Michael Jumper
2020-11-29 16:15:06 -08:00
parent 66d28b8424
commit 95c4bb427f
4 changed files with 10 additions and 27 deletions

View File

@@ -147,22 +147,12 @@ public class CryptoService {
}
// Rethrow all decryption failures identically
catch (InvalidAlgorithmParameterException e) {
throw new GuacamoleServerException(e);
}
catch (NoSuchAlgorithmException e) {
throw new GuacamoleServerException(e);
}
catch (NoSuchPaddingException e) {
throw new GuacamoleServerException(e);
}
catch (InvalidKeyException e) {
throw new GuacamoleServerException(e);
}
catch (IllegalBlockSizeException e) {
throw new GuacamoleServerException(e);
}
catch (BadPaddingException e) {
catch (InvalidAlgorithmParameterException
| NoSuchAlgorithmException
| NoSuchPaddingException
| InvalidKeyException
| IllegalBlockSizeException
| BadPaddingException e) {
throw new GuacamoleServerException(e);
}
@@ -200,13 +190,7 @@ public class CryptoService {
}
// Rethrow all signature failures identically
catch (NoSuchAlgorithmException e) {
throw new GuacamoleServerException(e);
}
catch (InvalidKeyException e) {
throw new GuacamoleServerException(e);
}
catch (IllegalStateException e) {
catch (NoSuchAlgorithmException | InvalidKeyException | IllegalStateException e) {
throw new GuacamoleServerException(e);
}

View File

@@ -78,7 +78,7 @@ public class RequestValidationService {
}
// Build matchers for each trusted network
Collection<IpAddressMatcher> matchers = new ArrayList<IpAddressMatcher>(trustedNetworks.size());
Collection<IpAddressMatcher> matchers = new ArrayList<>(trustedNetworks.size());
for (String network : trustedNetworks)
matchers.add(new IpAddressMatcher(network));

View File

@@ -342,7 +342,7 @@ public class UserData {
* connection.
*/
public void setConnections(Map<String, Connection> connections) {
this.connections = new ConcurrentHashMap<String, Connection>(connections);
this.connections = new ConcurrentHashMap<>(connections);
}
/**

View File

@@ -46,8 +46,7 @@ public class UserDataDenylist {
* string produced by encoding the binary signature using DatatypeConverter.
* A byte[] cannot be used directly.
*/
private final ConcurrentMap<String, UserData> denylist =
new ConcurrentHashMap<String, UserData>();
private final ConcurrentMap<String, UserData> denylist = new ConcurrentHashMap<>();
/**
* Removes all expired UserData objects from the denylist. This will