Skip to content

refactor: replace generic exceptions with custom AsyncAPISchemaException in asyncapi util classes - #2066

Merged
lbroudoux merged 1 commit into
microcks:masterfrom
kishore08-07:replace-generic-exceptions
May 4, 2026
Merged

lbroudoux merged 1 commit into
microcks:masterfrom
kishore08-07:replace-generic-exceptions

Conversation

@kishore08-07

Copy link
Copy Markdown
Contributor

Description

This PR addresses SonarQube maintainability violation "java:S112 : Generic exceptions should never be thrown" - in AsyncAPISchemaUtil and AsyncAPISchemaValidator classes under commons/util/src/main/java/io/github/microcks/util/asyncapi.

  • Introduced a custom checked exception AsyncAPISchemaException to replace all generic Exception throws across both classes.
  • Update AsyncAPISchemaUtil: replace throws Exception in retrieveMessageAvroSchema, buildOneOfMessagesAvroSchemas and buildSingleMessageAvroSchema
  • Update AsyncAPISchemaValidator: replace throws Exception with AsyncAPISchemaException
  • mvn spotless:check -pl commons/util passes locally.

Related issue(s)

See also #2058

…aException in asyncapi util classes

Introduce custom checked exception AsyncAPISchemaException to replace
generic Exception throws flagged by SonarQube rule java:S112.

- Add AsyncAPISchemaException with message and message+cause constructors
- Update AsyncAPISchemaUtil: replace throws Exception in
  retrieveMessageAvroSchema, buildOneOfMessagesAvroSchemas and
  buildSingleMessageAvroSchema
- Update AsyncAPISchemaValidator: replace throws Exception with AsyncAPISchemaException

Signed-off-by: kishore08-07 <[email protected]>
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

👋 @kishore08-07

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks all good to me. Thanks!

@lbroudoux lbroudoux added kind/task java Pull requests that update Java code labels May 4, 2026
@lbroudoux lbroudoux added this to the 1.15.0 milestone May 4, 2026
@lbroudoux
lbroudoux merged commit fce8b7c into microcks:master May 4, 2026
14 of 15 checks passed
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

🎉 @kishore08-07

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

@kishore08-07
kishore08-07 deleted the replace-generic-exceptions branch May 7, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code kind/task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants