in cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/CredentialsHelper.java [44:56]
GoogleCredentials getFileCredentials(String filePath) {
File credentialsFile = new File(filePath);
if (!credentialsFile.isFile()) {
throw new IllegalArgumentException(
String.format("Error reading credential file %s: File does not exist", filePath));
}
try (InputStream credentialsStream = new FileInputStream(credentialsFile)) {
return GoogleCredentials.fromStream(credentialsStream);
} catch (IOException e) {
throw new IllegalArgumentException(
String.format("Error reading credential file %s", filePath), e);
}
}