It appears like on few REST calls (createIssue() for example), JRJC will receive an empty string for a result and will throw the exception below. Calling the REST method again works though, so I have to make the following hack:
int tries = 0;
do {
try {
basicIssue = issueClient.createIssue(in).claim();
tries = 1000000;
} catch (Exception e) {
tries++;
System.err.println("Failed creating issue!");
e.printStackTrace();
}
} while (tries <= 3);
com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:181)
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:175)
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:62)
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:12)
at com.atlassian.util.concurrent.Promises$Of$3.apply(Promises.java:285)
at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:162)
at com.google.common.util.concurrent.Futures$7.run(Futures.java:1072)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:161)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:146)
at com.google.common.util.concurrent.AbstractFuture.done(AbstractFuture.java:235)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:172)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
at com.atlassian.util.concurrent.Promises$Of$3.apply(Promises.java:285)
at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:162)
at com.google.common.util.concurrent.Futures$7.run(Futures.java:1072)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:161)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:146)
at com.google.common.util.concurrent.AbstractFuture.done(AbstractFuture.java:235)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:172)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$1$1.run(SettableFuturePromiseHttpPromiseAsyncClient.java:46)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable$1.run(SettableFuturePromiseHttpPromiseAsyncClient.java:197)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient.runInContext(SettableFuturePromiseHttpPromiseAsyncClient.java:90)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable.run(SettableFuturePromiseHttpPromiseAsyncClient.java:192)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of
at org.codehaus.jettison.json.JSONTokener.syntaxError(JSONTokener.java:439)
at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:169)
at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:266)
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$1.handle(AbstractAsynchronousRestClient.java:138)
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:179)
... 28 more
Hi Yarin,
Also you may need to report this to https://ecosystem.atlassian.net/browse/JRJC so our developers can take a look at it.
Cheers,
Omar
It appears like JRJC 2.0.0 is too immature. Ported the code back to JRJC 1.0.0 and it no weird async things happen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've replied in https://ecosystem.atlassian.net/browse/JRJC-146 - we need more details to track this issue. The 2.0.0-m16 should be quite stable (not many changes are planed for 2.0 release).
P.S. Next time please add jira-rest-java-client tag, so we'll get notified about new question related to JRJC.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.