Program: 178931
Project: 178931
Buggy source:
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection=HandlerUtil.getCurrentSelection(event);
  Object selectedObject=XWikiEclipseUtil.getSingleSelectedObjectInStructuredSelection(selection);
  if (selectedObject instanceof IXWikiConnection) {
    final IXWikiConnection xwikiConnection=(IXWikiConnection)selectedObject;
    try {
      String password=XWikiConnectionManager.getDefault().getPasswordForConnection(xwikiConnection.getId());
      if (password == null) {
        InputDialog inputDialog=new InputDialog(HandlerUtil.getActiveShell(event),"String_Node_Str",String.format("String_Node_Str",xwikiConnection.getUserName(),xwikiConnection.getServerUrl()),null,null);
        inputDialog.open();
        password=inputDialog.getValue();
      }
      final String actualPassword=password;
      XWikiEclipseUtil.runOperationWithProgress(new IRunnableWithProgress(){
        public void run(        IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
          monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
          try {
            xwikiConnection.connect(actualPassword);
          }
 catch (          XWikiConnectionException e) {
            e.printStackTrace();
            throw new InvocationTargetException(e,String.format("String_Node_Str",xwikiConnection.getServerUrl(),e.getMessage()));
          }
          monitor.done();
        }
      }
,HandlerUtil.getActiveShell(event));
    }
 catch (    InvocationTargetException e) {
      e.printStackTrace();
      MessageDialog.openError(HandlerUtil.getActiveShell(event),"String_Node_Str",e.getMessage());
    }
catch (    InterruptedException e) {
      e.printStackTrace();
    }
    HandlerUtil.getActiveSite(event).getSelectionProvider().setSelection(selection);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection=HandlerUtil.getCurrentSelection(event);
  Object selectedObject=XWikiEclipseUtil.getSingleSelectedObjectInStructuredSelection(selection);
  if (selectedObject instanceof IXWikiConnection) {
    final IXWikiConnection xwikiConnection=(IXWikiConnection)selectedObject;
    try {
      String password=XWikiConnectionManager.getDefault().getPasswordForConnection(xwikiConnection.getId());
      if (password == null) {
        InputDialog inputDialog=new InputDialog(HandlerUtil.getActiveShell(event),"String_Node_Str",String.format("String_Node_Str",xwikiConnection.getUserName(),xwikiConnection.getServerUrl()),null,null);
        inputDialog.open();
        password=inputDialog.getValue();
      }
      final String actualPassword=password;
      XWikiEclipseUtil.runOperationWithProgress(new IRunnableWithProgress(){
        public void run(        IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
          monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
          try {
            xwikiConnection.connect(actualPassword);
          }
 catch (          XWikiConnectionException e) {
            e.printStackTrace();
            throw new InvocationTargetException(e,String.format("String_Node_Str",xwikiConnection.getServerUrl(),e.getMessage()));
          }
          monitor.done();
        }
      }
,HandlerUtil.getActiveShell(event));
      XWikiEclipseUtil.closeReopenEditorsForConnection(HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(),xwikiConnection);
    }
 catch (    InvocationTargetException e) {
      e.printStackTrace();
      MessageDialog.openError(HandlerUtil.getActiveShell(event),"String_Node_Str",e.getMessage());
    }
catch (    InterruptedException e) {
      e.printStackTrace();
    }
    HandlerUtil.getActiveSite(event).getSelectionProvider().setSelection(selection);
  }
  return null;
}