mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8284415: Collapse identical catch branches in security libs
Reviewed-by: coffeys, xuelei, wetmore
This commit is contained in:
parent
4f36229c96
commit
8e58d4a589
32 changed files with 74 additions and 197 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -145,10 +145,7 @@ public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
|
|||
} catch (InvalidParameterSpecException e) {
|
||||
// this should never happen
|
||||
throw new RuntimeException(e.getMessage());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// this should never happen, because we provide it
|
||||
throw new RuntimeException(e.getMessage());
|
||||
} catch (NoSuchProviderException e) {
|
||||
} catch (NoSuchAlgorithmException | NoSuchProviderException e) {
|
||||
// this should never happen, because we provide it
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
|
|
@ -29,13 +29,11 @@ import java.io.*;
|
|||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.*;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import sun.security.pkcs.EncryptedPrivateKeyInfo;
|
||||
import sun.security.util.PolicyUtil;
|
||||
|
||||
/**
|
||||
|
@ -798,11 +796,8 @@ abstract class DomainKeyStore extends KeyStoreSpi {
|
|||
parser.read(configurationReader);
|
||||
domains = parser.getDomainEntries();
|
||||
|
||||
} catch (MalformedURLException mue) {
|
||||
throw new IOException(mue);
|
||||
|
||||
} catch (PolicyParser.ParsingException pe) {
|
||||
throw new IOException(pe);
|
||||
} catch (MalformedURLException | PolicyParser.ParsingException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
for (PolicyParser.DomainEntry domain : domains) {
|
||||
|
|
|
@ -157,8 +157,7 @@ public class HostnameChecker {
|
|||
InetAddress.getByName(ipAddress))) {
|
||||
return;
|
||||
}
|
||||
} catch (UnknownHostException e) {
|
||||
} catch (SecurityException e) {}
|
||||
} catch (UnknownHostException | SecurityException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -168,9 +168,7 @@ public class CRLExtensions {
|
|||
tmp = seq;
|
||||
|
||||
out.write(tmp.toByteArray());
|
||||
} catch (IOException e) {
|
||||
throw new CRLException("Encoding error: " + e.toString());
|
||||
} catch (CertificateException e) {
|
||||
} catch (IOException | CertificateException e) {
|
||||
throw new CRLException("Encoding error: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -648,9 +648,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
|
|||
if (attr.getSuffix() != null) {
|
||||
try {
|
||||
return info.get(attr.getSuffix());
|
||||
} catch (IOException e) {
|
||||
throw new CertificateParsingException(e.toString());
|
||||
} catch (CertificateException e) {
|
||||
} catch (IOException | CertificateException e) {
|
||||
throw new CertificateParsingException(e.toString());
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -229,9 +229,7 @@ public class X509CertInfo implements CertAttrSet<String> {
|
|||
rawCertInfo = tmp.toByteArray();
|
||||
}
|
||||
return rawCertInfo.clone();
|
||||
} catch (IOException e) {
|
||||
throw new CertificateEncodingException(e.toString());
|
||||
} catch (CertificateException e) {
|
||||
} catch (IOException | CertificateException e) {
|
||||
throw new CertificateEncodingException(e.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
|
@ -264,8 +264,7 @@ public class X509Key implements PublicKey {
|
|||
result.parseKeyBits();
|
||||
return result;
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (InstantiationException e) {
|
||||
} catch (ClassNotFoundException | InstantiationException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
// this should not happen.
|
||||
throw new IOException (classname + " [internal error]");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue