-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORE-15778: add meaningful exception messages in StateRef.parse() #1199
Conversation
Jenkins build for PR 1199 build 12 Build Successful: |
6ca0c3d
to
058d068
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've posted some specific comments, but having looked at the change as a whole, I wonder if there's a simpler solution. We're already parsing the hash, and verifying the index, so could the issue be solved by parsing the index
before calling parseSecureHash
? The index check could also probably be made a bit stronger by replacing the (now deprecated?) parseInt
with toUInt
?
I also think it's worth elaborating on the description, and adding test notes - @nkovacsx PR's are often good examples of this, e.g. corda/corda-runtime-os#4230
Finally, it feels like we're currently missing a unit test case if we were able to make this change without breaking any tests - I think it's worth adding a case to check that we get the expected error if a malformed state ref is passed in.
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
ledger/ledger-utxo/src/main/java/net/corda/v5/ledger/utxo/StateRef.java
Outdated
Show resolved
Hide resolved
8bd0183
to
879d4dc
Compare
.../ledger-utxo/src/test/java/net/corda/v5/ledger/utxo/uniqueness/client/StateRefParseTest.java
Outdated
Show resolved
Hide resolved
df1dca8
to
be8c768
Compare
ledger/ledger-utxo/src/test/java/net/corda/v5/ledger/utxo/StateRefParseTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Overview
The PR
Testing
I added a unit test for StateRef.parse() method, testing if: