Better handle of File reading / Input Streams

This commit is contained in:
Max Dor
2019-01-11 23:02:57 +01:00
parent 83377ebee0
commit c6b8f7d48e
8 changed files with 79 additions and 46 deletions

View File

@@ -60,7 +60,9 @@ public class GoogleFirebaseBackend {
private FirebaseCredential getCreds(String credsPath) throws IOException {
if (StringUtils.isNotBlank(credsPath)) {
return FirebaseCredentials.fromCertificate(new FileInputStream(credsPath));
try (FileInputStream is = new FileInputStream(credsPath)) {
return FirebaseCredentials.fromCertificate(is);
}
} else {
return FirebaseCredentials.applicationDefault();
}