Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[MINOR] added fromHexStringStrict to check for exactly 20 byte addresses #1128

Merged
merged 14 commits into from
Mar 21, 2019

Conversation

macfarla
Copy link
Contributor

PR description

Added method to create Address from exactly 20 bytes to be used by CLI (tests remain using existing method which pads shorter values)

*
* @param str An hexadecimal string representing a valid account address (strictly 20 bytes).
* @return The parsed address.
* @throws NullPointerException if the provided string is {@code null}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you return null rather than throw a null pointer exception when the hexstring is null

Copy link
Contributor

Choose a reason for hiding this comment

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

and thinking further probably better to throw an illegal argument exception from checkArgument rather than a null pointer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is also true for the existing fromHexString method. Do I leave that one as is?

@macfarla macfarla merged commit 7531131 into PegaSysEng:master Mar 21, 2019
@macfarla macfarla deleted the cli-strict-address branch March 21, 2019 01:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants