Accessing Crucible rest-service-fe/search-v1/reviewsForChangeset via Google HTTP Client returns Code 500

I'm writing a Java client to the Atlassian Crucible REST API to return all reviews for a given changeset, and cannot seen to get it working.

The code looks correct, but returns HTTP Code 500 and a non-specific message.

Here is the code:

 * @see
List<Review> searchReviewsForChangeset(String repo, String changeset)
   HttpResponse response;
      String command = String.format("%s/reviewsForChangeset/%s", SEARCH, repo);
      CrucibleUrl crucibleUrl = new CrucibleUrl(url + command);
      HttpContent content = new UrlEncodedContent(new Object()
         String cs = changeset;

      HttpRequest request = requestFactory.buildPostRequest(crucibleUrl, content);
      // request.setUnsuccessfulResponseHandler(this);
      response = request.execute();

      Reviews x = response.parseAs(Reviews.class);
      return x.list;
   catch (IOException ex)
      Logger.getLogger(Crucible.class.getName()).log(Level.SEVERE, null, ex);
      return Collections.emptyList();

The HttpRequestFactory is initialized like this:

HttpTransport transport = new NetHttpTransport();
  JsonFactory jsonFactory = new GsonFactory();
  HttpRequestFactory requestFactory = transport.createRequestFactory(request ->
     request.setParser(new JsonObjectParser(jsonFactory));
     HttpHeaders httpHeaders = new HttpHeaders();


Here is the output I get (with logging turned on in the Google HTTP Client):
CONFIG: -------------- REQUEST  --------------
Accept: application/json
Accept-Encoding: gzip
Authorization: <Not Logged>
Content-Type: application/json
User-Agent: Google-HTTP-Java-Client/1.20.0 (gzip)
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 9

Nov 03, 2015 4:05:21 PM execute
CONFIG: curl -v --compressed -X POST -H 'Accept: application/json' -H 'Accept-Encoding: gzip' -H 'Authorization: <Not Logged>' -H 'Content-Type: application/json' -H 'User-Agent: Google-HTTP-Java-Client/1.20.0 (gzip)' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -d '@-' -- '' << $$$
Nov 03, 2015 4:05:21 PM close
CONFIG: Total: 9 bytes
Nov 03, 2015 4:05:21 PM close
CONFIG: cs=161883
Nov 03, 2015 4:05:21 PM <init>
CONFIG: -------------- RESPONSE --------------
HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
Server: Jetty(6.1.26)
Cache-Control: private
Set-Cookie: FESESSIONID=qbewjdhe9f17q9ykuetqqzbv;Path=/;HttpOnly
Set-Cookie: crucibleprefs1="D%3D1446584721687";Path=/;Expires=Wed, 02-Nov-2016 21:05:21 GMT
Set-Cookie: remember=;Path=/;Expires=Thu, 01-Jan-1970 00:00:00 GMT;HttpOnly
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json

Nov 03, 2015 4:05:21 PM close
CONFIG: Total: 12,071 bytes
Nov 03, 2015 4:05:21 PM close
CONFIG: {"code":"WebApplication","message":null,"stacktrace":"\n\tat com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(\n\tat com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(\n\tat com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(
... many more lines elided ...
at org.mortbay.jetty.HttpConnection$RequestHandler.content(\n\tat org.mortbay.jetty.HttpParser.parseNext(\n\tat org.mortbay.jetty.HttpParser.parseAvailable(\n\tat org.mortbay.jetty.HttpConnection.handle(\n\tat\n\tat org.mortbay.thread.BoundedThreadPool$\n"}


What am I doing wrong? I can provide the entire stacktrace as needed.

Here is a list of my dependencies:

Java 8u40, plus the following:


1 answer

1 accepted

1 vote

Hi @Jeff Wilson,

I think the problem is caused by repeated Content-Type header - it is set to application/json first, but then set again to application/x-www-form-urlencoded; charset=UTF-8.

As you are submitting form-urlencoded data try removing 


That should help.

Suggest an answer

Log in or Join to answer
Community showcase
Bridget Sauer
Published Mar 09, 2018 in Jira Service Desk

E.L. Fridge's take on education, Jira Service Desk, and creative Jira use cases

...word of mouth, so by 2016, we were working with several other entities on campus to implement Jira Service Desk . The Atlassian motto of “for every team” has really come true for us in this case. We...

335 views 0 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot