Source:
public HttpRequestBase formatRequest() { URIBuilder uriBuilder = getRepository().getURIBuilder(fAuthIsRequired); Gson gson = new Gson(); String json = null; URI uri = null; try { String path = new StringBuilder(uriBuilder.getPath()).append("/changes/") .append(getId()) .append("/revisions/").append(getRevision()) .append("/drafts") .toString(); uriBuilder.setPath(path); uri = new URI(URIUtil.toUnencodedString(uriBuilder.build())); } catch (URISyntaxException e) { EGerritCorePlugin.logError("URI syntax exception", e); } HttpPut httpPut = new HttpPut(uri); JsonObject jsonCommentInput = new JsonObject(); jsonCommentInput.addProperty("id", fCommentInfo.getId()); jsonCommentInput.addProperty("inReplyTo", fCommentInfo.getInReplyTo()); jsonCommentInput.addProperty("kind", fCommentInfo.getKind()); jsonCommentInput.addProperty("line", fCommentInfo.getLine()); jsonCommentInput.addProperty("message", fCommentInfo.getMessage()); jsonCommentInput.addProperty("patch_set", fCommentInfo.getPatch_set()); jsonCommentInput.addProperty("path", fCommentInfo.getPath()); json = gson.toJson(fCommentInfo.getRange()); if (json != null && json.compareTo("null") != 0) { jsonCommentInput.addProperty("range", json); } jsonCommentInput.addProperty("side", fCommentInfo.getSide()); jsonCommentInput.addProperty("updated", fCommentInfo.getUpdated()); if (json != null && json.compareTo("null") != 0) { json = gson.toJson(fCommentInfo.getAuthor()); jsonCommentInput.addProperty("author", json); } StringEntity input = null; try { input = new StringEntity(jsonCommentInput.toString()); } catch (UnsupportedEncodingException e) { EGerritCorePlugin.logError("URI error encoding CommentInfo", e); } input.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); httpPut.setEntity(input); return httpPut; }

Target:
public HttpRequestBase formatRequest() { URIBuilder uriBuilder = getRepository().getURIBuilder(fAuthIsRequired); Gson gson = new Gson(); String json = null; URI uri = null; try { String path = new StringBuilder(uriBuilder.getPath()).append("/changes/") .append(getId()) .append("/revisions/").append(getRevision()) .append("/drafts") .toString(); uriBuilder.setPath(path); uri = new URI(URIUtil.toUnencodedString(uriBuilder.build())); } catch (URISyntaxException e) { EGerritCorePlugin.logError("URI syntax exception", e); } HttpPut httpPut = new HttpPut(uri); JsonObject jsonCommentInput = new JsonObject(); jsonCommentInput.addProperty("id", fCommentInfo.getId()); jsonCommentInput.addProperty("inReplyTo", fCommentInfo.getInReplyTo()); jsonCommentInput.addProperty("line", fCommentInfo.getLine()); jsonCommentInput.addProperty("message", fCommentInfo.getMessage()); jsonCommentInput.addProperty("path", fCommentInfo.getPath()); json = gson.toJson(fCommentInfo.getRange()); if (json != null && json.compareTo("null") != 0) { jsonCommentInput.addProperty("range", json); } jsonCommentInput.addProperty("side", fCommentInfo.getSide()); if (json != null && json.compareTo("null") != 0) { json = gson.toJson(fCommentInfo.getAuthor()); jsonCommentInput.addProperty("author", json); } StringEntity input = null; try { input = new StringEntity(jsonCommentInput.toString()); } catch (UnsupportedEncodingException e) { EGerritCorePlugin.logError("URI error encoding CommentInfo", e); } input.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); httpPut.setEntity(input); return httpPut; }