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

Add better argument checking for null/empty strings when constructing URLs #115

Closed
gantzm opened this issue Aug 8, 2017 · 4 comments
Closed

Comments

@gantzm
Copy link

gantzm commented Aug 8, 2017

Seeing the following when calling client.getUser("string value").

It doesn't appear that this is something I can control.

I'm assuming the client is thread safe, is it not maybe?

java.lang.IllegalArgumentException: It is expected that only ArrayProperty or SetProperty properties represent collection items.
at com.okta.sdk.lang.Assert.isTrue(Assert.java:33)
at com.okta.sdk.impl.ds.cache.WriteCacheFilter.cache(WriteCacheFilter.java:154)
at com.okta.sdk.impl.ds.cache.WriteCacheFilter.filter(WriteCacheFilter.java:73)
at com.okta.sdk.impl.ds.DefaultFilterChain.filter(DefaultFilterChain.java:52)
at com.okta.sdk.impl.ds.cache.ReadCacheFilter.filter(ReadCacheFilter.java:53)
at com.okta.sdk.impl.ds.DefaultFilterChain.filter(DefaultFilterChain.java:52)
at com.okta.sdk.impl.ds.DefaultDataStore.getResourceData(DefaultDataStore.java:309)
at com.okta.sdk.impl.ds.DefaultDataStore.getResource(DefaultDataStore.java:225)
at com.okta.sdk.impl.ds.DefaultDataStore.getResource(DefaultDataStore.java:213)
at com.okta.sdk.impl.client.DefaultClient.getUser(DefaultClient.java:236)

@bdemers
Copy link
Contributor

bdemers commented Aug 8, 2017

@gantzm thanks for reporting this.

I'm trying to figure out how to reproduce. Is your "string value" an valid user id or are you literally using "string value"?

@gantzm
Copy link
Author

gantzm commented Aug 9, 2017

Some debugging reveals that the call being made was client.getUser(""), with an empty string.

Probably not a valid scenario, but an argument check would probably be helpful.

@bdemers
Copy link
Contributor

bdemers commented Aug 9, 2017

Agreed! We will get some added checking in there!
I'm going to change the name of this issue to reflect this.

@bdemers bdemers changed the title Odd exception with version 0.6.0 SDK. Add better argument checking for null/empty strings when constructing URLs Aug 9, 2017
@bdemers
Copy link
Contributor

bdemers commented Aug 9, 2017

I'm assuming that getting a user with an id of "" is actually getting list of users from /users which would return a collection. We should guard against this, as that is not a valid arg for this method (or any 'id' based get method)

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

No branches or pull requests

2 participants