Program: 47335
Project: 47335
Buggy source:
/** 
 * @param fileSummary
 */
public PermissionsPanel(RepositoryFile theFileSummary){
  this.fileSummary=theFileSummary;
  removeButton.setStylePrimaryName("String_Node_Str");
  addButton.setStylePrimaryName("String_Node_Str");
  usersAndRolesList.getElement().setId("String_Node_Str");
  addButton.getElement().setId("String_Node_Str");
  removeButton.getElement().setId("String_Node_Str");
  removeButton.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      if (usersAndRolesList.getItemCount() == 0) {
        return;
      }
      dirty=true;
      for (      final String userOrRoleString : SelectUserOrRoleDialog.getSelectedItemsValue(usersAndRolesList)) {
        String recipientType=getRecipientTypeByValue(userOrRoleString);
        String userOrRoleNameString=userOrRoleString.substring(0,userOrRoleString.length() - 6);
        removeRecipient(userOrRoleNameString,recipientType,fileInfo);
        usersAndRolesList.removeItem(usersAndRolesList.getSelectedIndex());
        existingUsersAndRoles.remove(userOrRoleNameString);
      }
    }
  }
);
  addButton.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      dirty=true;
      final SelectUserOrRoleDialog pickUserRoleDialog=new SelectUserOrRoleDialog(fileInfo,existingUsersAndRoles,new IUserRoleSelectedCallback(){
        public void roleSelected(        String role){
          usersAndRolesList.addItem(role,role + "String_Node_Str");
          existingUsersAndRoles.add(role);
          usersAndRolesList.setSelectedIndex(usersAndRolesList.getItemCount() - 1);
          addRecipient(role,ROLE_TYPE,fileInfo);
          buildPermissionsTable(fileInfo);
        }
        public void userSelected(        String user){
          usersAndRolesList.addItem(user,user + "String_Node_Str");
          existingUsersAndRoles.add(user);
          usersAndRolesList.setSelectedIndex(usersAndRolesList.getItemCount() - 1);
          addRecipient(user,USER_TYPE,fileInfo);
          buildPermissionsTable(fileInfo);
        }
      }
);
      pickUserRoleDialog.center();
    }
  }
);
  FlowPanel buttonPanel=new FlowPanel();
  buttonPanel.add(addButton);
  buttonPanel.add(removeButton);
  usersAndRolesList.setVisibleItemCount(7);
  usersAndRolesList.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      buildPermissionsTable(fileInfo);
    }
  }
);
  usersAndRolesList.setWidth("String_Node_Str");
  buttonPanel.setWidth("String_Node_Str");
  readPermissionCheckBox.getElement().setId("String_Node_Str");
  deletePermissionCheckBox.getElement().setId("String_Node_Str");
  writePermissionCheckBox.getElement().setId("String_Node_Str");
  managePermissionCheckBox.getElement().setId("String_Node_Str");
  readPermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      updatePermissionMask(fileInfo,readPermissionCheckBox.getValue(),PERM_READ);
      refreshPermission();
    }
  }
);
  deletePermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      setDeleteCheckBox(deletePermissionCheckBox.getValue());
      refreshPermission();
    }
  }
);
  writePermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      setWriteCheckBox(writePermissionCheckBox.getValue());
      refreshPermission();
    }
  }
);
  managePermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      setManageCheckBox(managePermissionCheckBox.getValue());
      refreshPermission();
    }
  }
);
  readPermissionCheckBox.setEnabled(false);
  inheritsCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      dirty=true;
      String moduleBaseURL=GWT.getModuleBaseURL();
      String moduleName=GWT.getModuleName();
      final String contextURL=moduleBaseURL.substring(0,moduleBaseURL.lastIndexOf(moduleName));
      if (inheritsCheckBox.getValue()) {
        VerticalPanel vp=new VerticalPanel();
        vp.add(new Label(Messages.getString("String_Node_Str")));
        final boolean currRemoveButtonState=removeButton.isEnabled();
        final boolean currAddButtonState=addButton.isEnabled();
        final PromptDialogBox permissionsOverwriteConfirm=new PromptDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),false,true,vp);
        final IDialogCallback callback=new IDialogCallback(){
          public void cancelPressed(){
            permissionsOverwriteConfirm.hide();
            inheritsCheckBox.setValue(false);
            dirty=false;
            setInheritsAcls(inheritsCheckBox.getValue(),fileInfo);
            addButton.setEnabled(currAddButtonState);
            removeButton.setEnabled(currRemoveButtonState);
          }
          public void okPressed(){
            String path=fileSummary.getPath().substring(0,fileSummary.getPath().lastIndexOf("String_Node_Str"));
            String url=contextURL + "String_Node_Str" + SolutionBrowserPanel.pathToId(path)+ "String_Node_Str";
            RequestBuilder builder=new RequestBuilder(RequestBuilder.GET,url);
            builder.setHeader("String_Node_Str","String_Node_Str");
            try {
              builder.sendRequest(null,new RequestCallback(){
                public void onResponseReceived(                Request request,                Response response){
                  if (response.getStatusCode() == Response.SC_OK) {
                    initializePermissionPanel(XMLParser.parse(response.getText()));
                    inheritsCheckBox.setValue(true);
                    refreshPermission();
                  }
 else {
                    inheritsCheckBox.setValue(false);
                    refreshPermission();
                    MessageDialogBox dialogBox=new MessageDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",response.getStatusText()),false,false,true);
                    dialogBox.center();
                  }
                }
                @Override public void onError(                Request request,                Throwable exception){
                  inheritsCheckBox.setValue(false);
                  refreshPermission();
                  MessageDialogBox dialogBox=new MessageDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",exception.getLocalizedMessage()),false,false,true);
                  dialogBox.center();
                }
              }
);
            }
 catch (            RequestException e) {
              inheritsCheckBox.setValue(false);
              refreshPermission();
              MessageDialogBox dialogBox=new MessageDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",e.getLocalizedMessage()),false,false,true);
              dialogBox.center();
            }
          }
        }
;
        permissionsOverwriteConfirm.setCallback(callback);
        permissionsOverwriteConfirm.center();
      }
      refreshPermission();
    }
  }
);
  int row=0;
  setWidget(row++,0,inheritsCheckBox);
  setWidget(row++,0,new Label(Messages.getString("String_Node_Str")));
  setWidget(row++,0,usersAndRolesList);
  CellFormatter buttonPanelCellFormatter=new CellFormatter();
  buttonPanelCellFormatter.setHorizontalAlignment(row,0,HasHorizontalAlignment.ALIGN_RIGHT);
  setCellFormatter(buttonPanelCellFormatter);
  setWidget(row++,0,buttonPanel);
  setWidget(row++,0,permissionsLabel);
  setWidget(row++,0,permissionsTable);
  setCellPadding(4);
  setWidth("String_Node_Str");
  permissionsTable.setWidget(0,0,managePermissionCheckBox);
  permissionsTable.setWidget(1,0,deletePermissionCheckBox);
  permissionsTable.setWidget(2,0,writePermissionCheckBox);
  permissionsTable.setWidget(3,0,readPermissionCheckBox);
  permissionsTable.setStyleName("String_Node_Str");
  permissionsTable.setWidth("String_Node_Str");
  permissionsTable.setHeight("String_Node_Str");
  init();
}

Fixed version (ground truth):
/** 
 * @param fileSummary
 */
public PermissionsPanel(RepositoryFile theFileSummary){
  this.fileSummary=theFileSummary;
  removeButton.setStylePrimaryName("String_Node_Str");
  addButton.setStylePrimaryName("String_Node_Str");
  usersAndRolesList.getElement().setId("String_Node_Str");
  addButton.getElement().setId("String_Node_Str");
  removeButton.getElement().setId("String_Node_Str");
  removeButton.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      if (usersAndRolesList.getItemCount() == 0) {
        return;
      }
      dirty=true;
      for (      final String userOrRoleString : SelectUserOrRoleDialog.getSelectedItemsValue(usersAndRolesList)) {
        String recipientType=getRecipientTypeByValue(userOrRoleString);
        String userOrRoleNameString=userOrRoleString.substring(0,userOrRoleString.length() - 6);
        removeRecipient(userOrRoleNameString,recipientType,fileInfo);
        usersAndRolesList.removeItem(usersAndRolesList.getSelectedIndex());
        existingUsersAndRoles.remove(userOrRoleNameString);
      }
      if (usersAndRolesList.getItemCount() > 0) {
        usersAndRolesList.setSelectedIndex(0);
      }
      buildPermissionsTable(fileInfo);
    }
  }
);
  addButton.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      dirty=true;
      final SelectUserOrRoleDialog pickUserRoleDialog=new SelectUserOrRoleDialog(fileInfo,existingUsersAndRoles,new IUserRoleSelectedCallback(){
        public void roleSelected(        String role){
          usersAndRolesList.addItem(role,role + "String_Node_Str");
          existingUsersAndRoles.add(role);
          usersAndRolesList.setSelectedIndex(usersAndRolesList.getItemCount() - 1);
          addRecipient(role,ROLE_TYPE,fileInfo);
          buildPermissionsTable(fileInfo);
        }
        public void userSelected(        String user){
          usersAndRolesList.addItem(user,user + "String_Node_Str");
          existingUsersAndRoles.add(user);
          usersAndRolesList.setSelectedIndex(usersAndRolesList.getItemCount() - 1);
          addRecipient(user,USER_TYPE,fileInfo);
          buildPermissionsTable(fileInfo);
        }
      }
);
      pickUserRoleDialog.center();
    }
  }
);
  FlowPanel buttonPanel=new FlowPanel();
  buttonPanel.add(addButton);
  buttonPanel.add(removeButton);
  usersAndRolesList.setVisibleItemCount(7);
  usersAndRolesList.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      buildPermissionsTable(fileInfo);
    }
  }
);
  usersAndRolesList.setWidth("String_Node_Str");
  buttonPanel.setWidth("String_Node_Str");
  readPermissionCheckBox.getElement().setId("String_Node_Str");
  deletePermissionCheckBox.getElement().setId("String_Node_Str");
  writePermissionCheckBox.getElement().setId("String_Node_Str");
  managePermissionCheckBox.getElement().setId("String_Node_Str");
  readPermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      updatePermissionMask(fileInfo,readPermissionCheckBox.getValue(),PERM_READ);
      refreshPermission();
    }
  }
);
  deletePermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      setDeleteCheckBox(deletePermissionCheckBox.getValue());
      refreshPermission();
    }
  }
);
  writePermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      setWriteCheckBox(writePermissionCheckBox.getValue());
      refreshPermission();
    }
  }
);
  managePermissionCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      setManageCheckBox(managePermissionCheckBox.getValue());
      refreshPermission();
    }
  }
);
  readPermissionCheckBox.setEnabled(false);
  inheritsCheckBox.addClickHandler(new ClickHandler(){
    public void onClick(    ClickEvent clickEvent){
      dirty=true;
      String moduleBaseURL=GWT.getModuleBaseURL();
      String moduleName=GWT.getModuleName();
      final String contextURL=moduleBaseURL.substring(0,moduleBaseURL.lastIndexOf(moduleName));
      if (inheritsCheckBox.getValue()) {
        VerticalPanel vp=new VerticalPanel();
        vp.add(new Label(Messages.getString("String_Node_Str")));
        final boolean currRemoveButtonState=removeButton.isEnabled();
        final boolean currAddButtonState=addButton.isEnabled();
        final PromptDialogBox permissionsOverwriteConfirm=new PromptDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),false,true,vp);
        final IDialogCallback callback=new IDialogCallback(){
          public void cancelPressed(){
            permissionsOverwriteConfirm.hide();
            inheritsCheckBox.setValue(false);
            dirty=false;
            setInheritsAcls(inheritsCheckBox.getValue(),fileInfo);
            addButton.setEnabled(currAddButtonState);
            removeButton.setEnabled(currRemoveButtonState);
          }
          public void okPressed(){
            String path=fileSummary.getPath().substring(0,fileSummary.getPath().lastIndexOf("String_Node_Str"));
            String url=contextURL + "String_Node_Str" + SolutionBrowserPanel.pathToId(path)+ "String_Node_Str";
            RequestBuilder builder=new RequestBuilder(RequestBuilder.GET,url);
            builder.setHeader("String_Node_Str","String_Node_Str");
            try {
              builder.sendRequest(null,new RequestCallback(){
                public void onResponseReceived(                Request request,                Response response){
                  if (response.getStatusCode() == Response.SC_OK) {
                    initializePermissionPanel(XMLParser.parse(response.getText()));
                    inheritsCheckBox.setValue(true);
                    refreshPermission();
                  }
 else {
                    inheritsCheckBox.setValue(false);
                    refreshPermission();
                    MessageDialogBox dialogBox=new MessageDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",response.getStatusText()),false,false,true);
                    dialogBox.center();
                  }
                }
                @Override public void onError(                Request request,                Throwable exception){
                  inheritsCheckBox.setValue(false);
                  refreshPermission();
                  MessageDialogBox dialogBox=new MessageDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",exception.getLocalizedMessage()),false,false,true);
                  dialogBox.center();
                }
              }
);
            }
 catch (            RequestException e) {
              inheritsCheckBox.setValue(false);
              refreshPermission();
              MessageDialogBox dialogBox=new MessageDialogBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str",e.getLocalizedMessage()),false,false,true);
              dialogBox.center();
            }
          }
        }
;
        permissionsOverwriteConfirm.setCallback(callback);
        permissionsOverwriteConfirm.center();
      }
      refreshPermission();
    }
  }
);
  int row=0;
  setWidget(row++,0,inheritsCheckBox);
  setWidget(row++,0,new Label(Messages.getString("String_Node_Str")));
  setWidget(row++,0,usersAndRolesList);
  CellFormatter buttonPanelCellFormatter=new CellFormatter();
  buttonPanelCellFormatter.setHorizontalAlignment(row,0,HasHorizontalAlignment.ALIGN_RIGHT);
  setCellFormatter(buttonPanelCellFormatter);
  setWidget(row++,0,buttonPanel);
  setWidget(row++,0,permissionsLabel);
  setWidget(row++,0,permissionsTable);
  setCellPadding(4);
  setWidth("String_Node_Str");
  permissionsTable.setWidget(0,0,managePermissionCheckBox);
  permissionsTable.setWidget(1,0,deletePermissionCheckBox);
  permissionsTable.setWidget(2,0,writePermissionCheckBox);
  permissionsTable.setWidget(3,0,readPermissionCheckBox);
  permissionsTable.setStyleName("String_Node_Str");
  permissionsTable.setWidth("String_Node_Str");
  permissionsTable.setHeight("String_Node_Str");
  init();
}