Skip to content

Pass message to IntegrityException#6949

Merged
grzesiek2010 merged 1 commit intogetodk:masterfrom
grzesiek2010:integrity_exception
Oct 29, 2025
Merged

Pass message to IntegrityException#6949
grzesiek2010 merged 1 commit intogetodk:masterfrom
grzesiek2010:integrity_exception

Conversation

@grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Oct 28, 2025

Why is this the best possible solution? Were any other approaches considered?

The IntegrityException should include the original exception message to provide more details about what happened.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

It doesn't require testing.

Do we need any specific form for testing your changes? If so, please attach one.

No.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 marked this pull request as ready for review October 29, 2025 12:53
@grzesiek2010 grzesiek2010 requested a review from seadowg October 29, 2025 12:54

class IntegrityException extends RuntimeException {}
class IntegrityException extends RuntimeException {
public IntegrityException(String message) {
Copy link
Member

Choose a reason for hiding this comment

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

What about making this nullable and optional so you don't need to pass "" in some of the call sites?

Copy link
Member Author

Choose a reason for hiding this comment

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

Making the message nullable wouldn’t simplify things in this case. This is plain Java code, so I’d still need to pass null explicitly or add an extra constructor to handle the no-arg case.
Also, "" is only used in tests, not in production code. In actual business logic, the exception always carries a meaningful message, and making the parameter nullable would rather increase the risk of accidentally passing null instead of a proper message.

Copy link
Member

Choose a reason for hiding this comment

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

Good points! Probably not worth converting to Kotlin just for this change.

@grzesiek2010 grzesiek2010 requested a review from seadowg October 29, 2025 13:11

class IntegrityException extends RuntimeException {}
class IntegrityException extends RuntimeException {
public IntegrityException(String message) {
Copy link
Member

Choose a reason for hiding this comment

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

Good points! Probably not worth converting to Kotlin just for this change.

@grzesiek2010 grzesiek2010 merged commit 6f5a910 into getodk:master Oct 29, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants