This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch json-schema-extensions
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/json-schema-extensions by this 
push:
     new 08e8c81bb code review adjustments
08e8c81bb is described below

commit 08e8c81bb31a96216a4e36bcf45489d345ea884a
Author: Kevan <[email protected]>
AuthorDate: Mon May 23 17:09:57 2022 +0200

    code review adjustments
---
 .../org/apache/unomi/schema/impl/SchemaServiceImpl.java     | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
 
b/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
index 4ae6679f9..a1c0a50ba 100644
--- 
a/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
+++ 
b/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
@@ -81,19 +81,17 @@ public class SchemaServiceImpl implements SchemaService {
             jsonNode = objectMapper.readTree(data);
             jsonSchema = jsonSchemaFactory.getSchema(new URI(schemaId));
         } catch (Exception e) {
-            logger.error("Schema validation failed because: Error during data 
reading and initial schema lookup - Set SchemaServiceImpl at DEBUG level for 
more detail ");
-            logger.debug("full error",e);
+            logger.debug("Schema validation failed", e);
             return false;
         }
 
         if (jsonNode == null) {
-            // no data to validate
+            logger.debug("Schema validation failed because: no data to 
validate");
             return false;
         }
 
         if (jsonSchema == null) {
-            logger.warn("Schema validation failed because: Schema not found - 
Set SchemaServiceImpl at DEBUG level for more detail ");
-            logger.warn("Schema not found: {}", schemaId);
+            logger.debug("Schema validation failed because: Schema not found 
{}", schemaId);
             return false;
         }
 
@@ -101,16 +99,15 @@ public class SchemaServiceImpl implements SchemaService {
         try {
             validationMessages = jsonSchema.validate(jsonNode);
         } catch (Exception e) {
-            logger.error("Schema validation failed because: Error during 
validation - Set SchemaServiceImpl at DEBUG level for more detail ");
-            logger.debug("full error", e);
+            logger.debug("Schema validation failed", e);
             return false;
         }
 
         if (validationMessages == null || validationMessages.isEmpty()) {
             return true;
         } else {
-            logger.error("Schema validation found {} errors while validating 
against schema: {}  - Set SchemaServiceImpl at DEBUG level for more detail ", 
validationMessages.size(), schemaId);
             if (logger.isDebugEnabled()) {
+                logger.debug("Schema validation found {} errors while 
validating against schema: {}", validationMessages.size(), schemaId);
                 for (ValidationMessage validationMessage : validationMessages) 
{
                     logger.debug("Validation error: {}", validationMessage);
                 }

Reply via email to