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

org.json jar file is old and lacks some JSON spec methods #1450

Closed
sammyjava opened this issue Nov 4, 2016 · 11 comments
Closed

org.json jar file is old and lacks some JSON spec methods #1450

sammyjava opened this issue Nov 4, 2016 · 11 comments
Assignees
Milestone

Comments

@sammyjava
Copy link
Member

The included org.json package is quite old and lacks some useful methods in the current JSON spec, for exampe: keySet() and toMap(). I suggest replacing it with a current version, which I can supply, compiled from here: https://github.com/stleary/JSON-java

intermine/intermine/model/main/lib/json20110106.jar
intermine/intermine/webservice/client/main/lib/json20110106.jar

@sammyjava
Copy link
Member Author

json20160810.zip

@julie-sullivan julie-sullivan added this to the InterMine 1.6.9 milestone Nov 14, 2016
@julie-sullivan julie-sullivan self-assigned this Nov 14, 2016
julie-sullivan pushed a commit to julie-sullivan/intermine that referenced this issue Nov 16, 2016
@julie-sullivan julie-sullivan removed this from the InterMine 1.6.9 milestone Nov 21, 2016
@julie-sullivan
Copy link
Member

Failed Travis tests. Seems like there is some sort of Java version compatibility problem.

@justinccdev
Copy link
Contributor

fwiw, here's a version compiled for java 1.7. Name is 20161008 as this is of the last change to that repo (I suspect this is the same as sammyjava but with switched month and day).

json20161008.zip

Analysis of sammyjava's jar does show compilation for 1.8

@sammyjava
Copy link
Member Author

Ahhh, sorry about that.

@justinccdev
Copy link
Contributor

No worries 😊

On 21 Nov 2016 5:08 p.m., "Sam Hokin" notifications@github.com wrote:

Ahhh, sorry about that.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1450 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMK6dPtcF6fznLfwr-5suNDGtCOn2hrJks5rAc_2gaJpZM4Kp75S
.

@justinccdev
Copy link
Contributor

justinccdev commented May 10, 2017

This is being progressed under #1457. After sorting out various issues with actually getting the right jar in built for the right Java version, it turns out some change in JSON-java [1] is causing a couple of InterMine tests to fail. It's not obvious when this occurred so the next step will be to divide and conquer to find out which JSON-java change is causing this and then work out what to do about it.

[1] https://github.com/stleary/JSON-java

@julie-sullivan
Copy link
Member

@justinccdev Can you update the JAR in maven's config please

@justinccdev
Copy link
Contributor

This can't be done until the test failures on updating the jar have been fixed.

@julie-sullivan
Copy link
Member

oh. okay. I'll take a look. Hopefully just reordering?

@justinccdev
Copy link
Contributor

justinccdev commented Sep 21, 2017

Unfortunately not, afair, it was something else caused by some subtle change in the behaviour of JSON-java (aka json-lib). When I last looked, I had come to the point of actually comparing json-lib source code to try and identify the change directly but other priorities took over. If we're really unlucky the change was a local patch by somebody in InterMine which has since been lost. A more fruitful approach may be to simply update the JAR and directly change the InterMine source code to accommodate the different behaviour but this won't be simple either. I suspect it's buried deep within JSON generation.

@julie-sullivan
Copy link
Member

julie-sullivan commented Sep 26, 2017

Two test failures

  1. imjs -- which I am guessing is related to the test failings in Add List.ID to all end points #1683 and Json queries #1670. imjs is handling JSON weirdly.

  2. JSON row iterator test

FAILURE: Class org.intermine.webservice.server.output.JSONRowIteratorTest, method testResultsWithNulls

junit.framework.ComparisonFailure: null expected:<null> but was:
<[Problem with index 0:
 [Expected the keys
 [column, id, class, value, url], 
but got these: 
[column, url], 

Problem with id: org.json.JSONException: JSONObject["id"] not found., Problem with class: org.json.JSONException: JSONObject["class"] not found., 
Problem with value: org.json.JSONException: JSONObject["value"] not found.],
 Problem with index 1: [Expected the keys [column, id, class, value, url], but got these: [column, url], Problem with id: org.json.JSONException: JSONObject["id"] not found., 
Problem with class: org.json.JSONException: JSONObject["class"] not found., Problem with value: org.json.JSONException: JSONObject["value"] not found.]]>

	at org.intermine.webservice.server.output.JSONRowIteratorTest.testResultsWithNulls(JSONRowIteratorTest.java:315)

It's weird the other tests pass though, right?

EDIT: oh i see, the JSON row formatter is ignoring / dropping NULL columns. whoops.

julie-sullivan pushed a commit to julie-sullivan/intermine that referenced this issue Sep 26, 2017
@julie-sullivan julie-sullivan mentioned this issue Sep 26, 2017
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants