nus-yam/ex-repair huggingface dataset:
Program: 188641
Project: 188641
Buggy source:
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  buttonApply.setEnabled(false);
  String idText=id.getText();
  String typeText=selectedBundle.getType();
  String typeVersion=selectedBundle.getVersion();
  String xmlText=metadataXML.getText();
  boolean hasOverridenTheForm=inXML && !xmlText.equals(metadataTextFromForm);
  if (idText.length() > 0) {
    Set<MetadataValue> values=null;
    if (!hasOverridenTheForm) {
      values=selectedBundle.getValues();
    }
    DescriptiveMetadataEditBundle newBundle=new DescriptiveMetadataEditBundle(idText,typeText,typeVersion,xmlText,selectedBundle.getTemplate(),values,true);
    BrowserService.Util.getInstance().createDescriptiveMetadataFile(aipId,newBundle,new AsyncCallback<Void>(){
      @Override public void onFailure(      Throwable caught){
        if (caught instanceof ValidationException) {
          ValidationException e=(ValidationException)caught;
          updateErrors(e);
        }
 else {
          AsyncCallbackUtils.defaultFailureTreatment(caught);
        }
        buttonApply.setEnabled(true);
      }
      @Override public void onSuccess(      Void result){
        errors.setText("String_Node_Str");
        errors.setVisible(false);
        Toast.showInfo(messages.dialogSuccess(),messages.metadataFileCreated());
        Tools.newHistory(Browse.RESOLVER,aipId);
      }
    }
);
  }
 else {
    Toast.showError("String_Node_Str");
    buttonApply.setEnabled(true);
  }
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  buttonApply.setEnabled(false);
  String idText=id.getText();
  String typeText=selectedBundle != null ? selectedBundle.getType() : messages.otherItem();
  String typeVersion=selectedBundle != null ? selectedBundle.getVersion() : "String_Node_Str";
  String template=selectedBundle != null ? selectedBundle.getTemplate() : null;
  String xmlText=metadataXML.getText();
  boolean hasOverridenTheForm=inXML && !xmlText.equals(metadataTextFromForm);
  if (idText.length() > 0) {
    Set<MetadataValue> values=null;
    if (!hasOverridenTheForm && selectedBundle != null) {
      values=selectedBundle.getValues();
    }
    DescriptiveMetadataEditBundle newBundle=new DescriptiveMetadataEditBundle(idText,typeText,typeVersion,xmlText,template,values,true);
    BrowserService.Util.getInstance().createDescriptiveMetadataFile(aipId,newBundle,new AsyncCallback<Void>(){
      @Override public void onFailure(      Throwable caught){
        if (caught instanceof ValidationException) {
          ValidationException e=(ValidationException)caught;
          updateErrors(e);
        }
 else {
          AsyncCallbackUtils.defaultFailureTreatment(caught);
        }
        buttonApply.setEnabled(true);
      }
      @Override public void onSuccess(      Void result){
        errors.setText("String_Node_Str");
        errors.setVisible(false);
        Toast.showInfo(messages.dialogSuccess(),messages.metadataFileCreated());
        Tools.newHistory(Browse.RESOLVER,aipId);
      }
    }
);
  }
 else {
    Toast.showError("String_Node_Str");
    buttonApply.setEnabled(true);
  }
}
Program: 188642
Project: 188642
Buggy source:
private void updateMetadataOnServer(String content){
  String typeText=type.getSelectedValue();
  String version=null;
  if (typeText.contains(RodaConstants.METADATA_VERSION_SEPARATOR)) {
    version=typeText.substring(typeText.lastIndexOf(RodaConstants.METADATA_VERSION_SEPARATOR) + 1,typeText.length());
    typeText=typeText.substring(0,typeText.lastIndexOf(RodaConstants.METADATA_VERSION_SEPARATOR));
  }
  DescriptiveMetadataEditBundle updatedBundle=new DescriptiveMetadataEditBundle(bundle.getId(),typeText,version,content);
  BrowserService.Util.getInstance().updateDescriptiveMetadataFile(aipId,updatedBundle,new AsyncCallback<Void>(){
    @Override public void onFailure(    Throwable caught){
      if (caught instanceof ValidationException) {
        ValidationException e=(ValidationException)caught;
        updateErrors(e);
      }
 else {
        AsyncCallbackUtils.defaultFailureTreatment(caught);
      }
    }
    @Override public void onSuccess(    Void result){
      errors.setText("String_Node_Str");
      errors.setVisible(false);
      Toast.showInfo(messages.dialogSuccess(),messages.metadataFileSaved());
      Tools.newHistory(Browse.RESOLVER,aipId);
    }
  }
);
}

Fixed version (ground truth):
private void updateMetadataOnServer(String content){
  String typeText=type.getSelectedValue();
  String version="String_Node_Str";
  if (typeText.contains(RodaConstants.METADATA_VERSION_SEPARATOR)) {
    version=typeText.substring(typeText.lastIndexOf(RodaConstants.METADATA_VERSION_SEPARATOR) + 1,typeText.length());
    typeText=typeText.substring(0,typeText.lastIndexOf(RodaConstants.METADATA_VERSION_SEPARATOR));
  }
  DescriptiveMetadataEditBundle updatedBundle=new DescriptiveMetadataEditBundle(bundle.getId(),typeText,version,content);
  BrowserService.Util.getInstance().updateDescriptiveMetadataFile(aipId,updatedBundle,new AsyncCallback<Void>(){
    @Override public void onFailure(    Throwable caught){
      if (caught instanceof ValidationException) {
        ValidationException e=(ValidationException)caught;
        updateErrors(e);
      }
 else {
        AsyncCallbackUtils.defaultFailureTreatment(caught);
      }
    }
    @Override public void onSuccess(    Void result){
      errors.setText("String_Node_Str");
      errors.setVisible(false);
      Toast.showInfo(messages.dialogSuccess(),messages.metadataFileSaved());
      Tools.newHistory(Browse.RESOLVER,aipId);
    }
  }
);
}
Program: 188643
Project: 188643
Buggy source:
private void updateFormOrXML(){
  if (bundle != null && bundle.getValues() != null && !bundle.getValues().isEmpty()) {
    if (!bundle.isSimilar()) {
      formSimilarDanger.setVisible(true);
    }
 else {
      formSimilarDanger.setVisible(false);
    }
    showXml.setVisible(true);
    if (inXML) {
      updateMetadataXML();
    }
 else {
      if (metadataTextFromForm != null && !metadataXML.getText().equals(metadataTextFromForm)) {
        Dialogs.showConfirmDialog(messages.confirmChangeToFormTitle(),messages.confirmChangeToFormMessage(),messages.dialogCancel(),messages.dialogYes(),new AsyncCallback<Boolean>(){
          @Override public void onFailure(          Throwable caught){
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
          @Override public void onSuccess(          Boolean aBoolean){
            if (aBoolean) {
              formOrXML.clear();
              createForm(supportedBundle);
            }
 else {
              setInXML(!inXML);
            }
          }
        }
);
      }
 else {
        formOrXML.clear();
        createForm(supportedBundle);
      }
    }
  }
 else {
    formSimilarDanger.setVisible(false);
    formOrXML.clear();
    if (bundle != null) {
      metadataXML.setText(bundle.getXml());
    }
 else {
      metadataXML.setText("String_Node_Str");
    }
    formOrXML.add(metadataXML);
    showXml.setVisible(false);
    metadataTextFromForm=null;
  }
}

Fixed version (ground truth):
private void updateFormOrXML(){
  if (bundle != null && bundle.getValues() != null && !bundle.getValues().isEmpty()) {
    if (!bundle.isSimilar()) {
      formSimilarDanger.setVisible(true);
    }
 else {
      formSimilarDanger.setVisible(false);
    }
    showXml.setVisible(true);
    if (inXML) {
      updateMetadataXML();
    }
 else {
      if (metadataTextFromForm != null && !metadataXML.getText().equals(metadataTextFromForm)) {
        Dialogs.showConfirmDialog(messages.confirmChangeToFormTitle(),messages.confirmChangeToFormMessage(),messages.dialogCancel(),messages.dialogYes(),new AsyncCallback<Boolean>(){
          @Override public void onFailure(          Throwable caught){
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
          @Override public void onSuccess(          Boolean aBoolean){
            if (aBoolean) {
              formOrXML.clear();
              createForm(supportedBundle);
            }
 else {
              setInXML(!inXML);
            }
          }
        }
);
      }
 else {
        formOrXML.clear();
        createForm(supportedBundle);
      }
    }
  }
 else {
    inXML=true;
    formSimilarDanger.setVisible(false);
    formOrXML.clear();
    if (bundle != null) {
      metadataXML.setText(bundle.getXml());
    }
 else {
      metadataXML.setText("String_Node_Str");
    }
    formOrXML.add(metadataXML);
    showXml.setVisible(false);
    metadataTextFromForm=null;
  }
}
Program: 188646
Project: 188646
Buggy source:
private void updateFormOrXML(){
  if (!bundle.isSimilar()) {
    formSimilarDanger.setVisible(true);
  }
 else {
    formSimilarDanger.setVisible(false);
  }
  if (bundle != null && bundle.getValues() != null) {
    showXml.setVisible(true);
    if (inXML) {
      updateMetadataXML();
    }
 else {
      if (metadataTextFromForm != null && !metadataXML.getText().equals(metadataTextFromForm)) {
        Dialogs.showConfirmDialog(messages.confirmChangeToFormTitle(),messages.confirmChangeToFormMessage(),messages.dialogCancel(),messages.dialogYes(),new AsyncCallback<Boolean>(){
          @Override public void onFailure(          Throwable caught){
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
          @Override public void onSuccess(          Boolean aBoolean){
            if (aBoolean) {
              formOrXML.clear();
              createForm(supportedBundle);
              formOrXMLLabel.setText("String_Node_Str");
            }
 else {
              setInXML(!inXML);
            }
          }
        }
);
      }
 else {
        formOrXML.clear();
        createForm(supportedBundle);
        formOrXMLLabel.setText("String_Node_Str");
      }
    }
  }
 else {
    formOrXML.clear();
    if (bundle != null) {
      metadataXML.setText(bundle.getRawTemplate());
    }
 else {
      metadataXML.setText("String_Node_Str");
    }
    formOrXML.add(metadataXML);
    formOrXMLLabel.setText("String_Node_Str");
    showXml.setVisible(false);
  }
}

Fixed version (ground truth):
private void updateFormOrXML(){
  if (bundle != null && bundle.getValues() != null && !bundle.getValues().isEmpty()) {
    if (!bundle.isSimilar()) {
      formSimilarDanger.setVisible(true);
    }
 else {
      formSimilarDanger.setVisible(false);
    }
    showXml.setVisible(true);
    if (inXML) {
      updateMetadataXML();
    }
 else {
      if (metadataTextFromForm != null && !metadataXML.getText().equals(metadataTextFromForm)) {
        Dialogs.showConfirmDialog(messages.confirmChangeToFormTitle(),messages.confirmChangeToFormMessage(),messages.dialogCancel(),messages.dialogYes(),new AsyncCallback<Boolean>(){
          @Override public void onFailure(          Throwable caught){
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
          @Override public void onSuccess(          Boolean aBoolean){
            if (aBoolean) {
              formOrXML.clear();
              createForm(supportedBundle);
              formOrXMLLabel.setText("String_Node_Str");
            }
 else {
              setInXML(!inXML);
            }
          }
        }
);
      }
 else {
        formOrXML.clear();
        createForm(supportedBundle);
        formOrXMLLabel.setText("String_Node_Str");
      }
    }
  }
 else {
    formSimilarDanger.setVisible(false);
    formOrXML.clear();
    if (bundle != null) {
      metadataXML.setText(bundle.getXml());
    }
 else {
      metadataXML.setText("String_Node_Str");
    }
    formOrXML.add(metadataXML);
    formOrXMLLabel.setText("String_Node_Str");
    showXml.setVisible(false);
    metadataTextFromForm=null;
  }
}
Program: 188647
Project: 188647
Buggy source:
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  String xmlText=metadataXML.getText();
  boolean hasOverridenTheForm=inXML && !xmlText.equals(metadataTextFromForm);
  if (hasOverridenTheForm) {
    updateMetadataOnServer(xmlText);
  }
 else {
    BrowserService.Util.getInstance().getDescriptiveMetadataPreview(aipId,supportedBundle,new AsyncCallback<String>(){
      @Override public void onFailure(      Throwable caught){
        AsyncCallbackUtils.defaultFailureTreatment(caught);
      }
      @Override public void onSuccess(      String preview){
        updateMetadataOnServer(preview);
      }
    }
);
  }
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  String xmlText=metadataXML.getText();
  boolean hasOverridenTheForm=(inXML && !xmlText.equals(metadataTextFromForm)) || metadataTextFromForm == null;
  if (hasOverridenTheForm) {
    updateMetadataOnServer(xmlText);
  }
 else {
    BrowserService.Util.getInstance().getDescriptiveMetadataPreview(aipId,supportedBundle,new AsyncCallback<String>(){
      @Override public void onFailure(      Throwable caught){
        AsyncCallbackUtils.defaultFailureTreatment(caught);
      }
      @Override public void onSuccess(      String preview){
        updateMetadataOnServer(preview);
      }
    }
);
  }
}
Program: 188652
Project: 188652
Buggy source:
public static void indentXML(Reader input,Writer output) throws TransformerException {
  Transformer transformer=TransformerFactory.newInstance().newTransformer();
  transformer.setOutputProperty(OutputKeys.INDENT,"String_Node_Str");
  StreamSource source=new StreamSource(input);
  StreamResult result=new StreamResult(output);
  transformer.transform(source,result);
}

Fixed version (ground truth):
public static String indentXML(String xml) throws TransformerException {
  Reader input=new StringReader(xml);
  Writer output=new StringWriter();
  indentXML(input,output);
  return output.toString();
}
Program: 188653
Project: 188653
Buggy source:
public static String createDescriptiveMetadataPreview(RodaUser user,String aipId,SupportedMetadataTypeBundle bundle) throws AuthorizationDeniedException {
  Date startDate=new Date();
  UserUtility.checkRoles(user,BROWSE_ROLE);
  String payload=BrowserHelper.getDescriptiveMetadataPreview(bundle);
  long duration=new Date().getTime() - startDate.getTime();
  registerAction(user,BROWSER_COMPONENT,"String_Node_Str",null,duration,"String_Node_Str",bundle.getLabel());
  return payload;
}

Fixed version (ground truth):
public static String createDescriptiveMetadataPreview(RodaUser user,String aipId,SupportedMetadataTypeBundle bundle) throws AuthorizationDeniedException, GenericException {
  Date startDate=new Date();
  UserUtility.checkRoles(user,BROWSE_ROLE);
  String payload=BrowserHelper.getDescriptiveMetadataPreview(bundle);
  long duration=new Date().getTime() - startDate.getTime();
  registerAction(user,BROWSER_COMPONENT,"String_Node_Str",null,duration,"String_Node_Str",bundle.getLabel());
  return payload;
}
Program: 188654
Project: 188654
Buggy source:
public static String getDescriptiveMetadataPreview(SupportedMetadataTypeBundle bundle){
  String rawTemplate=bundle.getTemplate();
  String result=null;
  try {
    Handlebars handlebars=new Handlebars();
    Map<String,String> data=new HashMap<>();
    handlebars.registerHelperMissing((o,options) -> {
      if (data.containsKey(options.helperName)) {
        return data.get(options.helperName);
      }
      return "String_Node_Str";
    }
);
    Template tmpl=handlebars.compileInline(rawTemplate);
    Set<MetadataValue> values=bundle.getValues();
    if (values != null) {
      values.forEach(metadataValue -> {
        String val=metadataValue.get("String_Node_Str");
        if (val != null) {
          val=val.replaceAll("String_Node_Str","String_Node_Str");
          if (!"String_Node_Str".equals(val)) {
            data.put(metadataValue.getId(),metadataValue.get("String_Node_Str"));
          }
        }
      }
);
    }
    result=tmpl.apply(data);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return result;
}

Fixed version (ground truth):
public static String getDescriptiveMetadataPreview(SupportedMetadataTypeBundle bundle) throws GenericException {
  String rawTemplate=bundle.getTemplate();
  String result=null;
  try {
    Handlebars handlebars=new Handlebars();
    Map<String,String> data=new HashMap<>();
    handlebars.registerHelperMissing((o,options) -> {
      if (data.containsKey(options.helperName)) {
        return data.get(options.helperName);
      }
      return "String_Node_Str";
    }
);
    Template tmpl=handlebars.compileInline(rawTemplate);
    Set<MetadataValue> values=bundle.getValues();
    if (values != null) {
      values.forEach(metadataValue -> {
        String val=metadataValue.get("String_Node_Str");
        if (val != null) {
          val=val.replaceAll("String_Node_Str","String_Node_Str");
          if (!"String_Node_Str".equals(val)) {
            data.put(metadataValue.getId(),metadataValue.get("String_Node_Str"));
          }
        }
      }
);
    }
    result=tmpl.apply(data);
    result=RodaUtils.indentXML(result);
  }
 catch (  IOException|TransformerException e) {
    throw new GenericException(e);
  }
  return result;
}
Program: 188656
Project: 188656
Buggy source:
@Override public Class<? extends Entity> getEntity(StoragePath storagePath) throws GenericException {
  Path entity=FSUtils.getEntityPath(basePath,storagePath);
  if (Files.exists(entity)) {
    if (Files.isDirectory(entity)) {
      if (storagePath.isFromAContainer()) {
        return DefaultContainer.class;
      }
 else {
        return DefaultDirectory.class;
      }
    }
 else {
      return DefaultBinary.class;
    }
  }
 else {
    throw new GenericException("String_Node_Str" + storagePath);
  }
}

Fixed version (ground truth):
@Override public Class<? extends Entity> getEntity(StoragePath storagePath) throws NotFoundException {
  Path entity=FSUtils.getEntityPath(basePath,storagePath);
  if (Files.exists(entity)) {
    if (Files.isDirectory(entity)) {
      if (storagePath.isFromAContainer()) {
        return DefaultContainer.class;
      }
 else {
        return DefaultDirectory.class;
      }
    }
 else {
      return DefaultBinary.class;
    }
  }
 else {
    throw new NotFoundException("String_Node_Str" + storagePath);
  }
}
Program: 188657
Project: 188657
Buggy source:
public Risk(Risk risk){
  super(risk.getId(),risk.getName());
  this.description=risk.getDescription();
  this.identifiedOn=risk.getIdentifiedOn();
  this.identifiedBy=risk.getIdentifiedBy();
  this.category=risk.getCategory();
  this.notes=risk.getNotes();
  this.preMitigationProbability=risk.getPreMitigationProbability();
  this.preMitigationImpact=risk.getPreMitigationImpact();
  this.preMitigationSeverity=risk.getPreMitigationSeverity();
  this.preMitigationSeverityLevel=risk.getPreMitigationSeverityLevel();
  this.preMitigationNotes=risk.getPreMitigationNotes();
  this.posMitigationProbability=risk.getPosMitigationProbability();
  this.posMitigationImpact=risk.getPosMitigationImpact();
  this.posMitigationSeverity=risk.getPosMitigationSeverity();
  this.posMitigationSeverityLevel=risk.getPosMitigationSeverityLevel();
  this.posMitigationNotes=risk.getPosMitigationNotes();
  this.mitigationStrategy=risk.getMitigationStrategy();
  this.mitigationOwnerType=risk.getMitigationOwnerType();
  this.mitigationOwner=risk.getMitigationOwner();
  this.mitigationRelatedEventIdentifierType=risk.getMitigationRelatedEventIdentifierType();
  this.mitigationRelatedEventIdentifierValue=risk.getMitigationRelatedEventIdentifierValue();
  this.affectedObjects=new HashMap<String,String>(risk.getAffectedObjects());
}

Fixed version (ground truth):
public Risk(Risk risk){
  super(risk.getId(),risk.getName());
  this.description=risk.getDescription();
  this.identifiedOn=risk.getIdentifiedOn();
  this.identifiedBy=risk.getIdentifiedBy();
  this.category=risk.getCategory();
  this.notes=risk.getNotes();
  this.preMitigationProbability=risk.getPreMitigationProbability();
  this.preMitigationImpact=risk.getPreMitigationImpact();
  this.preMitigationSeverity=risk.getPreMitigationSeverity();
  this.preMitigationSeverityLevel=risk.getPreMitigationSeverityLevel();
  this.preMitigationNotes=risk.getPreMitigationNotes();
  this.posMitigationProbability=risk.getPosMitigationProbability();
  this.posMitigationImpact=risk.getPosMitigationImpact();
  this.posMitigationSeverity=risk.getPosMitigationSeverity();
  this.posMitigationSeverityLevel=risk.getPosMitigationSeverityLevel();
  this.posMitigationNotes=risk.getPosMitigationNotes();
  this.mitigationStrategy=risk.getMitigationStrategy();
  this.mitigationOwnerType=risk.getMitigationOwnerType();
  this.mitigationOwner=risk.getMitigationOwner();
  this.mitigationRelatedEventIdentifierType=risk.getMitigationRelatedEventIdentifierType();
  this.mitigationRelatedEventIdentifierValue=risk.getMitigationRelatedEventIdentifierValue();
}
Program: 188658
Project: 188658
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + super.getId() + "String_Node_Str"+ super.getName()+ "String_Node_Str"+ description+ "String_Node_Str"+ identifiedOn+ "String_Node_Str"+ identifiedBy+ "String_Node_Str"+ category+ "String_Node_Str"+ notes+ "String_Node_Str"+ preMitigationProbability+ "String_Node_Str"+ preMitigationImpact+ "String_Node_Str"+ preMitigationSeverity+ "String_Node_Str"+ preMitigationNotes+ "String_Node_Str"+ posMitigationProbability+ "String_Node_Str"+ posMitigationImpact+ "String_Node_Str"+ posMitigationSeverity+ "String_Node_Str"+ posMitigationNotes+ "String_Node_Str"+ mitigationStrategy+ "String_Node_Str"+ mitigationOwnerType+ "String_Node_Str"+ mitigationOwner+ "String_Node_Str"+ mitigationRelatedEventIdentifierType+ "String_Node_Str"+ mitigationRelatedEventIdentifierValue+ "String_Node_Str"+ affectedObjects+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + super.getId() + "String_Node_Str"+ super.getName()+ "String_Node_Str"+ description+ "String_Node_Str"+ identifiedOn+ "String_Node_Str"+ identifiedBy+ "String_Node_Str"+ category+ "String_Node_Str"+ notes+ "String_Node_Str"+ preMitigationProbability+ "String_Node_Str"+ preMitigationImpact+ "String_Node_Str"+ preMitigationSeverity+ "String_Node_Str"+ preMitigationNotes+ "String_Node_Str"+ posMitigationProbability+ "String_Node_Str"+ posMitigationImpact+ "String_Node_Str"+ posMitigationSeverity+ "String_Node_Str"+ posMitigationNotes+ "String_Node_Str"+ mitigationStrategy+ "String_Node_Str"+ mitigationOwnerType+ "String_Node_Str"+ mitigationOwner+ "String_Node_Str"+ mitigationRelatedEventIdentifierType+ "String_Node_Str"+ mitigationRelatedEventIdentifierValue+ "String_Node_Str";
}
Program: 188661
Project: 188661
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + id + "String_Node_Str"+ objectId+ "String_Node_Str"+ risks+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + id + "String_Node_Str"+ objectId+ "String_Node_Str"+ objectClass+ "String_Node_Str"+ risks+ "String_Node_Str";
}
Program: 188662
Project: 188662
Buggy source:
public RiskIncidence(RiskIncidence incidence){
  this.id=incidence.getId();
  this.setObjectId(incidence.getObjectId());
  this.setRisks(incidence.getRisks());
}

Fixed version (ground truth):
public RiskIncidence(RiskIncidence incidence){
  this.id=incidence.getId();
  this.setObjectId(incidence.getObjectId());
  this.setObjectClass(incidence.getObjectClass());
  this.setRisks(incidence.getRisks());
}
Program: 188663
Project: 188663
Buggy source:
public void riskIncidenceDeleted(String riskIncidenceId){
  deleteDocumentFromIndex(RodaConstants.INDEX_RISK_INCIDENCE,riskIncidenceId,"String_Node_Str" + riskIncidenceId + "String_Node_Str");
}

Fixed version (ground truth):
public void riskIncidenceDeleted(String riskIncidenceId,boolean commit){
  deleteDocumentFromIndex(RodaConstants.INDEX_RISK_INCIDENCE,riskIncidenceId,"String_Node_Str" + riskIncidenceId + "String_Node_Str");
  if (commit) {
    try {
      SolrUtils.commit(index,RiskIncidence.class);
    }
 catch (    GenericException e) {
      LOGGER.warn("String_Node_Str");
    }
  }
}
Program: 188664
Project: 188664
Buggy source:
public void riskIncidenceCreatedOrUpdated(RiskIncidence riskIncidence){
  addDocumentToIndex(RodaConstants.INDEX_RISK_INCIDENCE,SolrUtils.riskIncidenceToSolrDocument(riskIncidence),"String_Node_Str");
}

Fixed version (ground truth):
public void riskIncidenceCreatedOrUpdated(RiskIncidence riskIncidence,boolean commit){
  addDocumentToIndex(RodaConstants.INDEX_RISK_INCIDENCE,SolrUtils.riskIncidenceToSolrDocument(riskIncidence),"String_Node_Str");
  if (commit) {
    try {
      SolrUtils.commit(index,RiskIncidence.class);
    }
 catch (    GenericException e) {
      LOGGER.warn("String_Node_Str");
    }
  }
}
Program: 188665
Project: 188665
Buggy source:
public void reindexRiskIncidence(RiskIncidence riskIncidence){
  observer.riskIncidenceCreatedOrUpdated(riskIncidence);
}

Fixed version (ground truth):
public void reindexRiskIncidence(RiskIncidence riskIncidence){
  observer.riskIncidenceCreatedOrUpdated(riskIncidence,false);
}
Program: 188666
Project: 188666
Buggy source:
public static SolrInputDocument riskIncidenceToSolrDocument(RiskIncidence incidence){
  SolrInputDocument doc=new SolrInputDocument();
  doc.addField(RodaConstants.RISK_INCIDENCE_ID,incidence.getId());
  doc.addField(RodaConstants.RISK_INCIDENCE_OBJECT_ID,incidence.getObjectId());
  doc.addField(RodaConstants.RISK_INCIDENCE_RISKS,incidence.getRisks());
  return doc;
}

Fixed version (ground truth):
public static SolrInputDocument riskIncidenceToSolrDocument(RiskIncidence incidence){
  SolrInputDocument doc=new SolrInputDocument();
  doc.addField(RodaConstants.RISK_INCIDENCE_ID,incidence.getId());
  doc.addField(RodaConstants.RISK_INCIDENCE_OBJECT_ID,incidence.getObjectId());
  doc.addField(RodaConstants.RISK_INCIDENCE_OBJECT_CLASS,incidence.getObjectClass());
  doc.addField(RodaConstants.RISK_INCIDENCE_RISKS,incidence.getRisks());
  return doc;
}
Program: 188667
Project: 188667
Buggy source:
public static RiskIncidence solrDocumentToRiskIncidence(SolrDocument doc){
  RiskIncidence incidence=new RiskIncidence();
  incidence.setId(objectToString(doc.get(RodaConstants.RISK_INCIDENCE_ID)));
  incidence.setObjectId(objectToString(doc.get(RodaConstants.RISK_INCIDENCE_OBJECT_ID)));
  incidence.setRisks(objectToListString(doc.get(RodaConstants.RISK_INCIDENCE_RISKS)));
  return incidence;
}

Fixed version (ground truth):
public static RiskIncidence solrDocumentToRiskIncidence(SolrDocument doc){
  RiskIncidence incidence=new RiskIncidence();
  incidence.setId(objectToString(doc.get(RodaConstants.RISK_INCIDENCE_ID)));
  incidence.setObjectId(objectToString(doc.get(RodaConstants.RISK_INCIDENCE_OBJECT_ID)));
  incidence.setObjectClass(objectToString(doc.get(RodaConstants.RISK_INCIDENCE_OBJECT_CLASS)));
  incidence.setRisks(objectToListString(doc.get(RodaConstants.RISK_INCIDENCE_RISKS)));
  return incidence;
}
Program: 188668
Project: 188668
Buggy source:
protected void notifyRiskIncidenceCreatedOrUpdated(RiskIncidence riskIncidence){
  for (  ModelObserver observer : observers) {
    observer.riskIncidenceCreatedOrUpdated(riskIncidence);
  }
}

Fixed version (ground truth):
protected void notifyRiskIncidenceCreatedOrUpdated(RiskIncidence riskIncidence,boolean commit){
  for (  ModelObserver observer : observers) {
    observer.riskIncidenceCreatedOrUpdated(riskIncidence,commit);
  }
}
Program: 188669
Project: 188669
Buggy source:
protected void notifyRiskIncidenceDeleted(String riskIncidenceId){
  for (  ModelObserver observer : observers) {
    observer.riskIncidenceDeleted(riskIncidenceId);
  }
}

Fixed version (ground truth):
protected void notifyRiskIncidenceDeleted(String riskIncidenceId,boolean commit){
  for (  ModelObserver observer : observers) {
    observer.riskIncidenceDeleted(riskIncidenceId,commit);
  }
}
Program: 188670
Project: 188670
Buggy source:
public void riskIncidenceDeleted(String riskIncidenceId);

Fixed version (ground truth):
public void riskIncidenceDeleted(String riskIncidenceId,boolean commit);
Program: 188671
Project: 188671
Buggy source:
public void riskIncidenceCreatedOrUpdated(RiskIncidence riskIncidence);

Fixed version (ground truth):
public void riskIncidenceCreatedOrUpdated(RiskIncidence riskIncidence,boolean commit);
Program: 188672
Project: 188672
Buggy source:
public void deleteRiskIncidence(String riskId,String aipId,String representationId,List<String> fileDirectoryPath,String fileId,String type) throws GenericException, NotFoundException, AuthorizationDeniedException, RequestNotValidException {
  String fileSuffix=RodaConstants.RISK_INCIDENCE_FILE_EXTENSION;
  try {
    try {
      Binary incidenceBinary=this.retrieveOtherMetadataBinary(aipId,representationId,fileDirectoryPath,fileId,fileSuffix,type);
      InputStream inputStream=incidenceBinary.getContent().createInputStream();
      RiskIncidence riskIncidence=JsonUtils.getObjectFromJson(inputStream,RiskIncidence.class);
      riskIncidence.removeRisk(riskId);
      IOUtils.closeQuietly(inputStream);
      if (riskIncidence.getRisks().size() > 0) {
        String riskIncidenceAsJson=JsonUtils.getJsonFromObject(riskIncidence);
        this.createOtherMetadata(aipId,representationId,fileDirectoryPath,fileId,fileSuffix,type,new StringContentPayload(riskIncidenceAsJson),true);
        notifyRiskIncidenceCreatedOrUpdated(riskIncidence);
      }
 else {
        storage.deleteResource(incidenceBinary.getStoragePath());
        notifyRiskIncidenceDeleted(riskIncidence.getId());
      }
      Risk risk=this.retrieveRisk(riskId);
      risk.setObjectsSize(risk.getObjectsSize() - 1);
      this.updateRisk(risk,null,false);
    }
 catch (    NotFoundException e) {
    }
  }
 catch (  GenericException|RequestNotValidException|AuthorizationDeniedException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void deleteRiskIncidence(String riskId,String aipId,String representationId,List<String> fileDirectoryPath,String fileId,String type) throws GenericException, NotFoundException, AuthorizationDeniedException, RequestNotValidException {
  String fileSuffix=RodaConstants.RISK_INCIDENCE_FILE_EXTENSION;
  try {
    try {
      Binary incidenceBinary=this.retrieveOtherMetadataBinary(aipId,representationId,fileDirectoryPath,fileId,fileSuffix,type);
      InputStream inputStream=incidenceBinary.getContent().createInputStream();
      RiskIncidence riskIncidence=JsonUtils.getObjectFromJson(inputStream,RiskIncidence.class);
      riskIncidence.removeRisk(riskId);
      IOUtils.closeQuietly(inputStream);
      if (riskIncidence.getRisks().size() > 0) {
        String riskIncidenceAsJson=JsonUtils.getJsonFromObject(riskIncidence);
        this.createOtherMetadata(aipId,representationId,fileDirectoryPath,fileId,fileSuffix,type,new StringContentPayload(riskIncidenceAsJson),false);
        notifyRiskIncidenceCreatedOrUpdated(riskIncidence,true);
      }
 else {
        storage.deleteResource(incidenceBinary.getStoragePath());
        notifyRiskIncidenceDeleted(riskIncidence.getId(),true);
      }
      Risk risk=this.retrieveRisk(riskId);
      risk.setObjectsSize(risk.getObjectsSize() - 1);
      this.updateRisk(risk,null,false);
    }
 catch (    NotFoundException e) {
    }
  }
 catch (  GenericException|RequestNotValidException|AuthorizationDeniedException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 188673
Project: 188673
Buggy source:
/** 
 */
public Risk createRisk(Risk risk,boolean commit) throws GenericException {
  try {
    risk.setId(UUID.randomUUID().toString());
    String riskAsJson=JsonUtils.getJsonFromObject(risk);
    StoragePath riskPath=ModelUtils.getRiskStoragePath(risk.getId());
    storage.createBinary(riskPath,new StringContentPayload(riskAsJson),false);
  }
 catch (  GenericException|RequestNotValidException|AuthorizationDeniedException|NotFoundException|AlreadyExistsException e) {
    LOGGER.error("String_Node_Str",e);
  }
  notifyRiskCreatedOrUpdated(risk,commit);
  return risk;
}

Fixed version (ground truth):
public Risk createRisk(Risk risk,String id,boolean commit) throws GenericException {
  try {
    if (id == null) {
      risk.setId(UUID.randomUUID().toString());
    }
 else {
      risk.setId(id);
    }
    String riskAsJson=JsonUtils.getJsonFromObject(risk);
    StoragePath riskPath=ModelUtils.getRiskStoragePath(risk.getId());
    storage.createBinary(riskPath,new StringContentPayload(riskAsJson),false);
  }
 catch (  GenericException|RequestNotValidException|AuthorizationDeniedException|NotFoundException|AlreadyExistsException e) {
    LOGGER.error("String_Node_Str",e);
  }
  notifyRiskCreatedOrUpdated(risk,commit);
  return risk;
}
Program: 188675
Project: 188675
Buggy source:
@Override <T extends Serializable>JobPluginInfo processJobPluginInformation(Plugin<T> plugin,Integer taskObjectsCount,Map<Plugin<?>,JobPluginInfo> jobInfos){
  RiskJobPluginInfo newJobPluginInfo=new RiskJobPluginInfo();
  newJobPluginInfo.setRisks(this.getRisks());
  return newJobPluginInfo;
}

Fixed version (ground truth):
@Override <T extends Serializable>JobPluginInfo processJobPluginInformation(Plugin<T> plugin,Integer taskObjectsCount,Map<Plugin<?>,JobPluginInfo> jobInfos){
  RiskJobPluginInfo riskInfo=this;
  IngestJobPluginInfo jobPluginInfo=(IngestJobPluginInfo)jobInfos.get(plugin);
  jobPluginInfo.setCompletionPercentage(riskInfo.getCompletionPercentage());
  jobPluginInfo.setObjectsBeingProcessed(riskInfo.getObjectsBeingProcessed());
  jobPluginInfo.setObjectsWaitingToBeProcessed(riskInfo.getObjectsWaitingToBeProcessed());
  jobPluginInfo.setObjectsProcessedWithSuccess(riskInfo.getObjectsProcessedWithSuccess());
  jobPluginInfo.setObjectsProcessedWithFailure(riskInfo.getObjectsProcessedWithFailure());
  float percentage=0f;
  int beingProcessed=0;
  int processedWithSuccess=0;
  int processedWithFailure=0;
  for (  JobPluginInfo jpi : jobInfos.values()) {
    IngestJobPluginInfo pluginInfo=(IngestJobPluginInfo)jpi;
    if (pluginInfo.getTotalSteps() > 0) {
      float pluginPercentage=((float)pluginInfo.getStepsCompleted()) / pluginInfo.getTotalSteps();
      float pluginWeight=((float)pluginInfo.getObjectsCount()) / taskObjectsCount;
      percentage+=(pluginPercentage * pluginWeight);
      processedWithSuccess+=pluginInfo.getObjectsProcessedWithSuccess();
      processedWithFailure+=pluginInfo.getObjectsProcessedWithFailure();
    }
    beingProcessed+=pluginInfo.getObjectsBeingProcessed();
  }
  RiskJobPluginInfo newJobPluginInfo=new RiskJobPluginInfo();
  newJobPluginInfo.setRisks(this.getRisks());
  newJobPluginInfo.setCompletionPercentage(Math.round((percentage * 100)));
  newJobPluginInfo.setObjectsBeingProcessed(beingProcessed);
  newJobPluginInfo.setObjectsProcessedWithSuccess(processedWithSuccess);
  newJobPluginInfo.setObjectsProcessedWithFailure(processedWithFailure);
  return newJobPluginInfo;
}
Program: 188677
Project: 188677
Buggy source:
public Set<String> getGroupnames(){
  HashSet<String> groupnames=new HashSet<>();
  for (  Set<String> values : groups.values()) {
    groupnames.addAll(values);
  }
  return groupnames;
}

Fixed version (ground truth):
@JsonIgnore public Set<String> getGroupnames(){
  HashSet<String> groupnames=new HashSet<>();
  for (  Set<String> values : groups.values()) {
    groupnames.addAll(values);
  }
  return groupnames;
}
Program: 188678
Project: 188678
Buggy source:
public Set<String> getUsernames(){
  HashSet<String> usernames=new HashSet<>();
  for (  Set<String> values : users.values()) {
    usernames.addAll(values);
  }
  return usernames;
}

Fixed version (ground truth):
@JsonIgnore public Set<String> getUsernames(){
  HashSet<String> usernames=new HashSet<>();
  for (  Set<String> values : users.values()) {
    usernames.addAll(values);
  }
  return usernames;
}
Program: 188680
Project: 188680
Buggy source:
private static Permissions getPermissions(SolrDocument doc){
  Permissions permissions=new Permissions();
  Map<PermissionType,Set<String>> userPermissions=new HashMap<>();
  for (  PermissionType type : PermissionType.values()) {
    String key=RodaConstants.INDEX_PERMISSION_USERS_PREFIX + type;
    Set<String> users=new HashSet<>();
    users.addAll(objectToListString(doc.get(key)));
    userPermissions.put(type,users);
  }
  Map<PermissionType,Set<String>> groupPermissions=new HashMap<>();
  for (  PermissionType type : PermissionType.values()) {
    String key=RodaConstants.INDEX_PERMISSION_GROUPS_PREFIX + type;
    Set<String> groups=new HashSet<>();
    groups.addAll(objectToListString(doc.get(key)));
    groupPermissions.put(type,groups);
  }
  permissions.setUsers(userPermissions);
  permissions.setGroups(userPermissions);
  return permissions;
}

Fixed version (ground truth):
private static Permissions getPermissions(SolrDocument doc){
  Permissions permissions=new Permissions();
  Map<PermissionType,Set<String>> userPermissions=new HashMap<>();
  for (  PermissionType type : PermissionType.values()) {
    String key=RodaConstants.INDEX_PERMISSION_USERS_PREFIX + type;
    Set<String> users=new HashSet<>();
    users.addAll(objectToListString(doc.get(key)));
    userPermissions.put(type,users);
  }
  Map<PermissionType,Set<String>> groupPermissions=new HashMap<>();
  for (  PermissionType type : PermissionType.values()) {
    String key=RodaConstants.INDEX_PERMISSION_GROUPS_PREFIX + type;
    Set<String> groups=new HashSet<>();
    groups.addAll(objectToListString(doc.get(key)));
    groupPermissions.put(type,groups);
  }
  permissions.setUsers(userPermissions);
  permissions.setGroups(groupPermissions);
  return permissions;
}
Program: 188681
Project: 188681
Buggy source:
public ValueCheckBox(PermissionType permissionType,String label){
  super(label);
  this.permissionType=permissionType;
}

Fixed version (ground truth):
public ValueCheckBox(PermissionType permissionType){
  super(messages.objectPermission(permissionType));
  setTitle(messages.objectPermissionDescription(permissionType));
  this.permissionType=permissionType;
}
Program: 188682
Project: 188682
Buggy source:
public PermissionPanel(String name,boolean isUser,Set<PermissionType> permissions){
  this.name=name;
  this.isUser=isUser;
  panel=new FlowPanel();
  panelBody=new FlowPanel();
  type=new HTML(SafeHtmlUtils.fromSafeConstant(isUser ? "String_Node_Str" : "String_Node_Str"));
  nameLabel=new Label(name);
  rightPanel=new FlowPanel();
  editPermissionsPanel=new FlowPanel();
  for (  PermissionType permissionType : Permissions.PermissionType.values()) {
    ValueCheckBox valueCheckBox=new ValueCheckBox(permissionType,permissionType.toString());
    if (permissions.contains(permissionType)) {
      valueCheckBox.setValue(true);
    }
    editPermissionsPanel.add(valueCheckBox);
    valueCheckBox.addStyleName("String_Node_Str");
  }
  removePanel=new Button("String_Node_Str");
  panelBody.add(type);
  panelBody.add(nameLabel);
  panelBody.add(rightPanel);
  rightPanel.add(editPermissionsPanel);
  rightPanel.add(removePanel);
  panel.add(panelBody);
  initWidget(panel);
  panel.addStyleName("String_Node_Str");
  panel.addStyleName(isUser ? "String_Node_Str" : "String_Node_Str");
  panelBody.addStyleName("String_Node_Str");
  type.addStyleName("String_Node_Str");
  nameLabel.addStyleName("String_Node_Str");
  rightPanel.addStyleName("String_Node_Str");
  editPermissionsPanel.addStyleName("String_Node_Str");
  removePanel.addStyleName("String_Node_Str");
  removePanel.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      PermissionPanel.this.removeFromParent();
    }
  }
);
}

Fixed version (ground truth):
public PermissionPanel(String name,boolean isUser,Set<PermissionType> permissions){
  this.name=name;
  this.isUser=isUser;
  panel=new FlowPanel();
  panelBody=new FlowPanel();
  type=new HTML(SafeHtmlUtils.fromSafeConstant(isUser ? "String_Node_Str" : "String_Node_Str"));
  nameLabel=new Label(name);
  rightPanel=new FlowPanel();
  editPermissionsPanel=new FlowPanel();
  for (  PermissionType permissionType : Permissions.PermissionType.values()) {
    ValueCheckBox valueCheckBox=new ValueCheckBox(permissionType);
    if (permissions.contains(permissionType)) {
      valueCheckBox.setValue(true);
    }
    editPermissionsPanel.add(valueCheckBox);
    valueCheckBox.addStyleName("String_Node_Str");
  }
  removePanel=new Button("String_Node_Str");
  panelBody.add(type);
  panelBody.add(nameLabel);
  panelBody.add(rightPanel);
  rightPanel.add(editPermissionsPanel);
  rightPanel.add(removePanel);
  panel.add(panelBody);
  initWidget(panel);
  panel.addStyleName("String_Node_Str");
  panel.addStyleName(isUser ? "String_Node_Str" : "String_Node_Str");
  panelBody.addStyleName("String_Node_Str");
  type.addStyleName("String_Node_Str");
  nameLabel.addStyleName("String_Node_Str");
  rightPanel.addStyleName("String_Node_Str");
  editPermissionsPanel.addStyleName("String_Node_Str");
  removePanel.addStyleName("String_Node_Str");
  removePanel.addClickHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      PermissionPanel.this.removeFromParent();
    }
  }
);
}
Program: 188683
Project: 188683
Buggy source:
@Override public void onFailure(Throwable caught){
  Toast.showError(caught.getMessage());
  cancel();
}

Fixed version (ground truth):
@Override public void onFailure(Throwable caught){
  AsyncCallbackUtils.defaultFailureTreatment(caught);
}
Program: 188684
Project: 188684
Buggy source:
@UiHandler("String_Node_Str") void buttonCancelHandler(ClickEvent e){
  cancel();
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonCancelHandler(ClickEvent e){
  close();
}
Program: 188685
Project: 188685
Buggy source:
private void createPermissionPanel(){
  Permissions permissions=aip.getPermissions();
  GWT.log(aip.getPermissions().toString());
  for (  String username : permissions.getUsernames()) {
    permissionsPanel.add(new PermissionPanel(username,true,permissions.getUserPermissions(username)));
  }
  for (  String groupname : permissions.getGroupnames()) {
    permissionsPanel.add(new PermissionPanel(groupname,false,permissions.getGroupPermissions(groupname)));
  }
}

Fixed version (ground truth):
private void createPermissionPanel(){
  Permissions permissions=aip.getPermissions();
  GWT.log("String_Node_Str" + permissions);
  for (  String username : permissions.getUsernames()) {
    userPermissionsPanel.add(new PermissionPanel(username,true,permissions.getUserPermissions(username)));
  }
  for (  String groupname : permissions.getGroupnames()) {
    groupPermissionsPanel.add(new PermissionPanel(groupname,false,permissions.getGroupPermissions(groupname)));
  }
}
Program: 188686
Project: 188686
Buggy source:
public void addPermissionPanel(RODAMember member){
  permissionsPanel.insert(new PermissionPanel(member),0);
}

Fixed version (ground truth):
public void addPermissionPanel(RODAMember member){
  if (member.isUser()) {
    userPermissionsPanel.insert(new PermissionPanel(member),0);
  }
 else {
    groupPermissionsPanel.insert(new PermissionPanel(member),0);
  }
}
Program: 188687
Project: 188687
Buggy source:
@UiHandler("String_Node_Str") void buttonAddHandler(ClickEvent e){
  MemberSelectDialog selectDialog=new MemberSelectDialog("String_Node_Str",null);
  selectDialog.showAndCenter();
  selectDialog.addValueChangeHandler(new ValueChangeHandler<RODAMember>(){
    @Override public void onValueChange(    ValueChangeEvent<RODAMember> event){
      RODAMember selected=event.getValue();
      if (selected != null) {
        addPermissionPanel(selected);
      }
    }
  }
);
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonAddHandler(ClickEvent e){
  Filter filter=new Filter();
  for (  String username : getAssignedUserNames()) {
    filter.add(new NotSimpleFilterParameter(RodaConstants.MEMBERS_ID,username));
  }
  for (  String groupname : getAssignedGroupNames()) {
    filter.add(new NotSimpleFilterParameter(RodaConstants.MEMBERS_ID,groupname));
  }
  MemberSelectDialog selectDialog=new MemberSelectDialog("String_Node_Str",filter);
  selectDialog.showAndCenter();
  selectDialog.addValueChangeHandler(new ValueChangeHandler<RODAMember>(){
    @Override public void onValueChange(    ValueChangeEvent<RODAMember> event){
      RODAMember selected=event.getValue();
      if (selected != null) {
        addPermissionPanel(selected);
      }
    }
  }
);
}
Program: 188688
Project: 188688
Buggy source:
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  Permissions permissions=new Permissions();
  for (int i=0; i < permissionsPanel.getWidgetCount(); i++) {
    PermissionPanel permissionPanel=(PermissionPanel)permissionsPanel.getWidget(i);
    if (permissionPanel.isUser()) {
      permissions.setUserPermissions(permissionPanel.getName(),permissionPanel.getPermissions());
    }
 else {
      permissions.setGroupPermissions(permissionPanel.getName(),permissionPanel.getPermissions());
    }
  }
  BrowserService.Util.getInstance().updateAIPPermssions(aip.getId(),permissions,new AsyncCallback<Void>(){
    @Override public void onSuccess(    Void result){
      cancel();
    }
    @Override public void onFailure(    Throwable caught){
      Toast.showError(caught.getMessage());
      cancel();
    }
  }
);
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonApplyHandler(ClickEvent e){
  Permissions permissions=getPermissions();
  GWT.log("String_Node_Str" + permissions);
  BrowserService.Util.getInstance().updateAIPPermssions(aip.getId(),permissions,new AsyncCallback<Void>(){
    @Override public void onSuccess(    Void result){
      Toast.showInfo("String_Node_Str","String_Node_Str");
    }
    @Override public void onFailure(    Throwable caught){
      AsyncCallbackUtils.defaultFailureTreatment(caught);
    }
  }
);
}
Program: 188689
Project: 188689
Buggy source:
@Override public void onSuccess(Void result){
  cancel();
}

Fixed version (ground truth):
@Override public void onSuccess(Void result){
  Toast.showInfo("String_Node_Str","String_Node_Str");
}
Program: 188690
Project: 188690
Buggy source:
public String createFolder(String parent,String folderName) throws GenericException, RequestNotValidException {
  Path parentPath=parent != null ? basePath.resolve(parent) : basePath;
  Path createdPath;
  try {
    createdPath=Files.createDirectories(parentPath.resolve(folderName));
    BasicFileAttributes attrs=Files.readAttributes(createdPath,BasicFileAttributes.class);
    TransferredResource resource=createTransferredResource(createdPath,attrs,0L,basePath,new Date());
    index.create(TransferredResource.class,resource);
    return resource.getUUID();
  }
 catch (  IOException e) {
    throw new GenericException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public String createFolder(String parentUUID,String folderName) throws GenericException, RequestNotValidException, NotFoundException {
  Path parentPath;
  if (parentUUID != null) {
    TransferredResource parent=index.retrieve(TransferredResource.class,parentUUID);
    parentPath=basePath.resolve(parent.getRelativePath());
  }
 else {
    parentPath=basePath;
  }
  try {
    Path createdPath=Files.createDirectories(parentPath.resolve(folderName));
    BasicFileAttributes attrs=Files.readAttributes(createdPath,BasicFileAttributes.class);
    TransferredResource resource=createTransferredResource(createdPath,attrs,0L,basePath,new Date());
    index.create(TransferredResource.class,resource);
    return resource.getUUID();
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
    throw new GenericException("String_Node_Str",e);
  }
}