Program: 188548
Project: 188548
Buggy source:
private void getDescriptiveMetadata(final String aipId,final String representationId,final String descId,final String versionKey,final boolean inHTML,final AsyncCallback<SafeHtml> callback){
  SafeUri uri;
  if (inHTML) {
    uri=RestUtils.createRepresentationDescriptiveMetadataHTMLUri(representationId,descId,versionKey);
  }
 else {
    uri=RestUtils.createRepresentationDescriptiveMetadataDownloadUri(representationId,descId,versionKey);
  }
  RequestBuilder requestBuilder=new RequestBuilder(RequestBuilder.GET,uri.asString());
  requestBuilder.setHeader("String_Node_Str","String_Node_Str");
  try {
    requestBuilder.sendRequest(null,new RequestCallback(){
      @Override public void onResponseReceived(      Request request,      Response response){
        if (200 == response.getStatusCode()) {
          String text=response.getText();
          SafeHtmlBuilder b=new SafeHtmlBuilder();
          if (inHTML) {
            b.append(SafeHtmlUtils.fromTrustedString(text));
          }
 else {
            b.append(SafeHtmlUtils.fromString(text));
          }
          SafeHtml safeHtml=b.toSafeHtml();
          callback.onSuccess(safeHtml);
        }
 else {
          String text=response.getText();
          String message;
          try {
            RestErrorOverlayType error=(RestErrorOverlayType)JsonUtils.safeEval(text);
            message=error.getMessage();
          }
 catch (          IllegalArgumentException e) {
            message=text;
          }
          SafeHtmlBuilder b=new SafeHtmlBuilder();
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          b.append(messages.descriptiveMetadataTranformToHTMLError());
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          b.append(SafeHtmlUtils.fromString(message));
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          callback.onSuccess(b.toSafeHtml());
        }
      }
      @Override public void onError(      Request request,      Throwable exception){
        callback.onFailure(exception);
      }
    }
);
  }
 catch (  RequestException e) {
    callback.onFailure(e);
  }
}

Fixed version (ground truth):
private void getDescriptiveMetadata(final String aipId,final String representationId,final String descId,final String versionKey,final boolean inHTML,final AsyncCallback<SafeHtml> callback){
  SafeUri uri;
  if (inHTML) {
    if (representationId != null) {
      uri=RestUtils.createRepresentationDescriptiveMetadataHTMLUri(representationId,descId,versionKey);
    }
 else {
      uri=RestUtils.createDescriptiveMetadataHTMLUri(aipId,descId,versionKey);
    }
  }
 else {
    if (representationId != null) {
      uri=RestUtils.createRepresentationDescriptiveMetadataDownloadUri(representationId,descId,versionKey);
    }
 else {
      uri=RestUtils.createDescriptiveMetadataDownloadUri(aipId,descId,versionKey);
    }
  }
  RequestBuilder requestBuilder=new RequestBuilder(RequestBuilder.GET,uri.asString());
  requestBuilder.setHeader("String_Node_Str","String_Node_Str");
  try {
    requestBuilder.sendRequest(null,new RequestCallback(){
      @Override public void onResponseReceived(      Request request,      Response response){
        if (200 == response.getStatusCode()) {
          String text=response.getText();
          SafeHtmlBuilder b=new SafeHtmlBuilder();
          if (inHTML) {
            b.append(SafeHtmlUtils.fromTrustedString(text));
          }
 else {
            b.append(SafeHtmlUtils.fromString(text));
          }
          SafeHtml safeHtml=b.toSafeHtml();
          callback.onSuccess(safeHtml);
        }
 else {
          String text=response.getText();
          String message;
          try {
            RestErrorOverlayType error=(RestErrorOverlayType)JsonUtils.safeEval(text);
            message=error.getMessage();
          }
 catch (          IllegalArgumentException e) {
            message=text;
          }
          SafeHtmlBuilder b=new SafeHtmlBuilder();
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          b.append(messages.descriptiveMetadataTranformToHTMLError());
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          b.append(SafeHtmlUtils.fromString(message));
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          b.append(SafeHtmlUtils.fromSafeConstant("String_Node_Str"));
          callback.onSuccess(b.toSafeHtml());
        }
      }
      @Override public void onError(      Request request,      Throwable exception){
        callback.onFailure(exception);
      }
    }
);
  }
 catch (  RequestException e) {
    callback.onFailure(e);
  }
}