Skip to content
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

Check Path with / character when calling set() #237

Closed
cancerpio opened this issue Feb 3, 2020 · 1 comment · Fixed by #293
Closed

Check Path with / character when calling set() #237

cancerpio opened this issue Feb 3, 2020 · 1 comment · Fixed by #293
Assignees
Labels

Comments

@cancerpio
Copy link

Is your feature request related to a problem? Please describe.
There was no error message or exception when set() being called with the below illegal argument:
1.Path did not start with / character
2.Path end with / character,
instead, it just causes the process to stop here and nothing happens, and znode did not being set.
Describe the solution you'd like
An exception being thrown that displays the illegal argument, just as zookeeper client, such as...
const set(path, data, version) {
...
if (typeof zNodePath === 'string' && zNodePath.endsWith('/')) {
throw new Error(Set Znode fail, ZNode: ${zNodePath} must not end with / character);
}
.... (and the same checking for !startWith('/')

Describe alternatives you've considered
add "Path must start with / character" and "Path must not end with / character" to the response of set()
Additional context
it's the same behavior as zkCli.sh:

[zk: localhost:2181(CONNECTED) 2] create notStartWithSlash ""
Command failed: java.lang.IllegalArgumentException: Path must start with / character

[zk: localhost:2181(CONNECTED) 3] create /endWithSlash/ ""
Command failed: java.lang.IllegalArgumentException: Path must not end with / character
[zk: localhost:2181(CONNECTED) 4]

@DavidVujic
Copy link
Collaborator

Thank you for reporting this @cancerpio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants