fix(config): 修复因 Maven 仓库配置中未包括 layout 属性导致解析错误的问题.

当 Maven 仓库采用 JsonObject 形式配置, 且未配置 "layout" 属性时, 将会引发 NPE,
该改动已修复该问题.
This commit is contained in:
LamGC 2022-05-19 16:54:47 +08:00
parent 72e26bd677
commit 37c3275bb6
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -151,7 +151,7 @@ internal object MavenRepositoryConfigSerializer
context.deserialize<Proxy>( context.deserialize<Proxy>(
json.getAsJsonObject("proxy"), Proxy::class.java json.getAsJsonObject("proxy"), Proxy::class.java
) else null, ) else null,
layout = json.get("layout").asString ?: "default", layout = json.get("layout")?.asString ?: "default",
enableReleases = json.get("enableReleases")?.asBoolean ?: true, enableReleases = json.get("enableReleases")?.asBoolean ?: true,
enableSnapshots = json.get("enableSnapshots")?.asBoolean ?: true, enableSnapshots = json.get("enableSnapshots")?.asBoolean ?: true,
authentication = if (json.has("authentication") && json.get("authentication").isJsonObject) authentication = if (json.has("authentication") && json.get("authentication").isJsonObject)