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

Lists.parseListCreationInfo throws JSONException if unmatched identifiers are not strings #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jtnystrom
Copy link

@jtnystrom jtnystrom commented Dec 7, 2022

Hi everyone, thanks for your work on Intermine. I found what I think is a bug in the Java client library and thought I would try to contribute a fix.

During list creation, if some unmatched identifiers are integers, which can happen if a list is specified using Entrez gene IDs, then we can have

"unmatchedIdentifiers":[
100909873,
100125377,
100910861, ...

which causes ServiceException at:

org.intermine.client.lists.Lists.parseListCreationInfo(Lists.java:103)
at org.intermine.client.services.ListService.processListCreationRequest(ListService.java:661)
at org.intermine.client.services.ListService.createList(ListService.java:236)

caused by

Caused by: org.json.JSONException: JSONArray[0] not a string.
at org.json.JSONArray.getString(JSONArray.java:333)
at org.intermine.client.lists.Lists.parseListCreationInfo(Lists.java:98)

The attached change to Lists here (optString(0) instead of getString(0)) fixes this and should not affect the case where the item is a String.

I have tested this with my application and confirmed that it works, but unfortunately I wasn't able to run the intermine-ws-java test suite.

@jtnystrom jtnystrom changed the title Lists.parseListCreationInfo sometimes throws JSONException if unmatched identifiers are not strings Lists.parseListCreationInfo throws JSONException if unmatched identifiers are not strings Dec 7, 2022
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.

1 participant