Program: 188365
Project: 188365
Buggy source:
public static void showPromptDialog(String title,String message,String value,String placeHolder,final RegExp validator,String cancelButtonText,String confirmButtonText,final AsyncCallback<String> callback){
  final DialogBox dialogBox=new DialogBox(false,true);
  dialogBox.setText(title);
  final FlowPanel layout=new FlowPanel();
  if (message != null) {
    final Label messageLabel=new Label(message);
    layout.add(messageLabel);
    messageLabel.addStyleName("String_Node_Str");
  }
  final TextBox inputBox=new TextBox();
  inputBox.setTitle("String_Node_Str");
  if (value != null) {
    inputBox.setText(value);
  }
  if (placeHolder != null) {
    inputBox.getElement().setPropertyString("String_Node_Str",placeHolder);
  }
  final Button cancelButton=new Button(cancelButtonText);
  final Button confirmButton=new Button(confirmButtonText);
  layout.add(inputBox);
  layout.add(cancelButton);
  layout.add(confirmButton);
  dialogBox.setWidget(layout);
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(false);
  cancelButton.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      dialogBox.hide();
      callback.onFailure(null);
    }
  }
);
  confirmButton.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      boolean isValid=validator.test(inputBox.getText());
      if (isValid) {
        dialogBox.hide();
        callback.onSuccess(inputBox.getText());
      }
    }
  }
);
  inputBox.addValueChangeHandler(new ValueChangeHandler<String>(){
    @Override public void onValueChange(    ValueChangeEvent<String> event){
      boolean isValid=validator.test(event.getValue());
      confirmButton.setEnabled(isValid);
      if (isValid) {
        inputBox.removeStyleName("String_Node_Str");
      }
 else {
        inputBox.addStyleName("String_Node_Str");
      }
    }
  }
);
  inputBox.addKeyPressHandler(new KeyPressHandler(){
    @Override public void onKeyPress(    KeyPressEvent event){
      TextBox box=(TextBox)event.getSource();
      confirmButton.setEnabled(validator.test(box.getText()));
    }
  }
);
  inputBox.addKeyDownHandler(new KeyDownHandler(){
    @Override public void onKeyDown(    KeyDownEvent event){
      if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
        boolean isValid=validator.test(inputBox.getText());
        if (isValid) {
          dialogBox.hide();
          callback.onSuccess(inputBox.getText());
        }
      }
 else {
        TextBox box=(TextBox)event.getSource();
        confirmButton.setEnabled(validator.test(box.getText()));
      }
    }
  }
);
  inputBox.addKeyUpHandler(new KeyUpHandler(){
    @Override public void onKeyUp(    KeyUpEvent event){
      if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
        boolean isValid=validator.test(inputBox.getText());
        if (isValid) {
          dialogBox.hide();
          callback.onSuccess(inputBox.getText());
        }
      }
 else {
        TextBox box=(TextBox)event.getSource();
        confirmButton.setEnabled(validator.test(box.getText()));
      }
    }
  }
);
  dialogBox.addStyleName("String_Node_Str");
  layout.addStyleName("String_Node_Str");
  inputBox.addStyleName("String_Node_Str");
  cancelButton.addStyleName("String_Node_Str");
  confirmButton.addStyleName("String_Node_Str");
  dialogBox.center();
  dialogBox.show();
  inputBox.setFocus(true);
}

Fixed version (ground truth):
public static void showPromptDialog(String title,String message,String value,String placeHolder,final RegExp validator,String cancelButtonText,String confirmButtonText,boolean mandatory,final AsyncCallback<String> callback){
  final DialogBox dialogBox=new DialogBox(false,true);
  dialogBox.setText(title);
  final FlowPanel layout=new FlowPanel();
  if (message != null) {
    final Label messageLabel=new Label(message);
    layout.add(messageLabel);
    messageLabel.addStyleName("String_Node_Str");
  }
  final TextBox inputBox=new TextBox();
  inputBox.setTitle("String_Node_Str");
  if (value != null) {
    inputBox.setText(value);
  }
  if (placeHolder != null) {
    inputBox.getElement().setPropertyString("String_Node_Str",placeHolder);
  }
  final Button cancelButton=new Button(cancelButtonText);
  final Button confirmButton=new Button(confirmButtonText);
  confirmButton.setEnabled(!mandatory);
  layout.add(inputBox);
  layout.add(cancelButton);
  layout.add(confirmButton);
  dialogBox.setWidget(layout);
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(false);
  cancelButton.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      dialogBox.hide();
      callback.onFailure(null);
    }
  }
);
  confirmButton.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      if (validator.test(inputBox.getText())) {
        dialogBox.hide();
        callback.onSuccess(inputBox.getText());
      }
    }
  }
);
  inputBox.addValueChangeHandler(new ValueChangeHandler<String>(){
    @Override public void onValueChange(    ValueChangeEvent<String> event){
      boolean isValid=validator.test(event.getValue());
      confirmButton.setEnabled(isValid);
      if (isValid) {
        inputBox.removeStyleName("String_Node_Str");
      }
 else {
        inputBox.addStyleName("String_Node_Str");
      }
    }
  }
);
  inputBox.addKeyPressHandler(new KeyPressHandler(){
    @Override public void onKeyPress(    KeyPressEvent event){
      TextBox box=(TextBox)event.getSource();
      confirmButton.setEnabled(validator.test(box.getText()));
    }
  }
);
  inputBox.addKeyDownHandler(new KeyDownHandler(){
    @Override public void onKeyDown(    KeyDownEvent event){
      TextBox box=(TextBox)event.getSource();
      confirmButton.setEnabled(validator.test(box.getText()));
    }
  }
);
  inputBox.addKeyUpHandler(new KeyUpHandler(){
    @Override public void onKeyUp(    KeyUpEvent event){
      if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
        if (validator.test(inputBox.getText())) {
          dialogBox.hide();
          callback.onSuccess(inputBox.getText());
        }
      }
 else {
        TextBox box=(TextBox)event.getSource();
        confirmButton.setEnabled(validator.test(box.getText()));
      }
    }
  }
);
  dialogBox.addStyleName("String_Node_Str");
  layout.addStyleName("String_Node_Str");
  inputBox.addStyleName("String_Node_Str");
  cancelButton.addStyleName("String_Node_Str");
  confirmButton.addStyleName("String_Node_Str");
  dialogBox.center();
  dialogBox.show();
  inputBox.setFocus(true);
}