mirror of
https://github.com/LamGC/Oracle-Sentry.git
synced 2025-04-30 06:37:42 +00:00
fix: 修复由于 json 文件为空, 导致的 NPE.
由于 json 文件为空, 当 Gson 解析空文件时, 将返回 null.
This commit is contained in:
parent
765b13f149
commit
d81d07bd65
@ -133,6 +133,11 @@ public final class SshAuthIdentityProvider {
|
|||||||
}
|
}
|
||||||
Map<String, SshAuthInfo> map = gson.fromJson(new FileReader(identityJsonFile, StandardCharsets.UTF_8),
|
Map<String, SshAuthInfo> map = gson.fromJson(new FileReader(identityJsonFile, StandardCharsets.UTF_8),
|
||||||
new TypeToken<Map<String, SshAuthInfo>>(){}.getType());
|
new TypeToken<Map<String, SshAuthInfo>>(){}.getType());
|
||||||
|
if (map == null) {
|
||||||
|
log.warn("没有可用的 SSH 认证配置.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (String id : map.keySet()) {
|
for (String id : map.keySet()) {
|
||||||
SshAuthInfo info = map.get(id);
|
SshAuthInfo info = map.get(id);
|
||||||
info.setProvider(this);
|
info.setProvider(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user