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

This widget could not be displayed.

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

64 views 2 3
Join discussion

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