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

JSONException calling getSavedQueries with the newer JSon library #47

Closed
eduardo-jose-pereira opened this issue Aug 1, 2012 · 6 comments

Comments

@eduardo-jose-pereira
Copy link

commented Aug 1, 2012

  • Got the following exception calling getSavedQueries.
  • It seems that the field "is_public" is a boolean not a string.
  • I am using Redmine 2.0.3.stable
  • I added the method getBooleanOrNull to JsonInput and changed the method RedmineJSONParser.parseSavedQuery to use JsonInput.getBooleanOrNull instead of getStringOrNull and that seems to fix the problem.

com.taskadapter.redmineapi.RedmineFormatException: org.json.JSONException: JSONObject["is_public"] not a string.
at com.taskadapter.redmineapi.internal.Transport.getObjectsList(Transport.java:386)
at com.taskadapter.redmineapi.internal.Transport.getObjectsList(Transport.java:335)
at com.taskadapter.redmineapi.RedmineManager.getSavedQueries(RedmineManager.java:440)
at aA.TicketExample.showQueries(TicketExample.java:47)
at aA.TicketExample.main(TicketExample.java:27)
Caused by: org.json.JSONException: JSONObject["is_public"] not a string.
at org.json.JSONObject.getString(JSONObject.java:644)
at com.taskadapter.redmineapi.internal.json.JsonInput.getStringOrNull(JsonInput.java:128)
at com.taskadapter.redmineapi.internal.RedmineJSONParser.parseSavedQuery(RedmineJSONParser.java:224)
at com.taskadapter.redmineapi.internal.RedmineJSONParser$15.parse(RedmineJSONParser.java:139)
at com.taskadapter.redmineapi.internal.RedmineJSONParser$15.parse(RedmineJSONParser.java:1)
at com.taskadapter.redmineapi.internal.json.JsonInput.getListOrNull(JsonInput.java:58)
at com.taskadapter.redmineapi.internal.Transport.getObjectsList(Transport.java:375)
... 4 more

@ghost ghost assigned maxkar Aug 1, 2012

@eduardo-jose-pereira

This comment has been minimized.

Copy link
Author

commented Aug 6, 2012

the same problem happened with is_default and is_closed in RedmineJSONParser.parseStatus

maxkar added a commit that referenced this issue Aug 16, 2012
#47
Fixed saved queries and status parsing to "Json.parseBoolean"
@maxkar

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2012

Hello, Eduardo.

Do you use newer JSON version? Our tests are run using JSON library from maven repository and thus does not detect such problem.
Neverless, I implemented proposed changes (both in saved queries and statuses). It is a correct way to read a booleans. Now remine-java-api should work in your configuration.

@maxkar maxkar closed this Aug 16, 2012

@alexeyOnGitHub

This comment has been minimized.

Copy link
Member

commented Aug 16, 2012

this issue seems important enough to release a new version. Maxim, are we ready for the release?

@maxkar

This comment has been minimized.

Copy link
Contributor

commented Aug 17, 2012

Yes, we a ready.

@alexeyOnGitHub

This comment has been minimized.

Copy link
Member

commented Aug 17, 2012

this problem was reproducible on the newest JSon library, which is not present in Maven Central. I will release a new version of Redmine Java API today. it will be compatible with both old and new JSon library.

@deepaksindhu

This comment has been minimized.

Copy link

commented Aug 20, 2012

Hi All, I am new to Android. I am using redmine-java-api.jar in my android project. The project compiles fine but at run time I am getting below exception. I have added Redmine-java-api.jar as external JAR and added to project build path. my android environment is 2.2. please suggest.
Also, to resolve this issue, I downloaded and added the following dependency jar's commons-codec-1.4.jar, httpcore-4.2.1.jar, httpclient-4.2.jar, json-org.jar

(java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLSocketFactory.
08-20 09:08:48.344: E/AndroidRuntime(333): at com.taskadapter.redmineapi.internal.comm.naivessl.NaiveSSLFactory.createNaiveSSLSocketFactory(NaiveSSLFactory.java:35)
08-20 09:08:48.344: E/AndroidRuntime(333): at com.taskadapter.redmineapi.internal.comm.HttpUtil.createConnectionManager(HttpUtil.java:53)
08-20 09:08:48.344: E/AndroidRuntime(333): at com.taskadapter.redmineapi.internal.comm.BaseCommunicator.(BaseCommunicator.java:30)
08-20 09:08:48.344: E/AndroidRuntime(333): at com.taskadapter.redmineapi.internal.Transport.(Transport.java:141)
08-20 09:08:48.344: E/AndroidRuntime(333): at com.taskadapter.redmineapi.RedmineManager.(RedmineManager.java:96)
08-20 09:08:48.344: E/AndroidRuntime(333): at com.taskadapter.redmineapi.RedmineManager.(RedmineManager.java:77)
08-20 09:08:48.344: E/AndroidRuntime(333): at com.example.againred.MainActivity.onCreate(MainActivity.java:20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.