Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import javax.json.JsonReader;
import javax.json.JsonReaderFactory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

Expand Down Expand Up @@ -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{
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid throwing a generic 'Exception' in the method signature; consider specifying a more precise exception type that relates directly to JSON schema processing.

Copilot uses AI. Check for mistakes.
byte[] bytes = stream.readAllBytes();
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the entire InputStream into a byte array may impact performance and memory usage if the schema is large; consider using a buffered approach if large schemas are expected.

Copilot uses AI. Check for mistakes.
InputStream jsonStream = new ByteArrayInputStream(bytes);
try (JsonSchemaReader reader = schemaReaderFactory.createSchemaReader(jsonStream)) {
return reader.read();
}
}
Expand Down