nus-yam/ex-repair huggingface dataset:
Program: 89104
Project: 89104
Buggy source:
/** 
 * Check how a document explicitly marked 'Unclassified' is presented. <p> <a href="https://issues.alfresco.com/jira/browse/RM-2279">RM-2279</a><pre> Given that a document has been marked as unclassified When I browse the document library Then no classification banner is shown for the document </pre>
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str",dependsOnGroups={"String_Node_Str"}) public void unclassifiedDocumentPresentation(){
  openPage(documentLibrary,COLLAB_SITE_ID);
  Document document=documentLibrary.getDocument(UNCLASSIFIED_DOCUMENT);
  try {
    document.getBannerText(ContentBanner.CLASSIFICATION);
    fail("String_Node_Str");
  }
 catch (  NoSuchElementException e) {
  }
}

Fixed version (ground truth):
/** 
 * Check how a document explicitly marked 'Unclassified' is presented. <p> <a href="https://issues.alfresco.com/jira/browse/RM-2279">RM-2279</a><pre> Given that a document has been marked as unclassified When I browse the document library Then no classification banner is shown for the document </pre>
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str",dependsOnGroups={"String_Node_Str"}) public void unclassifiedDocumentPresentation(){
  openPage(documentLibrary,COLLAB_SITE_ID);
  Document document=documentLibrary.getDocument(UNCLASSIFIED_DOCUMENT);
  try {
    document.getBannerText(ContentBanner.CLASSIFICATION);
    fail("String_Node_Str");
  }
 catch (  TimeoutException e) {
  }
}
Program: 89105
Project: 89105
Buggy source:
/** 
 * Reveal the user dropdown menu.
 * @return The user dropdown menu.
 * @throws IllegalStateException If the dropdown menu cannot be found.
 */
public UserDropdown revealDropdown(){
  try {
    WebElement dropdownButton=Utils.getWebDriver().findElement(HEADER_MENU_SELECTOR);
    dropdownButton.click();
  }
 catch (  NoSuchElementException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  waitForVisibilityOf(LOGOUT_SELECTOR);
  return this;
}

Fixed version (ground truth):
/** 
 * Reveal the user dropdown menu.
 * @return The user dropdown menu.
 * @throws IllegalStateException If the dropdown menu cannot be found.
 */
public UserDropdown revealDropdown(){
  try {
    WebElement dropdownButton=Utils.getWebDriver().findElement(HEADER_MENU_SELECTOR);
    dropdownButton.click();
  }
 catch (  NoSuchElementException e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  return this;
}
Program: 89106
Project: 89106
Buggy source:
public void logout(){
  WebElement logoutButton=Utils.getWebDriver().findElement(LOGOUT_SELECTOR);
  logoutButton.click();
}

Fixed version (ground truth):
public void logout(){
  WebElement logoutButton;
  int attempts=0;
  while (attempts < 3) {
    try {
      logoutButton=Utils.getWebDriver().findElement(LOGOUT_SELECTOR);
      if (logoutButton != null) {
        logoutButton.click();
        return;
      }
    }
 catch (    NoSuchElementException e) {
      Utils.getWebDriver().manage().timeouts().implicitlyWait(3,TimeUnit.SECONDS);
      revealDropdown();
      attempts=attempts + 1;
      if (attempts == 3) {
        fail("String_Node_Str");
      }
    }
  }
}
Program: 89107
Project: 89107
Buggy source:
/** 
 * WireMock config:
 */
@BeforeSuite public void setupWiremock(){
  if (wireMockEnabled) {
    try {
      WireMockServer wireMockServer=new WireMockServer(wireMockConfig().usingFilesUnderClasspath(WIREMOCK_PATH));
      wireMockServer.start();
      wireMockStarted=true;
    }
 catch (    FatalStartupException fatalStartupException) {
      Throwable exception=fatalStartupException;
      while (exception.getCause() != null) {
        exception=exception.getCause();
        if (exception instanceof BindException) {
          wireMockStarted=false;
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * WireMock config:
 */
@BeforeSuite public void setupWiremock(){
  if (wireMockEnabled) {
    try {
      WireMockServer wireMockServer=new WireMockServer(wireMockConfig().usingFilesUnderClasspath(WIREMOCK_PATH));
      wireMockServer.start();
      wireMockStarted=true;
    }
 catch (    FatalStartupException fatalStartupException) {
      Throwable exception=fatalStartupException;
      boolean rethrow=true;
      while (exception.getCause() != null) {
        exception=exception.getCause();
        if (exception instanceof BindException) {
          rethrow=false;
          break;
        }
      }
      if (rethrow) {
        throw fatalStartupException;
      }
    }
  }
}
Program: 89108
Project: 89108
Buggy source:
/** 
 * Click on (breadcrumb.size() - index) item on breadcrumb
 * @return - folder/category/file plan browse page
 * @param index - navigate index elements up
 */
public Renderable navigateUp(int index){
  List<WebElement> breadcrumb=webDriver.findElements(breadcrumbSelector);
  if (breadcrumb.size() - index < 0) {
    throw new RuntimeException("String_Node_Str");
  }
  WebElement parentLink=breadcrumb.get(breadcrumb.size() - index);
  parentLink.click();
  Utils.waitForStalenessOf(parentLink);
  return browsePage.render();
}

Fixed version (ground truth):
/** 
 * Click on (breadcrumb.size() - index) item on breadcrumb
 * @return - folder/category/file plan browse page
 * @param index - navigate index elements up
 */
public Renderable navigateUp(int index){
  List<WebElement> breadcrumb=webDriver.findElements(breadcrumbSelector);
  if (breadcrumb.size() - index < 0) {
    throw new RuntimeException("String_Node_Str");
  }
  WebElement parentLink=breadcrumb.get(breadcrumb.size() - index);
  parentLink.click();
  Utils.waitForStalenessOf(parentLink);
  Utils.waitForVisibilityOf(By.cssSelector("String_Node_Str"));
  return browsePage.render();
}
Program: 89110
Project: 89110
Buggy source:
/** 
 * Open this page, login to Share if required.
 * @param server        base server URL
 * @param userName      user name
 * @param password      password
 * @param context       context
 * @return {@link SharePage} rendered page
 */
public SharePage open(String server,String userName,String password,String... context){
  String url=server + getPageURL(context);
  String previousUser=currentLoggedInUser.get();
  if (previousUser != null && !userName.equals(previousUser)) {
    sharePageNavigation.openUserDropdownMenu().logout();
  }
  webDriver.get(url);
  if (webDriver.getTitle().contains("String_Node_Str")) {
    loginPage.render();
    loginPage.setUsername(userName).setPassword(password).clickOnLoginButton();
    currentLoggedInUser.set(userName);
  }
  return this.render();
}

Fixed version (ground truth):
/** 
 * Open this page, login to Share if required.
 * @param server        base server URL
 * @param userName      user name
 * @param password      password
 * @param context       context
 * @return {@link SharePage} rendered page
 */
public SharePage open(String server,String userName,String password,String... context){
  String url=server + getPageURL(context);
synchronized (CURRENT_LOGGED_IN_USER_LOCK) {
    if (currentLoggedInUser != null && !userName.equals(currentLoggedInUser)) {
      sharePageNavigation.openUserDropdownMenu().logout();
    }
    webDriver.get(url);
    if (webDriver.getTitle().contains("String_Node_Str")) {
      loginPage.render();
      loginPage.setUsername(userName).setPassword(password).clickOnLoginButton();
      currentLoggedInUser=userName;
    }
  }
  return this.render();
}
Program: 89111
Project: 89111
Buggy source:
/** 
 * Click on action
 */
private <T extends Renderable>T clickOnAction(String actionName,T renderable,boolean waitForActionStaleness){
  Link action=getActionLink(actionName);
  Utils.mouseOver(action);
  action.click();
  if (waitForActionStaleness == true) {
    waitForStalenessOf(action);
  }
  return renderable.render();
}

Fixed version (ground truth):
/** 
 * Click on action
 */
private <T extends Renderable>T clickOnAction(String actionName,T renderable,boolean waitForActionStaleness){
  Link action=getActionLink(actionName);
  Utils.mouseOver(action);
  action.click();
  if (waitForActionStaleness == true) {
    waitForStalenessOf(action);
  }
  if (renderable == null) {
    return null;
  }
  return renderable.render();
}
Program: 89112
Project: 89112
Buggy source:
/** 
 * Is action clickable 
 */
public boolean isActionClickable(String actionName){
  return getActionLink(actionName).isEnabled();
}

Fixed version (ground truth):
/** 
 * Is action clickable
 */
public boolean isActionClickable(String actionName){
  return getActionLink(actionName).isEnabled();
}
Program: 89113
Project: 89113
Buggy source:
/** 
 * Create a document that is locked for editing. 
 */
@Test(groups={"String_Node_Str","String_Node_Str"},description="String_Node_Str",dependsOnGroups={"String_Node_Str"}) public void createLockedDocument(){
  openPage(documentLibrary,COLLAB_SITE_ID);
  documentLibrary.getToolbar().clickOnFile().uploadFile(LOCKED_DOCUMENT);
  documentLibrary.getDocument(LOCKED_DOCUMENT).clickOnLink().getDocumentActionsPanel().clickOnAction(DocumentActions.EDIT_OFFLINE);
}

Fixed version (ground truth):
/** 
 * Create a document that is locked for editing. 
 */
@Test(groups={"String_Node_Str","String_Node_Str"},description="String_Node_Str",dependsOnGroups={"String_Node_Str"}) public void createLockedDocument(){
  openPage(documentLibrary,COLLAB_SITE_ID);
  documentLibrary.getToolbar().clickOnFile().uploadFile(LOCKED_DOCUMENT);
  documentLibrary.getDocument(LOCKED_DOCUMENT).clickOnLink().getDocumentActionsPanel().clickOnActionAndDontRender(DocumentActions.EDIT_OFFLINE);
  openPage(documentLibrary,COLLAB_SITE_ID);
}
Program: 89114
Project: 89114
Buggy source:
/** 
 * retry execution
 */
public abstract T execute();

Fixed version (ground truth):
/** 
 * retry execution
 */
T execute();
Program: 89115
Project: 89115
Buggy source:
/** 
 * Create temp file TODO .. support multiple mimetypes .. build files with real size content
 * @param name file name
 * @return {@link File} file
 */
public static File createTempFile(final String name){
  try {
    File file=File.createTempFile(name,"String_Node_Str");
    try (OutputStreamWriter writer=new OutputStreamWriter(new FileOutputStream(file),Charset.forName("String_Node_Str").newEncoder())){
      writer.write("String_Node_Str");
    }
     return file;
  }
 catch (  Exception exception) {
    throw new RuntimeException("String_Node_Str",exception);
  }
}

Fixed version (ground truth):
/** 
 * Create temp file TODO .. support multiple mimetypes .. build files with real size content
 * @param name file name
 * @return {@link File} file
 */
public static File createTempFile(final String name){
  try {
    final File file=File.createTempFile(name,"String_Node_Str");
    try (FileOutputStream fos=new FileOutputStream(file);OutputStreamWriter writer=new OutputStreamWriter(fos,Charset.forName("String_Node_Str").newEncoder())){
      writer.write("String_Node_Str");
    }
     return file;
  }
 catch (  Exception exception) {
    throw new RuntimeException("String_Node_Str",exception);
  }
}
Program: 89116
Project: 89116
Buggy source:
/** 
 * Helper method to retry, ignoring failures until success or all retries are used up
 * @param retry     retry execution
 * @param count     number of retries
 * @return T        result of retry execution
 */
public static final <T>T retry(Retry<T> retry,int count){
  T result;
  int attempt=0;
  while (true) {
    try {
      result=retry.execute();
      break;
    }
 catch (    Exception exception) {
      if (attempt >= count) {
        throw exception;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Helper method to retry the provided   {@link Retry code block}, ignoring failures until either the code block completes successfully or the maximum number of retries has been reached. are used up
 * @param < T >       the return type from the code block.
 * @param retry     a code block to execute.
 * @param count     maximum number of retries.
 * @return          result of the code block.
 */
public static final <T>T retry(Retry<T> retry,int count){
  int attempt=0;
  while (true) {
    try {
      return retry.execute();
    }
 catch (    Exception exception) {
      attempt++;
      if (attempt >= count) {
        throw exception;
      }
    }
  }
}
Program: 89117
Project: 89117
Buggy source:
/** 
 * Set the classification level.
 * @param levelId The label on the classification level dropdown button.
 * @return The dialog to allow chaining of actions.
 */
public ClassifyContentDialog setLevel(String levelId){
  levelSelectButton.click();
  String selector="String_Node_Str" + levelId + "String_Node_Str";
  WebElement level=Utils.retry(new Retry<WebElement>(){
    @Override public WebElement execute(){
      return levelsMenu.findElement(By.cssSelector(selector));
    }
  }
,5);
  level.click();
  return this;
}

Fixed version (ground truth):
/** 
 * Set the classification level.
 * @param levelId The label on the classification level dropdown button.
 * @return The dialog to allow chaining of actions.
 */
public ClassifyContentDialog setLevel(String levelId){
  levelSelectButton.click();
  final String selector="String_Node_Str" + levelId + "String_Node_Str";
  WebElement level=Utils.retry(new Retry<WebElement>(){
    @Override public WebElement execute(){
      return levelsMenu.findElement(By.cssSelector(selector));
    }
  }
,5);
  level.click();
  return this;
}
Program: 89118
Project: 89118
Buggy source:
/** 
 * Main test execution
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str",dependsOnGroups={"String_Node_Str"}) public void classifyRecord(){
  openPage(filePlan,RM_SITE_ID,"String_Node_Str").navigateTo(RECORD_CATEGORY_ONE,SUB_RECORD_CATEGORY_NAME,RECORD_FOLDER_ONE);
  assertTrue(filePlan.getRecord(RECORD).isActionClickable(RecordActions.CLASSIFY));
  filePlan.getRecord(RECORD).clickOnLink();
  assertTrue(recordDetails.getRecordActionsPanel().isActionClickable(RecordActionsPanel.CLASSIFY));
  recordDetails.navigateUp();
  Record nonElectronicRecord=filePlan.getRecord(NON_ELECTRONIC_RECORD);
  assertNotNull(nonElectronicRecord);
  assertTrue(recordDetails.getRecordActionsPanel().isActionClickable(RecordActions.CLASSIFY));
  nonElectronicRecord.clickOnLink();
  assertTrue(recordDetails.getRecordActionsPanel().isActionsClickable(RecordActionsPanel.CLASSIFY));
}

Fixed version (ground truth):
/** 
 * Main test execution
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str",dependsOnGroups={"String_Node_Str","String_Node_Str","String_Node_Str"}) public void classifyRecord(){
  openPage(filePlan,RM_SITE_ID,"String_Node_Str").navigateTo(RECORD_CATEGORY_ONE,SUB_RECORD_CATEGORY_NAME,RECORD_FOLDER_ONE);
  assertTrue(filePlan.getRecord(RECORD).isActionClickable(RecordActions.CLASSIFY));
  filePlan.getRecord(RECORD).clickOnLink();
  assertTrue(recordDetails.getRecordActionsPanel().isActionClickable(RecordActionsPanel.CLASSIFY));
  recordDetails.navigateUp();
  Record nonElectronicRecord=filePlan.getRecord(NON_ELECTRONIC_RECORD);
  assertNotNull(nonElectronicRecord);
  assertTrue(recordDetails.getRecordActionsPanel().isActionClickable(RecordActions.CLASSIFY));
  nonElectronicRecord.clickOnLink();
  assertTrue(recordDetails.getRecordActionsPanel().isActionsClickable(RecordActionsPanel.CLASSIFY));
}
Program: 89119
Project: 89119
Buggy source:
/** 
 * Regression test execution
 */
@Test(groups={"String_Node_Str","String_Node_Str"},description="String_Node_Str") public void createFilePlan(){
  openPage(userDashboardPage);
  if (!mySitesDashlet.siteExists(COLLAB_SITE_ID)) {
    mySitesDashlet.clickOnCreateSite().setSiteName(COLLAB_SITE_NAME).setSiteURL(COLLAB_SITE_ID).setSiteDescription(DESCRIPTION).clickOnOk();
  }
  siteDashboard.getNavigation().clickOnDocumentLibrary().getToolbar().clickOnFile().uploadFile(DOCUMENT);
}

Fixed version (ground truth):
/** 
 * Regression test execution
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str") public void createFilePlan(){
  openPage(userDashboardPage);
  if (!mySitesDashlet.siteExists(COLLAB_SITE_ID)) {
    mySitesDashlet.clickOnCreateSite().setSiteName(COLLAB_SITE_NAME).setSiteURL(COLLAB_SITE_ID).setSiteDescription(DESCRIPTION).clickOnOk();
  }
  siteDashboard.getNavigation().clickOnDocumentLibrary().getToolbar().clickOnFile().uploadFile(DOCUMENT);
}
Program: 89120
Project: 89120
Buggy source:
/** 
 * Regression test execution
 */
@Test(groups={"String_Node_Str","String_Node_Str"},description="String_Node_Str") public void createFilePlan(){
  openPage(userDashboardPage).getMySitesDashlet().clickOnRMSite(RM_SITE_ID).getNavigation().clickOnFilePlan();
  createCategoryAndClickOnLink(RECORD_CATEGORY_ONE,true);
  createCategoryAndClickOnLink(SUB_RECORD_CATEGORY_NAME,true);
  createRecordFolderAndClickOnLink(RECORD_FOLDER_TWO,false);
  createRecordFolderAndClickOnLink(RECORD_FOLDER_ONE,true);
  filePlan.getToolbar().clickOnFile().clickOnNonElectronic().setName(NON_ELECTRONIC_RECORD).setTitle(TITLE).clickOnSave();
  Record nonElectronicRecord=filePlan.getRecord(NON_ELECTRONIC_RECORD);
  assertNotNull(nonElectronicRecord);
  filePlan.getToolbar().clickOnFile().clickOnElectronic().uploadFile(RECORD);
  Record record=filePlan.getRecord(RECORD);
  assertNotNull(record);
  declareInplaceRecord();
  unfiledRecords.getToolbar().clickOnNewUnfiledRecordFolder().setName(UNFILED_RECORD_FOLDER).setTitle(TITLE).clickOnSave();
  UnfiledRecordFolder unfiledRecordFolder=unfiledRecords.getList().get(UNFILED_RECORD_FOLDER,UnfiledRecordFolder.class);
  assertNotNull(unfiledRecordFolder);
  unfiledRecords.getFilterPanel().clickOnHolds();
  createHold(HOLD1);
  createHold(HOLD2);
}

Fixed version (ground truth):
/** 
 * Integration test execution
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str") public void createFilePlan(){
  openPage(userDashboardPage).getMySitesDashlet().clickOnRMSite(RM_SITE_ID).getNavigation().clickOnFilePlan();
  createCategoryAndClickOnLink(RECORD_CATEGORY_ONE,true);
  createCategoryAndClickOnLink(SUB_RECORD_CATEGORY_NAME,true);
  createRecordFolderAndClickOnLink(RECORD_FOLDER_TWO,false);
  createRecordFolderAndClickOnLink(RECORD_FOLDER_ONE,true);
  filePlan.getToolbar().clickOnFile().clickOnNonElectronic().setName(NON_ELECTRONIC_RECORD).setTitle(TITLE).clickOnSave();
  Record nonElectronicRecord=filePlan.getRecord(NON_ELECTRONIC_RECORD);
  assertNotNull(nonElectronicRecord);
  filePlan.getToolbar().clickOnFile().clickOnElectronic().uploadFile(RECORD);
  Record record=filePlan.getRecord(RECORD);
  assertNotNull(record);
}
Program: 89121
Project: 89121
Buggy source:
/** 
 * Create RM site for Integration tests
 */
@Test(groups={"String_Node_Str","String_Node_Str"},description="String_Node_Str") public void createRMSite(){
  openPage(userDashboardPage);
  if (!mySitesDashlet.siteExists(RM_SITE_ID)) {
    mySitesDashlet.clickOnCreateSite().setSiteType(SiteType.RM_SITE).clickOnOk();
    openPage(userDashboardPage);
  }
  Assert.assertTrue(mySitesDashlet.siteExists(RM_SITE_ID));
  mySitesDashlet.clickOnRMSite(RM_SITE_ID);
}

Fixed version (ground truth):
/** 
 * Create RM site for Integration tests
 */
@Test(groups={"String_Node_Str"},description="String_Node_Str") public void createRMSite(){
  openPage(userDashboardPage);
  if (!mySitesDashlet.siteExists(RM_SITE_ID)) {
    mySitesDashlet.clickOnCreateSite().setSiteType(SiteType.RM_SITE).clickOnOk();
    openPage(userDashboardPage);
  }
  Assert.assertTrue(mySitesDashlet.siteExists(RM_SITE_ID));
  mySitesDashlet.clickOnRMSite(RM_SITE_ID);
}
Program: 89122
Project: 89122
Buggy source:
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#deleteHold(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override public void deleteHold(final NodeRef hold){
  ParameterCheck.mandatory("String_Node_Str",hold);
  if (!isHold(hold)) {
    throw new AlfrescoRuntimeException("String_Node_Str" + hold.toString() + "String_Node_Str");
  }
  List<NodeRef> held=AuthenticationUtil.runAsSystem(new RunAsWork<List<NodeRef>>(){
    @Override public List<NodeRef> doWork(){
      return getHeld(hold);
    }
  }
);
  List<String> heldNames=new ArrayList<String>();
  for (  NodeRef nodeRef : held) {
    try {
      if (permissionService.hasPermission(nodeRef,RMPermissionModel.FILING) == AccessStatus.DENIED) {
        heldNames.add((String)nodeService.getProperty(nodeRef,ContentModel.PROP_NAME));
      }
    }
 catch (    AccessDeniedException ade) {
      throw new AlfrescoRuntimeException("String_Node_Str");
    }
  }
  if (heldNames.size() > 0) {
    StringBuilder sb=new StringBuilder();
    for (    String name : heldNames) {
      sb.append("String_Node_Str");
      sb.append("String_Node_Str");
      sb.append(name);
      sb.append("String_Node_Str");
    }
    throw new AlfrescoRuntimeException("String_Node_Str" + sb.toString());
  }
  nodeService.deleteNode(hold);
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#deleteHold(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override public void deleteHold(final NodeRef hold){
  ParameterCheck.mandatory("String_Node_Str",hold);
  if (!isHold(hold)) {
    throw new AlfrescoRuntimeException("String_Node_Str" + hold.toString() + "String_Node_Str");
  }
  List<NodeRef> held=AuthenticationUtil.runAsSystem(new RunAsWork<List<NodeRef>>(){
    @Override public List<NodeRef> doWork(){
      return getHeld(hold);
    }
  }
);
  List<String> heldNames=new ArrayList<String>();
  for (  NodeRef nodeRef : held) {
    try {
      if (permissionService.hasPermission(nodeRef,RMPermissionModel.FILING) == AccessStatus.DENIED) {
        heldNames.add((String)nodeService.getProperty(nodeRef,ContentModel.PROP_NAME));
      }
    }
 catch (    AccessDeniedException ade) {
      throw new AlfrescoRuntimeException("String_Node_Str",ade);
    }
  }
  if (heldNames.size() > 0) {
    StringBuilder sb=new StringBuilder();
    for (    String name : heldNames) {
      sb.append("String_Node_Str");
      sb.append("String_Node_Str");
      sb.append(name);
      sb.append("String_Node_Str");
    }
    throw new AlfrescoRuntimeException("String_Node_Str" + sb.toString());
  }
  nodeService.deleteNode(hold);
}
Program: 89123
Project: 89123
Buggy source:
/** 
 * Puts the given key and value to the json object
 * @param jsonObject The json object
 * @param key The key
 * @param value The value
 */
public static void putValuetoJSONObject(JSONObject jsonObject,String key,Object value){
  mandatory("String_Node_Str",jsonObject);
  mandatoryString("String_Node_Str",key);
  mandatory("String_Node_Str",value);
  try {
    jsonObject.put(key,value);
  }
 catch (  JSONException error) {
    throw new WebScriptException(Status.STATUS_BAD_REQUEST,"String_Node_Str" + key + "String_Node_Str"+ value+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Puts the given key and value to the json object
 * @param jsonObject The json object
 * @param key The key
 * @param value The value
 */
public static void putValuetoJSONObject(JSONObject jsonObject,String key,Object value){
  mandatory("String_Node_Str",jsonObject);
  mandatoryString("String_Node_Str",key);
  mandatory("String_Node_Str",value);
  try {
    jsonObject.put(key,value);
  }
 catch (  JSONException error) {
    throw new WebScriptException(Status.STATUS_BAD_REQUEST,"String_Node_Str" + key + "String_Node_Str"+ value+ "String_Node_Str",error);
  }
}
Program: 89124
Project: 89124
Buggy source:
/** 
 * Helper method that indicates whether a property is considered record metadata or not.
 * @param property  property
 * @return boolea   true if record metadata, false otherwise
 */
private boolean isRecordMetadata(NodeRef filePlan,QName property){
  boolean result=false;
  ClassDefinition parent=null;
  PropertyDefinition def=dictionaryService.getProperty(property);
  if (def != null) {
    parent=def.getContainerClass();
  }
  if (parent != null && TYPE_NON_ELECTRONIC_DOCUMENT.equals(parent.getName())) {
    result=false;
  }
 else {
    result=ArrayUtils.contains(RECORD_MODEL_URIS,property.getNamespaceURI());
    if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS,property.getNamespaceURI())) {
      if (parent != null && parent.isAspect()) {
        result=getRecordMetadataAspects(filePlan).contains(parent.getName());
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Helper method that indicates whether a property is considered record metadata or not.
 * @param property  property
 * @return boolea   true if record metadata, false otherwise
 */
private boolean isRecordMetadata(NodeRef filePlan,QName property){
  boolean result=false;
  ClassDefinition parent=null;
  PropertyDefinition def=dictionaryService.getProperty(property);
  if (def != null) {
    parent=def.getContainerClass();
  }
  if (parent != null && TYPE_NON_ELECTRONIC_DOCUMENT.equals(parent.getName())) {
    result=false;
  }
 else {
    result=RECORD_MODEL_URIS.contains(property.getNamespaceURI());
    if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS,property.getNamespaceURI())) {
      if (parent != null && parent.isAspect()) {
        result=getRecordMetadataAspects(filePlan).contains(parent.getName());
      }
    }
  }
  return result;
}
Program: 89125
Project: 89125
Buggy source:
/** 
 * Process properties map before returning as frozen state.
 * @param properties                                        properties map
 * @return {@link Map}<  {@link QName},   {@link Serializable}> processed property map
 */
protected Map<QName,Serializable> processProperties(NodeRef version,Map<QName,Serializable> properties){
  Map<QName,Serializable> cloneProperties=new HashMap<QName,Serializable>(properties);
  properties.put(ContentModel.PROP_NAME,properties.get(RecordsManagementModel.PROP_ORIGIONAL_NAME));
  for (  QName property : cloneProperties.keySet()) {
    if (!PROP_RECORDABLE_VERSION_POLICY.equals(property) && !PROP_FILE_PLAN.equals(property) && (recordService.isRecordMetadataProperty(property) || ArrayUtils.contains(RecordServiceImpl.RECORD_MODEL_URIS,property.getNamespaceURI()))) {
      properties.remove(property);
    }
  }
  processVersionProperties(version,properties);
  return properties;
}

Fixed version (ground truth):
/** 
 * Process properties map before returning as frozen state.
 * @param properties                                        properties map
 * @return {@link Map}<  {@link QName},   {@link Serializable}> processed property map
 */
protected Map<QName,Serializable> processProperties(NodeRef version,Map<QName,Serializable> properties){
  Map<QName,Serializable> cloneProperties=new HashMap<QName,Serializable>(properties);
  properties.put(ContentModel.PROP_NAME,properties.get(RecordsManagementModel.PROP_ORIGIONAL_NAME));
  for (  QName property : cloneProperties.keySet()) {
    if (!PROP_RECORDABLE_VERSION_POLICY.equals(property) && !PROP_FILE_PLAN.equals(property) && (recordService.isRecordMetadataProperty(property) || RECORD_MODEL_URIS.contains(property.getNamespaceURI()))) {
      properties.remove(property);
    }
  }
  processVersionProperties(version,properties);
  return properties;
}
Program: 89126
Project: 89126
Buggy source:
/** 
 * Process frozen aspects.
 * @param aspects                       aspect set
 * @return {@link Set}<  {@link QName}>   processed aspect set
 */
protected Set<QName> processAspects(Set<QName> aspects){
  Set<QName> result=new HashSet<QName>(aspects);
  result.remove(ASPECT_VERSION);
  result.remove(ASPECT_RECORDED_VERSION);
  for (  QName aspect : aspects) {
    if (!ASPECT_VERSIONABLE.equals(aspect) && (recordService.isRecordMetadataAspect(aspect) || ArrayUtils.contains(RecordServiceImpl.RECORD_MODEL_URIS,aspect.getNamespaceURI()))) {
      result.remove(aspect);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Process frozen aspects.
 * @param aspects                       aspect set
 * @return {@link Set}<  {@link QName}>   processed aspect set
 */
protected Set<QName> processAspects(Set<QName> aspects){
  Set<QName> result=new HashSet<QName>(aspects);
  result.remove(ASPECT_VERSION);
  result.remove(ASPECT_RECORDED_VERSION);
  for (  QName aspect : aspects) {
    if (!ASPECT_VERSIONABLE.equals(aspect) && (recordService.isRecordMetadataAspect(aspect) || RECORD_MODEL_URIS.contains(aspect.getNamespaceURI()))) {
      result.remove(aspect);
    }
  }
  return result;
}
Program: 89128
Project: 89128
Buggy source:
public Object doWork(){
  RetryingTransactionCallback<Void> callback=new RetryingTransactionCallback<Void>(){
    public Void execute() throws Throwable {
      nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER,ContentModel.PROP_DESCRIPTION,"String_Node_Str");
      List<FileInfo> oldBehaviorScripts=fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER);
      if (oldBehaviorScripts != null && !oldBehaviorScripts.isEmpty()) {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("String_Node_Str");
        }
        for (        FileInfo script : oldBehaviorScripts) {
          fileFolderService.moveFrom(script.getNodeRef(),OLD_BEHAVIOR_SCRIPTS_FOLDER,RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder,script.getName());
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("String_Node_Str" + script.getName());
          }
        }
      }
      return null;
    }
  }
;
  retryingTransactionHelper.doInTransaction(callback);
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object doWork(){
  RetryingTransactionCallback<Void> callback=new RetryingTransactionCallback<Void>(){
    public Void execute() throws Throwable {
      nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER,ContentModel.PROP_DESCRIPTION,"String_Node_Str");
      List<FileInfo> oldBehaviorScripts=fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER);
      if (oldBehaviorScripts != null && !oldBehaviorScripts.isEmpty()) {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("String_Node_Str");
        }
        for (        FileInfo script : oldBehaviorScripts) {
          fileFolderService.moveFrom(script.getNodeRef(),OLD_BEHAVIOR_SCRIPTS_FOLDER,RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder,script.getName());
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("String_Node_Str" + script.getName());
          }
        }
      }
      return null;
    }
  }
;
  retryingTransactionHelper.doInTransaction(callback);
  return null;
}
Program: 89129
Project: 89129
Buggy source:
/** 
 * Set the namespace service
 */
public void setTransactionService(TransactionService transactionService){
  this.transactionService=transactionService;
}

Fixed version (ground truth):
/** 
 * Set the transaction service
 */
public void setTransactionService(TransactionService transactionService){
  this.transactionService=transactionService;
}
Program: 89130
Project: 89130
Buggy source:
/** 
 * @return  records management admin service
 */
public RecordsManagementAdminService getRecordsManagementAdminService(){
  return recordsManagementAdminService;
}

Fixed version (ground truth):
/** 
 * @return  records management admin service
 */
protected RecordsManagementAdminService getRecordsManagementAdminService(){
  return recordsManagementAdminService;
}
Program: 89131
Project: 89131
Buggy source:
/** 
 * Gets the node reference of the custom model
 * @param uri The URI of the model namespace
 * @return The node reference of the custom model
 */
protected NodeRef getCustomModelRef(String uri){
  if ((uri.equals("String_Node_Str")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI))) {
    return RM_CUSTOM_MODEL_NODE_REF;
  }
 else {
    List<NodeRef> modelRefs=getDictionaryRepositoryBootstrap().getModelRefs();
    for (    NodeRef modelRef : modelRefs) {
      try {
        M2Model model=readCustomContentModel(modelRef);
        for (        M2Namespace namespace : model.getNamespaces()) {
          if (namespace.getUri().equals(uri)) {
            return modelRef;
          }
        }
      }
 catch (      DictionaryException de) {
        logger.warn("String_Node_Str" + modelRef + "String_Node_Str"+ uri+ "String_Node_Str"+ de);
      }
    }
    throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND,uri));
  }
}

Fixed version (ground truth):
/** 
 * Gets the node reference of the custom model
 * @param uri The URI of the model namespace
 * @return The node reference of the custom model
 */
protected NodeRef getCustomModelRef(String uri){
  if ((uri.equals("String_Node_Str")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI))) {
    return RM_CUSTOM_MODEL_NODE_REF;
  }
 else {
    List<NodeRef> modelRefs=getDictionaryRepositoryBootstrap().getModelRefs();
    for (    NodeRef modelRef : modelRefs) {
      try {
        M2Model model=readCustomContentModel(modelRef);
        for (        M2Namespace namespace : model.getNamespaces()) {
          if (namespace.getUri().equals(uri)) {
            return modelRef;
          }
        }
      }
 catch (      DictionaryException de) {
        logger.warn("String_Node_Str" + modelRef + "String_Node_Str"+ uri+ "String_Node_Str",de);
      }
    }
    throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND,uri));
  }
}
Program: 89133
Project: 89133
Buggy source:
/** 
 * Helper to check that the current version is recorded
 */
protected void checkRecordedVersion(NodeRef document,String description,String versionLabel){
  assertFalse(recordService.isRecord(document));
  Map<QName,Serializable> beforeProperties=nodeService.getProperties(document);
  Set<QName> beforeAspects=nodeService.getAspects(dmDocument);
  Version version=versionService.getCurrentVersion(document);
  assertNotNull(version);
  assertEquals(description,version.getDescription());
  assertEquals(versionLabel,version.getVersionLabel());
  NodeRef frozen=version.getFrozenStateNodeRef();
  checkProperties(frozen,beforeProperties);
  checkAspects(frozen,beforeAspects);
  NodeRef record=(NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD);
  assertNotNull(record);
  assertTrue(nodeService.hasAspect(record,ASPECT_VERSION_RECORD));
  assertEquals(versionLabel,nodeService.getProperty(record,RecordableVersionModel.PROP_VERSION_LABEL));
  assertEquals(description,nodeService.getProperty(record,RecordableVersionModel.PROP_VERSION_DESCRIPTION));
  assertTrue(recordService.isRecord(record));
  assertFalse(recordService.isFiled(record));
  assertFalse(nodeService.hasAspect(record,ContentModel.ASPECT_VERSIONABLE));
  assertFalse(nodeService.hasAspect(record,RecordableVersionModel.ASPECT_VERSIONABLE));
  VersionHistory versionHistory=versionService.getVersionHistory(document);
  assertNotNull(versionHistory);
  Version headVersion=versionHistory.getHeadVersion();
  assertNotNull(headVersion);
}

Fixed version (ground truth):
/** 
 * Helper to check that the current version is recorded
 */
protected void checkRecordedVersion(NodeRef document,String description,String versionLabel){
  assertFalse(recordService.isRecord(document));
  Map<QName,Serializable> beforeProperties=nodeService.getProperties(document);
  Set<QName> beforeAspects=nodeService.getAspects(dmDocument);
  Version version=versionService.getCurrentVersion(document);
  assertNotNull(version);
  assertEquals(description,version.getDescription());
  assertEquals(versionLabel,version.getVersionLabel());
  NodeRef frozen=version.getFrozenStateNodeRef();
  checkProperties(frozen,beforeProperties);
  checkAspects(frozen,beforeAspects);
  NodeRef record=(NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD);
  assertNotNull(record);
  assertTrue(nodeService.hasAspect(record,ASPECT_VERSION_RECORD));
  assertEquals(versionLabel,nodeService.getProperty(record,RecordableVersionModel.PROP_VERSION_LABEL));
  assertEquals(description,nodeService.getProperty(record,RecordableVersionModel.PROP_VERSION_DESCRIPTION));
  assertTrue(recordService.isRecord(record));
  assertFalse(recordService.isFiled(record));
  assertFalse(nodeService.hasAspect(record,RecordableVersionModel.ASPECT_VERSIONABLE));
  VersionHistory versionHistory=versionService.getVersionHistory(document);
  assertNotNull(versionHistory);
  Version headVersion=versionHistory.getHeadVersion();
  assertNotNull(headVersion);
}
Program: 89134
Project: 89134
Buggy source:
/** 
 * Helper method to get the service registry in order to call services
 * @return Returns the service registry
 */
public static ServiceRegistry getServiceRegistry(){
  ProcessEngineConfigurationImpl config=Context.getProcessEngineConfiguration();
  if (config != null) {
    ServiceRegistry registry=(ServiceRegistry)config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
    if (registry == null) {
      throw new RuntimeException("String_Node_Str" + ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
    }
    return registry;
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Helper method to get the service registry in order to call services
 * @return Returns the service registry
 */
public static ServiceRegistry getServiceRegistry(){
  ProcessEngineConfigurationImpl config=Context.getProcessEngineConfiguration();
  if (config != null) {
    ServiceRegistry registry=(ServiceRegistry)config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
    if (registry == null) {
      throw new AlfrescoRuntimeException("String_Node_Str" + ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
    }
    return registry;
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 89135
Project: 89135
Buggy source:
/** 
 * @see org.alfresco.repo.security.permissions.DynamicAuthority#hasAuthority(org.alfresco.service.cmr.repository.NodeRef,java.lang.String)
 */
@Override public boolean hasAuthority(NodeRef nodeRef,String userName){
  boolean result=false;
  Map<Pair<NodeRef,String>,Boolean> transactionCache=TransactionalResourceHelper.getMap(getTransactionCacheName());
  Pair<NodeRef,String> key=new Pair<NodeRef,String>(nodeRef,userName);
  if (transactionCache.containsKey(key)) {
    result=transactionCache.get(key);
  }
 else {
    if (getNodeService().hasAspect(nodeRef,ASPECT_EXTENDED_SECURITY) == true) {
      Set<String> authorities=getAuthorites(nodeRef);
      if (authorities != null) {
        if (authorities.contains("String_Node_Str") || authorities.contains(userName)) {
          result=true;
        }
 else {
          Set<String> contained=getAuthorityService().getAuthoritiesForUser(userName);
          authorities.retainAll(contained);
          result=(authorities.size() != 0);
        }
      }
    }
    transactionCache.put(key,result);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.repo.security.permissions.DynamicAuthority#hasAuthority(org.alfresco.service.cmr.repository.NodeRef,java.lang.String)
 */
@Override public boolean hasAuthority(NodeRef nodeRef,String userName){
  boolean result=false;
  Map<Pair<NodeRef,String>,Boolean> transactionCache=TransactionalResourceHelper.getMap(getTransactionCacheName());
  Pair<NodeRef,String> key=new Pair<NodeRef,String>(nodeRef,userName);
  if (transactionCache.containsKey(key)) {
    result=transactionCache.get(key);
  }
 else {
    if (getNodeService().hasAspect(nodeRef,ASPECT_EXTENDED_SECURITY)) {
      Set<String> authorities=getAuthorites(nodeRef);
      if (authorities != null) {
        if (authorities.contains("String_Node_Str") || authorities.contains(userName)) {
          result=true;
        }
 else {
          Set<String> contained=getAuthorityService().getAuthoritiesForUser(userName);
          authorities.retainAll(contained);
          result=(authorities.size() != 0);
        }
      }
    }
    transactionCache.put(key,result);
  }
  return result;
}
Program: 89137
Project: 89137
Buggy source:
/** 
 * Override to deal with the possibility of hard coded permission checks in core code. Note:  Eventually we need to merge the RM permission model into the core to make this more rebust.
 * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef,java.lang.String)
 */
@Override public AccessStatus hasPermission(NodeRef nodeRef,String perm){
  AccessStatus acs=super.hasPermission(nodeRef,perm);
  if (AccessStatus.DENIED.equals(acs) == true && PermissionService.READ.equals(perm) == true && nodeService.hasAspect(nodeRef,RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true) {
    return super.hasPermission(nodeRef,RMPermissionModel.READ_RECORDS);
  }
 else   if (AccessStatus.DENIED.equals(acs) == true && PermissionService.WRITE.equals(perm) == true && nodeService.hasAspect(nodeRef,RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true) {
    return super.hasPermission(nodeRef,RMPermissionModel.FILE_RECORDS);
  }
  return acs;
}

Fixed version (ground truth):
/** 
 * Override to deal with the possibility of hard coded permission checks in core code. Note:  Eventually we need to merge the RM permission model into the core to make this more rebust.
 * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef,java.lang.String)
 */
@Override public AccessStatus hasPermission(NodeRef nodeRef,String perm){
  AccessStatus acs=super.hasPermission(nodeRef,perm);
  if (AccessStatus.DENIED.equals(acs) && PermissionService.READ.equals(perm) && nodeService.hasAspect(nodeRef,RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) {
    return super.hasPermission(nodeRef,RMPermissionModel.READ_RECORDS);
  }
 else   if (AccessStatus.DENIED.equals(acs) && PermissionService.WRITE.equals(perm) && nodeService.hasAspect(nodeRef,RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) {
    return super.hasPermission(nodeRef,RMPermissionModel.FILE_RECORDS);
  }
  return acs;
}
Program: 89138
Project: 89138
Buggy source:
/** 
 * Helper method to build JSON content to send to hold webscripts.
 */
protected String buildContent(List<NodeRef> nodeRefs,List<NodeRef> holds){
  StringBuilder builder=new StringBuilder(255);
  builder.append("String_Node_Str");
  if (nodeRefs != null) {
    builder.append("String_Node_Str");
    boolean bFirst=true;
    for (    NodeRef nodeRef : nodeRefs) {
      if (bFirst == false) {
        builder.append("String_Node_Str");
      }
 else {
        bFirst=false;
      }
      builder.append("String_Node_Str" + nodeRef.toString() + "String_Node_Str");
    }
    builder.append("String_Node_Str");
  }
  if (nodeRefs != null && holds != null) {
    builder.append("String_Node_Str");
  }
  if (holds != null) {
    builder.append("String_Node_Str");
    boolean bFirst=true;
    for (    NodeRef hold : holds) {
      if (bFirst == false) {
        builder.append("String_Node_Str");
      }
 else {
        bFirst=false;
      }
      builder.append("String_Node_Str" + hold.toString() + "String_Node_Str");
    }
    builder.append("String_Node_Str");
  }
  builder.append("String_Node_Str");
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * Helper method to build JSON content to send to hold webscripts.
 */
protected String buildContent(List<NodeRef> nodeRefs,List<NodeRef> holds){
  StringBuilder builder=new StringBuilder(255);
  builder.append("String_Node_Str");
  if (nodeRefs != null) {
    builder.append("String_Node_Str");
    boolean bFirst=true;
    for (    NodeRef nodeRef : nodeRefs) {
      if (!bFirst) {
        builder.append("String_Node_Str");
      }
 else {
        bFirst=false;
      }
      builder.append("String_Node_Str" + nodeRef.toString() + "String_Node_Str");
    }
    builder.append("String_Node_Str");
  }
  if (nodeRefs != null && holds != null) {
    builder.append("String_Node_Str");
  }
  if (holds != null) {
    builder.append("String_Node_Str");
    boolean bFirst=true;
    for (    NodeRef hold : holds) {
      if (!bFirst) {
        builder.append("String_Node_Str");
      }
 else {
        bFirst=false;
      }
      builder.append("String_Node_Str" + hold.toString() + "String_Node_Str");
    }
    builder.append("String_Node_Str");
  }
  builder.append("String_Node_Str");
  return builder.toString();
}
Program: 89139
Project: 89139
Buggy source:
/** 
 * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setInheritParentPermissions(org.alfresco.service.cmr.repository.NodeRef,boolean)
 */
@Override public void setInheritParentPermissions(final NodeRef nodeRef,boolean inheritParentPermissions){
  final String adminRole=getAdminRole(nodeRef);
  if (nodeService.hasAspect(nodeRef,RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && isNotBlank(adminRole)) {
    if (inheritParentPermissions) {
      Set<AccessPermission> accessPermissions=getAllSetPermissions(nodeRef);
      for (      AccessPermission accessPermission : accessPermissions) {
        String authority=accessPermission.getAuthority();
        String permission=accessPermission.getPermission();
        if (accessPermission.isSetDirectly() && (RMPermissionModel.FILING.equals(permission) || RMPermissionModel.READ_RECORDS.equals(permission)) && (ExtendedReaderDynamicAuthority.EXTENDED_READER.equals(authority) || ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(authority)) || adminRole.equals(authority)) {
        }
      }
    }
 else {
      setPermission(nodeRef,ExtendedReaderDynamicAuthority.EXTENDED_READER,RMPermissionModel.READ_RECORDS,true);
      setPermission(nodeRef,ExtendedWriterDynamicAuthority.EXTENDED_WRITER,RMPermissionModel.FILING,true);
      setPermission(nodeRef,adminRole,RMPermissionModel.FILING,true);
    }
  }
  super.setInheritParentPermissions(nodeRef,inheritParentPermissions);
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setInheritParentPermissions(org.alfresco.service.cmr.repository.NodeRef,boolean)
 */
@Override public void setInheritParentPermissions(final NodeRef nodeRef,boolean inheritParentPermissions){
  final String adminRole=getAdminRole(nodeRef);
  if (nodeService.hasAspect(nodeRef,RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && isNotBlank(adminRole) && !inheritParentPermissions) {
    setPermission(nodeRef,ExtendedReaderDynamicAuthority.EXTENDED_READER,RMPermissionModel.READ_RECORDS,true);
    setPermission(nodeRef,ExtendedWriterDynamicAuthority.EXTENDED_WRITER,RMPermissionModel.FILING,true);
    setPermission(nodeRef,adminRole,RMPermissionModel.FILING,true);
  }
  super.setInheritParentPermissions(nodeRef,inheritParentPermissions);
}
Program: 89140
Project: 89140
Buggy source:
/** 
 * Gets the relationship type from the association definition
 * @param associationDefinition The association definition
 * @return The type of the relationship definition
 */
private RelationshipType getRelationshipType(AssociationDefinition associationDefinition){
  RelationshipType type;
  if (associationDefinition instanceof ChildAssociationDefinition) {
    type=RelationshipType.PARENTCHILD;
  }
 else   if (associationDefinition instanceof AssociationDefinition) {
    type=RelationshipType.BIDIRECTIONAL;
  }
 else {
    StringBuilder sb=new StringBuilder();
    sb.append("String_Node_Str").append(associationDefinition.getName().getLocalName()).append("String_Node_Str");
    throw new AlfrescoRuntimeException(sb.toString());
  }
  return type;
}

Fixed version (ground truth):
/** 
 * Gets the relationship type from the association definition
 * @param associationDefinition The association definition
 * @return The type of the relationship definition
 */
private RelationshipType getRelationshipType(AssociationDefinition associationDefinition){
  RelationshipType type;
  if (associationDefinition instanceof ChildAssociationDefinition) {
    type=RelationshipType.PARENTCHILD;
  }
 else {
    type=RelationshipType.BIDIRECTIONAL;
  }
  return type;
}