From 35420ec2809b6fbf39395e423412283c90ca1c59 Mon Sep 17 00:00:00 2001 From: sohel Date: Thu, 15 May 2025 18:56:08 +0530 Subject: [PATCH] gcp-schema-fix --- .../java/org/sunbird/schema/impl/BaseSchemaValidator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform-core/schema-validator/src/main/java/org/sunbird/schema/impl/BaseSchemaValidator.java b/platform-core/schema-validator/src/main/java/org/sunbird/schema/impl/BaseSchemaValidator.java index 32eeb3b23..0f0adee32 100644 --- a/platform-core/schema-validator/src/main/java/org/sunbird/schema/impl/BaseSchemaValidator.java +++ b/platform-core/schema-validator/src/main/java/org/sunbird/schema/impl/BaseSchemaValidator.java @@ -19,6 +19,7 @@ import javax.json.JsonReader; import javax.json.JsonReaderFactory; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -68,8 +69,10 @@ public Config getConfig() { * @param stream the InputStream for the schema. * @return the read schema. */ - protected JsonSchema readSchema(InputStream stream) { - try (JsonSchemaReader reader = schemaReaderFactory.createSchemaReader(stream)) { + protected JsonSchema readSchema(InputStream stream) throws Exception{ + byte[] bytes = stream.readAllBytes(); + InputStream jsonStream = new ByteArrayInputStream(bytes); + try (JsonSchemaReader reader = schemaReaderFactory.createSchemaReader(jsonStream)) { return reader.read(); } }