Skip to content

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

Open
jtnystrom wants to merge 2 commits intointermine:masterfrom
jtnystrom:master
Open

Lists.parseListCreationInfo throws JSONException if unmatched identifiers are not strings#7
jtnystrom wants to merge 2 commits intointermine:masterfrom
jtnystrom:master

Conversation

@jtnystrom
Copy link
Copy Markdown

@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