8284415: Collapse identical catch branches in security libs

Reviewed-by: coffeys, xuelei, wetmore
This commit is contained in:
Andrey Turbanov 2022-04-07 10:00:08 +00:00
parent 4f36229c96
commit 8e58d4a589
32 changed files with 74 additions and 197 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -225,12 +225,9 @@ final class CramMD5Server extends CramMD5Base implements SaslServer {
} catch (NoSuchAlgorithmException e) {
aborted = true;
throw new SaslException("MD5 algorithm not available on platform", e);
} catch (UnsupportedCallbackException e) {
aborted = true;
throw new SaslException("CRAM-MD5 authentication failed", e);
} catch (SaslException e) {
throw e; // rethrow
} catch (IOException e) {
} catch (UnsupportedCallbackException | IOException e) {
aborted = true;
throw new SaslException("CRAM-MD5 authentication failed", e);
}

View file

@ -433,9 +433,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
logger.log(Level.FINE, "DIGEST01:Platform supports {0}", JCE_CIPHER_NAME[i]);
ciphers[i] |= CIPHER_MASKS[i];
} catch (NoSuchAlgorithmException e) {
// no implementation found for requested algorithm.
} catch (NoSuchPaddingException e) {
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
// no implementation found for requested algorithm.
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -662,10 +662,7 @@ final class DigestMD5Client extends DigestMD5Base implements SaslClient {
throw new SaslException(
"Server's rspauth value does not match what client expects");
}
} catch (NoSuchAlgorithmException e) {
throw new SaslException(
"Problem generating response value for verification", e);
} catch (IOException e) {
} catch (NoSuchAlgorithmException | IOException e) {
throw new SaslException(
"Problem generating response value for verification", e);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -614,10 +614,7 @@ final class DigestMD5Server extends DigestMD5Base implements SaslServer {
passwd, nonce /* use own nonce */,
cnonce, NONCE_COUNT_VALUE, authzidBytes);
} catch (NoSuchAlgorithmException e) {
throw new SaslException(
"DIGEST-MD5: problem duplicating client response", e);
} catch (IOException e) {
} catch (NoSuchAlgorithmException | IOException e) {
throw new SaslException(
"DIGEST-MD5: problem duplicating client response", e);
}
@ -705,9 +702,7 @@ final class DigestMD5Server extends DigestMD5Base implements SaslServer {
return challenge;
} catch (NoSuchAlgorithmException e) {
throw new SaslException("DIGEST-MD5: problem generating response", e);
} catch (IOException e) {
} catch (NoSuchAlgorithmException | IOException e) {
throw new SaslException("DIGEST-MD5: problem generating response", e);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@ package com.sun.security.sasl.ntlm;
import com.sun.security.ntlm.NTLMException;
import com.sun.security.ntlm.Server;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Map;
import java.util.Random;
import javax.security.auth.callback.Callback;
@ -153,9 +152,7 @@ final class NTLMServer implements SaslServer {
char[] passwd = pcb.getPassword();
pcb.clearPassword();
return passwd;
} catch (IOException ioe) {
return null;
} catch (UnsupportedCallbackException uce) {
} catch (IOException | UnsupportedCallbackException e) {
return null;
}
}