Program: 35684
Project: 35684
Buggy source:
/** 
 * Adds an activity row.
 * @param result The expected result. Must not be <code>null</code>.
 */
private void addExpectedResult(final ExpectedResultDTO result){
  if (result == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final LogFrameGroupDTO group=result.getGroup();
  @SuppressWarnings("String_Node_Str") RowsGroup<LogFrameGroupDTO> g=(RowsGroup<LogFrameGroupDTO>)expectedResultsView.getGroup(group.getClientSideId());
  if (g == null) {
    g=addExpectedResultsGroup(group);
  }
  final StringBuilder sb=new StringBuilder();
  sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode());
  sb.append("String_Node_Str");
  sb.append(expectedResultsPolicy.getCode(result.getCode(),result));
  result.setLabel(sb.toString());
  if (result.getPosition() == null) {
    result.setPosition(g.getRowsCount() + 1);
  }
  expectedResultsView.insertRow(result.getPosition(),group.getClientSideId(),new Row<ExpectedResultDTO>(result){
    @Override public boolean isSimilar(    int column,    ExpectedResultDTO userObject,    ExpectedResultDTO other){
switch (column) {
case 0:
        return userObject.getParentSpecificObjective() != null && other.getParentSpecificObjective() != null && userObject.getParentSpecificObjective().getCode() == other.getParentSpecificObjective().getCode();
    }
    return false;
  }
  @Override public Widget getWidgetAt(  int column,  final ExpectedResultDTO userObject){
switch (column) {
case 0:
      final Label parentCodeLabel=new Label();
    parentCodeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME);
  final SpecificObjectiveDTO parent;
if (userObject != null && (parent=userObject.getParentSpecificObjective()) != null) {
  final StringBuilder sb=new StringBuilder();
  sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode());
  sb.append("String_Node_Str");
  sb.append(I18N.CONSTANTS.logFrameSpecificObjectivesCode());
  sb.append("String_Node_Str");
  sb.append(specificObjectivesPolicy.getCode(parent.getCode(),parent));
  sb.append("String_Node_Str");
  parentCodeLabel.setText(sb.toString());
}
return parentCodeLabel;
case 1:
final Label codeLabel=new Label();
codeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME);
if (userObject != null) {
codeLabel.setText(userObject.getLabel());
}
final Grid grid=new Grid(1,2);
grid.setCellPadding(0);
grid.setCellSpacing(0);
grid.setWidget(0,0,codeLabel);
if (!readOnly) {
grid.setWidget(0,1,buildExpectedResultMenu(this,codeLabel));
}
return grid;
case 2:
final TextArea interventionLogicTextBox=new TextArea();
interventionLogicTextBox.setWidth("String_Node_Str");
interventionLogicTextBox.setHeight("String_Node_Str");
interventionLogicTextBox.setVisibleLines(3);
interventionLogicTextBox.addStyleName("String_Node_Str");
interventionLogicTextBox.setEnabled(!readOnly);
if (userObject != null) {
interventionLogicTextBox.setText(userObject.getInterventionLogic());
}
interventionLogicTextBox.addChangeHandler(new ChangeHandler(){
@Override public void onChange(ChangeEvent e){
userObject.setInterventionLogic(interventionLogicTextBox.getText());
fireLogFrameEdited();
}
}
);
return interventionLogicTextBox;
case 3:
return new IndicatorListWidget(dispatcher,databaseId,result);
case 4:
final TextArea risksTextBox=new TextArea();
risksTextBox.setWidth("String_Node_Str");
risksTextBox.setHeight("String_Node_Str");
risksTextBox.setVisibleLines(3);
risksTextBox.addStyleName("String_Node_Str");
risksTextBox.setEnabled(!readOnly);
if (userObject != null) {
risksTextBox.setText(userObject.getRisks());
}
risksTextBox.addChangeHandler(new ChangeHandler(){
@Override public void onChange(ChangeEvent e){
userObject.setRisks(risksTextBox.getText());
fireLogFrameEdited();
}
}
);
return risksTextBox;
case 5:
final TextArea assumptionsTextBox=new TextArea();
assumptionsTextBox.setWidth("String_Node_Str");
assumptionsTextBox.setHeight("String_Node_Str");
assumptionsTextBox.setVisibleLines(3);
assumptionsTextBox.addStyleName("String_Node_Str");
assumptionsTextBox.setEnabled(!readOnly);
if (userObject != null) {
assumptionsTextBox.setText(userObject.getAssumptions());
}
assumptionsTextBox.addChangeHandler(new ChangeHandler(){
@Override public void onChange(ChangeEvent e){
userObject.setAssumptions(assumptionsTextBox.getText());
fireLogFrameEdited();
}
}
);
return assumptionsTextBox;
default :
return null;
}
}
@Override public int getId(ExpectedResultDTO userObject){
return userObject.getClientSideId();
}
}
);
fireLogFrameEdited();
for (final LogFrameActivityDTO activity : result.getActivities()) {
addActivity(activity);
}
}

Fixed version (ground truth):
/** 
 * Adds an activity row.
 * @param result The expected result. Must not be <code>null</code>.
 */
private void addExpectedResult(final ExpectedResultDTO result){
  if (result == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final LogFrameGroupDTO group=result.getGroup();
  @SuppressWarnings("String_Node_Str") RowsGroup<LogFrameGroupDTO> g=(RowsGroup<LogFrameGroupDTO>)expectedResultsView.getGroup(group.getClientSideId());
  if (g == null) {
    g=addExpectedResultsGroup(group);
  }
  final StringBuilder sb=new StringBuilder();
  sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode());
  sb.append("String_Node_Str");
  sb.append(result.getFormattedCode());
  result.setLabel(sb.toString());
  if (result.getPosition() == null) {
    result.setPosition(g.getRowsCount() + 1);
  }
  expectedResultsView.insertRow(result.getPosition(),group.getClientSideId(),new Row<ExpectedResultDTO>(result){
    @Override public boolean isSimilar(    int column,    ExpectedResultDTO userObject,    ExpectedResultDTO other){
switch (column) {
case 0:
        return userObject.getParentSpecificObjective() != null && other.getParentSpecificObjective() != null && userObject.getParentSpecificObjective().getCode() == other.getParentSpecificObjective().getCode();
    }
    return false;
  }
  @Override public Widget getWidgetAt(  int column,  final ExpectedResultDTO userObject){
switch (column) {
case 0:
      final Label parentCodeLabel=new Label();
    parentCodeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME);
  final SpecificObjectiveDTO parent;
if (userObject != null && (parent=userObject.getParentSpecificObjective()) != null) {
  final StringBuilder sb=new StringBuilder();
  sb.append(I18N.CONSTANTS.logFrameExceptedResultsCode());
  sb.append("String_Node_Str");
  sb.append(I18N.CONSTANTS.logFrameSpecificObjectivesCode());
  sb.append("String_Node_Str");
  sb.append(parent.getFormattedCode());
  sb.append("String_Node_Str");
  parentCodeLabel.setText(sb.toString());
}
return parentCodeLabel;
case 1:
final Label codeLabel=new Label();
codeLabel.addStyleName(CSS_CODE_LABEL_STYLE_NAME);
if (userObject != null) {
codeLabel.setText(userObject.getLabel());
}
final Grid grid=new Grid(1,2);
grid.setCellPadding(0);
grid.setCellSpacing(0);
grid.setWidget(0,0,codeLabel);
if (!readOnly) {
grid.setWidget(0,1,buildExpectedResultMenu(this,codeLabel));
}
return grid;
case 2:
final TextArea interventionLogicTextBox=new TextArea();
interventionLogicTextBox.setWidth("String_Node_Str");
interventionLogicTextBox.setHeight("String_Node_Str");
interventionLogicTextBox.setVisibleLines(3);
interventionLogicTextBox.addStyleName("String_Node_Str");
interventionLogicTextBox.setEnabled(!readOnly);
if (userObject != null) {
interventionLogicTextBox.setText(userObject.getInterventionLogic());
}
interventionLogicTextBox.addChangeHandler(new ChangeHandler(){
@Override public void onChange(ChangeEvent e){
userObject.setInterventionLogic(interventionLogicTextBox.getText());
fireLogFrameEdited();
}
}
);
return interventionLogicTextBox;
case 3:
return new IndicatorListWidget(dispatcher,databaseId,result);
case 4:
final TextArea risksTextBox=new TextArea();
risksTextBox.setWidth("String_Node_Str");
risksTextBox.setHeight("String_Node_Str");
risksTextBox.setVisibleLines(3);
risksTextBox.addStyleName("String_Node_Str");
risksTextBox.setEnabled(!readOnly);
if (userObject != null) {
risksTextBox.setText(userObject.getRisks());
}
risksTextBox.addChangeHandler(new ChangeHandler(){
@Override public void onChange(ChangeEvent e){
userObject.setRisks(risksTextBox.getText());
fireLogFrameEdited();
}
}
);
return risksTextBox;
case 5:
final TextArea assumptionsTextBox=new TextArea();
assumptionsTextBox.setWidth("String_Node_Str");
assumptionsTextBox.setHeight("String_Node_Str");
assumptionsTextBox.setVisibleLines(3);
assumptionsTextBox.addStyleName("String_Node_Str");
assumptionsTextBox.setEnabled(!readOnly);
if (userObject != null) {
assumptionsTextBox.setText(userObject.getAssumptions());
}
assumptionsTextBox.addChangeHandler(new ChangeHandler(){
@Override public void onChange(ChangeEvent e){
userObject.setAssumptions(assumptionsTextBox.getText());
fireLogFrameEdited();
}
}
);
return assumptionsTextBox;
default :
return null;
}
}
@Override public int getId(ExpectedResultDTO userObject){
return userObject.getClientSideId();
}
}
);
fireLogFrameEdited();
for (final LogFrameActivityDTO activity : result.getActivities()) {
addActivity(activity);
}
}