Skip to content

Conversation

@thjaeckle
Copy link
Member

  • replace IllegalStateException with WotThingModelInvalidException to avoid "WoT internal server" errors with status code 500 and not useful error description

* replace IllegalStateException with WotThingModelInvalidException to avoid "WoT internal server" errors with status code 500 and not useful error description
@thjaeckle thjaeckle added this to the 3.8.7 milestone Nov 20, 2025
@thjaeckle thjaeckle self-assigned this Nov 20, 2025
@thjaeckle thjaeckle added the bug label Nov 20, 2025
@thjaeckle thjaeckle requested a review from Copilot November 20, 2025 15:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces IllegalStateException with WotThingModelInvalidException when duplicate keys are detected during WoT (Web of Things) parsing operations. This change ensures proper error handling with appropriate HTTP status codes and meaningful error descriptions instead of generic 500 Internal Server errors.

Key Changes:

  • Replaced all IllegalStateException throws in duplicate key merge functions with WotThingModelInvalidException
  • Added descriptive error messages specifying the context of each duplicate (e.g., "Properties:", "Events:", "Titles:")
  • Updated WotThingModelPayloadValidationException.readValidationDetails() to accept DittoHeaders for proper exception construction

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WotThingModelPayloadValidationException.java Updated to throw WotThingModelInvalidException for duplicate validation detail keys and pass DittoHeaders through
InternalValidation.java Replaced duplicate property key exception with WotThingModelInvalidException
UriVariables.java Replaced duplicate URI variable exception with WotThingModelInvalidException
Titles.java Replaced duplicate title exception with WotThingModelInvalidException
SecurityDefinitions.java Replaced duplicate security scheme exceptions with WotThingModelInvalidException
SchemaDefinitions.java Replaced duplicate schema definition exception with WotThingModelInvalidException
Properties.java Replaced duplicate property exceptions with WotThingModelInvalidException
ImmutableObjectSchema.java Replaced duplicate object property exception with WotThingModelInvalidException
Events.java Replaced duplicate event exceptions with WotThingModelInvalidException
Descriptions.java Replaced duplicate description exception with WotThingModelInvalidException
Actions.java Replaced duplicate action exceptions with WotThingModelInvalidException
DefaultWotThingModelValidator.java Added merge function with WotThingModelInvalidException for duplicate submodel handling
DefaultWotThingModelResolver.java Added merge function with WotThingModelInvalidException and explicit LinkedHashMap for duplicate submodel handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@thjaeckle thjaeckle merged commit b347bcc into eclipse-ditto:master Nov 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants