Program: 24816
Project: 24816
Buggy source:
public void drawRateMatrixValues(){
  FlexCellFormatter formatter=this.matrix.getFlexCellFormatter();
  for (int i=0; i < attributes.size(); i++) {
    for (int j=0, widgetCount=0; j < softwarePackages.size(); j++, ++widgetCount) {
      int tID=attributes.get(i).getId();
      int eID=softwarePackages.get(j).getId();
      int value=getValueFromlistOfRateValues(eID,tID);
      if (isReadOnly) {
        Label valueLabel=new Label(String.valueOf(value));
        valueLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        if (j == 0) {
          matrix.setWidget(1,i + 1,valueLabel);
          formatter.setHorizontalAlignment(1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(1,i + 1,"String_Node_Str");
          ++widgetCount;
        }
 else {
          matrix.setWidget(widgetCount + 1,i + 1,valueLabel);
          formatter.setHorizontalAlignment(widgetCount + 1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(widgetCount + 1,i + 1,"String_Node_Str");
        }
      }
 else {
        final RateValueTextbox rateValueTextbox=new RateValueTextbox(tID,eID,value);
        rateValueTextbox.setTextAlignment(TextBox.ALIGN_CENTER);
        rateValueTextbox.addKeyPressHandler(new KeyPressHandler(){
          public void onKeyPress(          KeyPressEvent event){
            char keyCode=event.getCharCode();
            if (((keyCode < '0' || keyCode > '3')) && (keyCode != (char)KeyCodes.KEY_TAB) && (keyCode != (char)KeyCodes.KEY_BACKSPACE)&& (keyCode != (char)KeyCodes.KEY_DELETE)&& (keyCode != (char)KeyCodes.KEY_ENTER)&& (keyCode != (char)KeyCodes.KEY_HOME)&& (keyCode != (char)KeyCodes.KEY_END)&& (keyCode != (char)KeyCodes.KEY_LEFT)&& (keyCode != (char)KeyCodes.KEY_UP)&& (keyCode != (char)KeyCodes.KEY_RIGHT)&& (keyCode != (char)KeyCodes.KEY_DOWN)) {
              rateValueTextbox.cancelKey();
            }
          }
        }
);
        rateValueTextbox.addFocusHandler(new FocusHandler(){
          public void onFocus(          FocusEvent event){
            rateValueTextbox.setSelectionRange(0,rateValueTextbox.getText().length());
          }
        }
);
        rateValueTextbox.addChangeHandler(new ChangeHandler(){
          public void onChange(          ChangeEvent event){
            if (rateValueTextbox.getText().trim().length() == 0) {
              rateValueTextbox.setText("String_Node_Str");
            }
            char keyCode;
            if (rateValueTextbox.getText().trim().length() == 1) {
              keyCode=rateValueTextbox.getText().trim().charAt(0);
              if (keyCode >= '0' && keyCode <= '3') {
                getTotalsFromMatrix();
                setRateValue(rateValueTextbox.getTecniqueID(),rateValueTextbox.getEvaluationID(),Integer.parseInt(rateValueTextbox.getText()));
                rateValueTextbox.setOldValue(rateValueTextbox.getText());
              }
 else {
                rateValueTextbox.setText(rateValueTextbox.getOldValue());
              }
            }
 else {
              rateValueTextbox.setText(rateValueTextbox.getOldValue());
            }
          }
        }
);
        if (j == 0) {
          matrix.setWidget(1,i + 1,rateValueTextbox);
          formatter.setHorizontalAlignment(1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(1,i + 1,"String_Node_Str");
          ++widgetCount;
        }
 else {
          matrix.setWidget(widgetCount + 1,i + 1,rateValueTextbox);
          formatter.setHorizontalAlignment(widgetCount + 1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(widgetCount + 1,i + 1,"String_Node_Str");
        }
      }
      RateValueLabel totalLabel=new RateValueLabel(attributes.get(i).getId());
      totalLabel.setText("String_Node_Str");
      if (widgetCount > 1) {
        matrix.setWidget(widgetCount + 1,attributes.size() + 1,totalLabel);
        formatter.setHorizontalAlignment(widgetCount + 1,attributes.size() + 1,HasHorizontalAlignment.ALIGN_CENTER);
        formatter.setStyleName(widgetCount + 1,attributes.size() + 1,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void drawRateMatrixValues(){
  FlexCellFormatter formatter=this.matrix.getFlexCellFormatter();
  for (int i=0; i < attributes.size(); i++) {
    for (int j=0, widgetCount=0; j < softwarePackages.size(); j++, ++widgetCount) {
      int tID=attributes.get(i).getId();
      int eID=softwarePackages.get(j).getId();
      int value=getValueFromlistOfRateValues(eID,tID);
      if (isReadOnly) {
        Label valueLabel=new Label(String.valueOf(value));
        valueLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        if (j == 0) {
          matrix.setWidget(1,i + 1,valueLabel);
          formatter.setHorizontalAlignment(1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(1,i + 1,"String_Node_Str");
          ++widgetCount;
        }
 else {
          matrix.setWidget(widgetCount + 1,i + 1,valueLabel);
          formatter.setHorizontalAlignment(widgetCount + 1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(widgetCount + 1,i + 1,"String_Node_Str");
        }
      }
 else {
        final RateValueTextbox rateValueTextbox=new RateValueTextbox(tID,eID,value);
        rateValueTextbox.setTextAlignment(TextBox.ALIGN_CENTER);
        rateValueTextbox.addKeyPressHandler(new KeyPressHandler(){
          public void onKeyPress(          KeyPressEvent event){
            char keyCode=event.getCharCode();
            if (((keyCode < '0' || keyCode > '3')) && (keyCode != (char)KeyCodes.KEY_TAB) && (keyCode != (char)KeyCodes.KEY_BACKSPACE)&& (keyCode != (char)KeyCodes.KEY_DELETE)&& (keyCode != (char)KeyCodes.KEY_ENTER)&& (keyCode != (char)KeyCodes.KEY_HOME)&& (keyCode != (char)KeyCodes.KEY_END)&& (keyCode != (char)KeyCodes.KEY_LEFT)&& (keyCode != (char)KeyCodes.KEY_UP)&& (keyCode != (char)KeyCodes.KEY_RIGHT)&& (keyCode != (char)KeyCodes.KEY_DOWN)) {
              rateValueTextbox.cancelKey();
            }
          }
        }
);
        rateValueTextbox.addFocusHandler(new FocusHandler(){
          public void onFocus(          FocusEvent event){
            rateValueTextbox.setSelectionRange(0,rateValueTextbox.getText().length());
          }
        }
);
        rateValueTextbox.addChangeHandler(new ChangeHandler(){
          public void onChange(          ChangeEvent event){
            if (rateValueTextbox.getText().trim().length() == 0) {
              rateValueTextbox.setText("String_Node_Str");
            }
            char keyCode;
            if (rateValueTextbox.getText().trim().length() == 1) {
              keyCode=rateValueTextbox.getText().trim().charAt(0);
              if (keyCode >= '0' && keyCode <= '3') {
                getTotalsFromMatrix();
                setRateValue(rateValueTextbox.getPackageID(),rateValueTextbox.getAttributeID(),Integer.parseInt(rateValueTextbox.getText()));
                rateValueTextbox.setOldValue(rateValueTextbox.getText());
              }
 else {
                rateValueTextbox.setText(rateValueTextbox.getOldValue());
              }
            }
 else {
              rateValueTextbox.setText(rateValueTextbox.getOldValue());
            }
          }
        }
);
        if (j == 0) {
          matrix.setWidget(1,i + 1,rateValueTextbox);
          formatter.setHorizontalAlignment(1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(1,i + 1,"String_Node_Str");
          ++widgetCount;
        }
 else {
          matrix.setWidget(widgetCount + 1,i + 1,rateValueTextbox);
          formatter.setHorizontalAlignment(widgetCount + 1,i + 1,HasHorizontalAlignment.ALIGN_CENTER);
          formatter.setStyleName(widgetCount + 1,i + 1,"String_Node_Str");
        }
      }
      RateValueLabel totalLabel=new RateValueLabel(attributes.get(i).getId());
      totalLabel.setText("String_Node_Str");
      if (widgetCount > 1) {
        matrix.setWidget(widgetCount + 1,attributes.size() + 1,totalLabel);
        formatter.setHorizontalAlignment(widgetCount + 1,attributes.size() + 1,HasHorizontalAlignment.ALIGN_CENTER);
        formatter.setStyleName(widgetCount + 1,attributes.size() + 1,"String_Node_Str");
      }
    }
  }
}