From 24511a6721681734b31ea7ad8d851f58ea112dbf Mon Sep 17 00:00:00 2001 From: kkonrad Date: Tue, 25 Aug 2020 00:13:00 +0200 Subject: [PATCH] FIX: potential duplicate log entry due to race condition --- src/main/java/com/networknt/schema/JsonMetaSchema.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/networknt/schema/JsonMetaSchema.java b/src/main/java/com/networknt/schema/JsonMetaSchema.java index 3cbffc90c..77fb790c2 100644 --- a/src/main/java/com/networknt/schema/JsonMetaSchema.java +++ b/src/main/java/com/networknt/schema/JsonMetaSchema.java @@ -333,8 +333,7 @@ public JsonValidator newValidator(ValidationContext validationContext, String sc try { Keyword kw = keywords.get(keyword); if (kw == null) { - if (!UNKNOWN_KEYWORDS.containsKey(keyword)) { - UNKNOWN_KEYWORDS.put(keyword, keyword); + if (UNKNOWN_KEYWORDS.put(keyword, keyword) == null) { logger.warn("Unknown keyword " + keyword + " - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword"); } return null;