Migrating to fluent logging (green)

This is a 'green' Flogger migration CL. Green CLs are intended to be as
safe as possible and should be easy to review and submit.

No changes should be necessary to the code itself prior to submission,
but small changes to BUILD files may be required.

Changes within files are completely independent of each other, so this CL
can be safely split up for review using tools such as Rosie.

For more information, see []
Base CL: 197331037

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197466715
This commit is contained in:
jianglai 2018-05-21 15:08:53 -07:00
parent 3983f32795
commit 05f166918f
12 changed files with 64 additions and 78 deletions

View file

@ -19,7 +19,6 @@ import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableList;
import com.google.common.logging.FormattingLogger;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;
@ -73,8 +72,6 @@ public class CertificateModule {
@Qualifier
public @interface Prod {}
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
static {
Security.addProvider(new BouncyCastleProvider());
}
@ -159,8 +156,7 @@ public class CertificateModule {
listBuilder.add(obj);
}
} catch (IOException e) {
logger.severe(e, "Cannot parse PEM file correctly.");
throw new RuntimeException(e);
throw new RuntimeException("Cannot parse PEM file correctly.", e);
}
}
return listBuilder.build();
@ -176,8 +172,8 @@ public class CertificateModule {
try {
return converter.getKeyPair(pemKeyPair).getPrivate();
} catch (PEMException e) {
logger.severefmt(e, "Error converting private key: %s", pemKeyPair);
throw new RuntimeException(e);
throw new RuntimeException(
String.format("Error converting private key: %s", pemKeyPair), e);
}
};
ImmutableList<PrivateKey> privateKeys =
@ -200,8 +196,8 @@ public class CertificateModule {
try {
return converter.getCertificate(certificateHolder);
} catch (CertificateException e) {
logger.severefmt(e, "Error converting certificate: %s", certificateHolder);
throw new RuntimeException(e);
throw new RuntimeException(
String.format("Error converting certificate: %s", certificateHolder), e);
}
};
ImmutableList<X509Certificate> certificates =