Source:
private List<SubmitRecord> currentSubmitRecord(String uri, IProgressMonitor monitor) throws GerritException { List<SubmitRecord> submitRecordList = new ArrayList<SubmitRecord>(); if (getRepository().getCredentials(AuthenticationType.REPOSITORY) == null) { return submitRecordList; } SubmitRecord[] submitRecordArray = getRestClient().executePostRestRequest(uri, new SubmitRecord(), SubmitRecord[].class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { String errorMsg = getResponseBodyAsString(method); if (isNotPermitted(method, errorMsg) || isConflict(method)) { throw new GerritException(NLS.bind("Cannot get submit change: {0}", errorMsg)); } } private String getResponseBodyAsString(HttpMethodBase method) { try { return method.getResponseBodyAsString(); } catch (IOException e) { return null; } } private boolean isNotPermitted(HttpMethodBase method, String msg) { return method.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN && "submit not permitted\n".equals(msg); } private boolean isConflict(HttpMethodBase method) { return method.getStatusCode() == HttpURLConnection.HTTP_CONFLICT; } }, monitor); for (SubmitRecord element : submitRecordArray) { List<SubmitRecord.Label> list = Collections.emptyList(); if (element.getStatus().equalsIgnoreCase("OK")) { list = element.createLabel(element, element.getOkMap(), OK); } else if (element.getStatus().equalsIgnoreCase("NOT_READY")) { list = element.createLabel(element, element.getNeedMap(), NEED); } else if (element.getStatus().equalsIgnoreCase("REJECT")) { list = element.createLabel(element, element.getRejectMap(), REJECT); } else if (element.getStatus().equalsIgnoreCase("MAY")) { list = element.createLabel(element, element.getMayMap(), MAY); } element.setLabels(list); submitRecordList.add(element); } return submitRecordList; }

Target:
private List<SubmitRecord> currentSubmitRecord(String uri, IProgressMonitor monitor) throws GerritException { List<SubmitRecord> submitRecordList = new ArrayList<SubmitRecord>(); if (isAnonymous()) { return submitRecordList; } SubmitRecord[] submitRecordArray = getRestClient().executePostRestRequest(uri, new SubmitRecord(), SubmitRecord[].class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { String errorMsg = getResponseBodyAsString(method); if (isNotPermitted(method, errorMsg) || isConflict(method)) { throw new GerritException(NLS.bind("Cannot get submit change: {0}", errorMsg)); } } private String getResponseBodyAsString(HttpMethodBase method) { try { return method.getResponseBodyAsString(); } catch (IOException e) { return null; } } private boolean isNotPermitted(HttpMethodBase method, String msg) { return method.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN && "submit not permitted\n".equals(msg); } private boolean isConflict(HttpMethodBase method) { return method.getStatusCode() == HttpURLConnection.HTTP_CONFLICT; } }, monitor); for (SubmitRecord element : submitRecordArray) { List<SubmitRecord.Label> list = Collections.emptyList(); if (element.getStatus().equalsIgnoreCase("OK")) { list = element.createLabel(element, element.getOkMap(), OK); } else if (element.getStatus().equalsIgnoreCase("NOT_READY")) { list = element.createLabel(element, element.getNeedMap(), NEED); } else if (element.getStatus().equalsIgnoreCase("REJECT")) { list = element.createLabel(element, element.getRejectMap(), REJECT); } else if (element.getStatus().equalsIgnoreCase("MAY")) { list = element.createLabel(element, element.getMayMap(), MAY); } element.setLabels(list); submitRecordList.add(element); } return submitRecordList; }