Skip to content
Open
Show file tree
Hide file tree
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 @@ -767,7 +767,7 @@ public void deleteByAbout(UUID entityId) {
try {
deleteThreadInternal(UUID.fromString(threadId));
} catch (Exception ex) {
// Continue deletion
LOG.warn("Failed to delete thread {} during entity {} cleanup", threadId, entityId, ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,31 +163,33 @@ private static boolean isEntityType(JSONObject jsonSchema) {
private static Schema loadMainSchema(
String schemaPath, String entityType, String schemaUri, SchemaClient schemaClient)
throws SchemaProcessingException {
InputStream schemaInputStream =
SchemaFieldExtractor.class.getClassLoader().getResourceAsStream(schemaPath);
if (schemaInputStream == null) {
LOG.error("Schema file not found at path: {}", schemaPath);
throw new SchemaProcessingException(
"Schema file not found for entity type: " + entityType,
SchemaProcessingException.ErrorType.RESOURCE_NOT_FOUND);
}
try (InputStream schemaInputStream =
SchemaFieldExtractor.class.getClassLoader().getResourceAsStream(schemaPath)) {
if (schemaInputStream == null) {
LOG.error("Schema file not found at path: {}", schemaPath);
throw new SchemaProcessingException(
"Schema file not found for entity type: " + entityType,
SchemaProcessingException.ErrorType.RESOURCE_NOT_FOUND);
}

JSONObject rawSchema = new JSONObject(new JSONTokener(schemaInputStream));
SchemaLoader schemaLoader =
SchemaLoader.builder()
.schemaJson(rawSchema)
.resolutionScope(schemaUri)
.schemaClient(schemaClient)
.build();
JSONObject rawSchema = new JSONObject(new JSONTokener(schemaInputStream));
SchemaLoader schemaLoader =
SchemaLoader.builder()
.schemaJson(rawSchema)
.resolutionScope(schemaUri)
.schemaClient(schemaClient)
.build();

try {
Schema schema = schemaLoader.load().build();
LOG.debug("Schema '{}' loaded successfully.", schemaPath);
return schema;
} catch (SchemaProcessingException e) {
throw e;
Comment thread
RajdeepKushwaha5 marked this conversation as resolved.
} catch (Exception e) {
LOG.error("Error loading schema '{}': {}", schemaPath, e.getMessage());
LOG.error("Error loading schema '{}'", schemaPath, e);
throw new SchemaProcessingException(
"Error loading schema '" + schemaPath + "': " + e.getMessage(),
e,
SchemaProcessingException.ErrorType.OTHER);
}
}
Expand Down Expand Up @@ -414,30 +416,33 @@ private Schema resolveSchemaByType(String typeName, String schemaUri, SchemaClie

private Schema loadSchema(String schemaPath, String schemaUri, SchemaClient schemaClient)
throws SchemaProcessingException {
InputStream schemaInputStream = getClass().getClassLoader().getResourceAsStream(schemaPath);
if (schemaInputStream == null) {
LOG.error("Schema file not found at path: {}", schemaPath);
throw new SchemaProcessingException(
"Schema file not found for path: " + schemaPath,
SchemaProcessingException.ErrorType.RESOURCE_NOT_FOUND);
}
try (InputStream schemaInputStream =
getClass().getClassLoader().getResourceAsStream(schemaPath)) {
if (schemaInputStream == null) {
LOG.error("Schema file not found at path: {}", schemaPath);
throw new SchemaProcessingException(
"Schema file not found for path: " + schemaPath,
SchemaProcessingException.ErrorType.RESOURCE_NOT_FOUND);
}

JSONObject rawSchema = new JSONObject(new JSONTokener(schemaInputStream));
SchemaLoader schemaLoader =
SchemaLoader.builder()
.schemaJson(rawSchema)
.resolutionScope(schemaUri) // Base URI for resolving $ref
.schemaClient(schemaClient)
.build();
JSONObject rawSchema = new JSONObject(new JSONTokener(schemaInputStream));
SchemaLoader schemaLoader =
SchemaLoader.builder()
.schemaJson(rawSchema)
.resolutionScope(schemaUri)
.schemaClient(schemaClient)
.build();

try {
Schema schema = schemaLoader.load().build();
LOG.debug("Schema '{}' loaded successfully.", schemaPath);
return schema;
} catch (SchemaProcessingException e) {
throw e;
Comment thread
RajdeepKushwaha5 marked this conversation as resolved.
} catch (Exception e) {
LOG.error("Error loading schema '{}': {}", schemaPath, e.getMessage());
LOG.error("Error loading schema '{}'", schemaPath, e);
throw new SchemaProcessingException(
"Error loading schema '" + schemaPath + "': " + e.getMessage(),
e,
SchemaProcessingException.ErrorType.OTHER);
}
}
Expand Down
Loading