mirror of
https://github.com/google/nomulus
synced 2026-01-08 23:23:32 +00:00
Fix or suppress some deprecation warnings
Fix or suppress deprecation warnings except those about GoogleCredential,
which is being handled separately.
The @SuppressWarnings("deprecation") annotation does not cover imports
even when it is at the class level. We removed imports of deprecated
classes and use their fully qualified names in class body.
This commit is contained in:
@@ -33,7 +33,7 @@ import java.security.cert.Certificate;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import org.bouncycastle.openssl.PEMWriter;
|
||||
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -50,8 +50,8 @@ public class CertificateModuleTest {
|
||||
|
||||
private static byte[] getPemBytes(Object... objects) throws Exception {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
try (PEMWriter pemWriter =
|
||||
new PEMWriter(new OutputStreamWriter(byteArrayOutputStream, UTF_8))) {
|
||||
try (JcaPEMWriter pemWriter =
|
||||
new JcaPEMWriter(new OutputStreamWriter(byteArrayOutputStream, UTF_8))) {
|
||||
for (Object object : objects) {
|
||||
pemWriter.writeObject(object);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ import java.util.Date;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.x509.X509V3CertificateGenerator;
|
||||
|
||||
/**
|
||||
* Utility class that provides methods used by {@link SslClientInitializerTest} and {@link
|
||||
* SslServerInitializerTest}.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SslInitializerTestUtils {
|
||||
|
||||
static {
|
||||
@@ -56,7 +56,8 @@ public class SslInitializerTestUtils {
|
||||
*/
|
||||
public static X509Certificate signKeyPair(
|
||||
SelfSignedCertificate ssc, KeyPair keyPair, String hostname) throws Exception {
|
||||
X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();
|
||||
org.bouncycastle.x509.X509V3CertificateGenerator certGen =
|
||||
new org.bouncycastle.x509.X509V3CertificateGenerator();
|
||||
X500Principal dnName = new X500Principal("CN=" + hostname);
|
||||
certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));
|
||||
certGen.setSubjectDN(dnName);
|
||||
|
||||
Reference in New Issue
Block a user