Program: 118873
Project: 118873
Buggy source:
/** 
 * Initialize all components for the defined section for this node.
 */
public synchronized void addComponents(boolean forceRedraw,boolean reInitialize,int height){
  if (elem == null || composite.isDisposed()) {
    return;
  }
  checkErrorsWhenViewRefreshed=true;
  int heightSize=0, maxRowSize=0, nbInRow, numInRow;
  int maxRow;
  boolean isCompute=false;
  if (!forceRedraw) {
    boolean needRedraw=isNeedRedraw();
    if (!needRedraw) {
      return;
    }
  }
  Control lastControl=null;
  if (reInitialize) {
    if (currentComponent != null) {
      disposeChildren();
    }
  }
 else {
    heightSize=height;
  }
  final List<IElementParameter> currentValidParameters=new ArrayList<IElementParameter>(20);
  hashCurControls=new DualHashBidiMap();
  maxRow=0;
  List<? extends IElementParameter> listParam=elem.getElementParametersWithChildrens();
  Map<String,Integer> groupPosition=new HashMap<String,Integer>();
  for (int i=0; i < listParam.size(); i++) {
    IElementParameter param=listParam.get(i);
    if (param.getCategory() == section && param.getFieldType() != EParameterFieldType.TECHNICAL && param.isShow(listParam)) {
      currentValidParameters.add(param);
      if (param.getNumRow() > maxRow) {
        maxRow=param.getNumRow();
      }
    }
  }
  IElementParameter synchronizeSchemaParam=elem.getElementParameter(EParameterName.NOT_SYNCHRONIZED_SCHEMA.getName());
  if (synchronizeSchemaParam != null) {
    synchronizeSchemaParam.setShow(!((Node)elem).isSchemaSynchronized());
    IElementParameter schemaTypeParam=synchronizeSchemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
    if (schemaTypeParam != null) {
      schemaTypeParam.setReadOnly(((Node)elem).isSchemaSynchronized());
    }
  }
  generator.initController(this);
  int additionalHeightSize=0;
  boolean hasDynamicRow=false;
  for (int i=0; i < currentValidParameters.size(); i++) {
    IElementParameter curParam=currentValidParameters.get(i);
    AbstractElementPropertySectionController controller=generator.getController(curParam.getFieldType(),this);
    if (controller == null) {
      continue;
    }
    if (controller.hasDynamicRowSize()) {
      hasDynamicRow=true;
      break;
    }
  }
  if (hasDynamicRow) {
    additionalHeightSize=estimatePropertyHeightSize(maxRow,listParam);
  }
  for (int curRow=1; curRow <= maxRow; curRow++) {
    maxRowSize=0;
    nbInRow=0;
    for (int i=0; i < currentValidParameters.size(); i++) {
      IElementParameter curParam=currentValidParameters.get(i);
      if (curParam.getNumRow() == curRow) {
        nbInRow++;
      }
    }
    numInRow=0;
    lastControl=null;
    curRowSize=0;
    for (int i=0; i < currentValidParameters.size(); i++) {
      IElementParameter curParam=currentValidParameters.get(i);
      updateParameter(curParam);
      if (curParam.getNumRow() == curRow && isShouldDisParameter(curParam)) {
        numInRow++;
        AbstractElementPropertySectionController controller=generator.getController(curParam.getFieldType(),this);
        if (controller == null) {
          continue;
        }
        if (controller.hasDynamicRowSize()) {
          controller.setAdditionalHeightSize(additionalHeightSize);
        }
        String groupName=curParam.getGroup();
        Composite subComposite=null;
        Control cutLastControl=lastControl;
        int curNumInRow=numInRow;
        int curNbInRow=nbInRow;
        int curTop=0;
        if (groupName != null) {
          if (!hashCurControls.containsKey(groupName)) {
            if (groupPosition.size() > 0) {
              heightSize+=DEFAULT_GROUP_HEIGHT;
            }
            new GroupController(this).createControl(composite,curParam,numInRow,nbInRow,heightSize,lastControl);
            groupPosition.put(groupName,heightSize);
          }
          subComposite=(Composite)hashCurControls.get(groupName);
          int h2=heightSize - groupPosition.get(groupName);
          lastControl=controller.createControl(subComposite,curParam,numInRow,nbInRow,h2,lastControl);
        }
 else {
          if (isCompactView()) {
            int h3=DEFAULT_GROUP_HEIGHT * (groupPosition.size() > 0 ? 1 : 0) + heightSize;
            lastControl=controller.createControl(composite,curParam,numInRow,nbInRow,h3,lastControl);
          }
 else {
            if (numInRow > 1 && nbInRow > 1) {
              heightSize+=maxRowSize;
            }
            int h3=DEFAULT_GROUP_HEIGHT * (groupPosition.size() > 0 ? 1 : 0) + heightSize;
            lastControl=controller.createControl(composite,curParam,1,1,h3,null);
          }
        }
        if (curRowSize > maxRowSize) {
          maxRowSize=curRowSize;
        }
        if (!isCompactView()) {
          if (numInRow > 1 && nbInRow > 1) {
            heightSize+=maxRowSize;
          }
          curNumInRow=1;
          curNbInRow=1;
          cutLastControl=null;
        }
        if (groupName != null) {
          if (!hashCurControls.containsKey(groupName)) {
            if (groupPosition.size() > 0) {
              heightSize+=DEFAULT_GROUP_HEIGHT;
            }
            new GroupController(this).createControl(composite,curParam,numInRow,nbInRow,heightSize,lastControl);
            groupPosition.put(groupName,heightSize);
          }
          subComposite=(Composite)hashCurControls.get(groupName);
          curTop=heightSize - groupPosition.get(groupName);
        }
 else {
          subComposite=composite;
          curTop=DEFAULT_GROUP_HEIGHT * (groupPosition.size() > 0 ? 1 : 0) + heightSize;
        }
        lastControl=controller.createControl(subComposite,curParam,curNumInRow,curNbInRow,curTop,cutLastControl);
        if (curRowSize > maxRowSize) {
          maxRowSize=curRowSize;
        }
      }
    }
    heightSize+=maxRowSize;
  }
  if (synchronizeSchemaParam != null) {
    synchronizeSchemaParam.setShow(false);
  }
  resizeScrolledComposite();
}

Fixed version (ground truth):
/** 
 * Initialize all components for the defined section for this node.
 */
public synchronized void addComponents(boolean forceRedraw,boolean reInitialize,int height){
  if (elem == null || composite.isDisposed()) {
    return;
  }
  checkErrorsWhenViewRefreshed=true;
  int heightSize=0, maxRowSize=0, nbInRow, numInRow;
  int maxRow;
  boolean isCompute=false;
  if (!forceRedraw) {
    boolean needRedraw=isNeedRedraw();
    if (!needRedraw) {
      return;
    }
  }
  Control lastControl=null;
  if (reInitialize) {
    if (currentComponent != null) {
      disposeChildren();
    }
  }
 else {
    heightSize=height;
  }
  final List<IElementParameter> currentValidParameters=new ArrayList<IElementParameter>(20);
  hashCurControls=new DualHashBidiMap();
  maxRow=0;
  List<? extends IElementParameter> listParam=elem.getElementParametersWithChildrens();
  Map<String,Integer> groupPosition=new HashMap<String,Integer>();
  for (int i=0; i < listParam.size(); i++) {
    IElementParameter param=listParam.get(i);
    if (param.getCategory() == section && param.getFieldType() != EParameterFieldType.TECHNICAL && param.isShow(listParam)) {
      currentValidParameters.add(param);
      if (param.getNumRow() > maxRow) {
        maxRow=param.getNumRow();
      }
    }
  }
  IElementParameter synchronizeSchemaParam=elem.getElementParameter(EParameterName.NOT_SYNCHRONIZED_SCHEMA.getName());
  if (synchronizeSchemaParam != null) {
    synchronizeSchemaParam.setShow(!((Node)elem).isSchemaSynchronized());
    IElementParameter schemaTypeParam=synchronizeSchemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
    if (schemaTypeParam != null) {
      schemaTypeParam.setReadOnly(((Node)elem).isSchemaSynchronized());
    }
  }
  generator.initController(this);
  int additionalHeightSize=0;
  boolean hasDynamicRow=false;
  for (int i=0; i < currentValidParameters.size(); i++) {
    IElementParameter curParam=currentValidParameters.get(i);
    AbstractElementPropertySectionController controller=generator.getController(curParam.getFieldType(),this);
    if (controller == null) {
      continue;
    }
    if (controller.hasDynamicRowSize()) {
      hasDynamicRow=true;
      break;
    }
  }
  if (hasDynamicRow) {
    additionalHeightSize=estimatePropertyHeightSize(maxRow,listParam);
  }
  for (int curRow=1; curRow <= maxRow; curRow++) {
    maxRowSize=0;
    nbInRow=0;
    for (int i=0; i < currentValidParameters.size(); i++) {
      IElementParameter curParam=currentValidParameters.get(i);
      if (curParam.getNumRow() == curRow) {
        nbInRow++;
      }
    }
    numInRow=0;
    lastControl=null;
    curRowSize=0;
    for (int i=0; i < currentValidParameters.size(); i++) {
      IElementParameter curParam=currentValidParameters.get(i);
      updateParameter(curParam);
      if (curParam.getNumRow() == curRow && isShouldDisParameter(curParam)) {
        numInRow++;
        AbstractElementPropertySectionController controller=generator.getController(curParam.getFieldType(),this);
        if (controller == null) {
          continue;
        }
        if (controller.hasDynamicRowSize()) {
          controller.setAdditionalHeightSize(additionalHeightSize);
        }
        String groupName=curParam.getGroup();
        Composite subComposite=null;
        Control cutLastControl=lastControl;
        int curNumInRow=numInRow;
        int curNbInRow=nbInRow;
        int curTop=0;
        if (!isCompactView()) {
          if (numInRow > 1 && nbInRow > 1) {
            heightSize+=maxRowSize;
          }
          curNumInRow=1;
          curNbInRow=1;
          cutLastControl=null;
        }
        if (groupName != null) {
          if (!hashCurControls.containsKey(groupName)) {
            if (groupPosition.size() > 0) {
              heightSize+=DEFAULT_GROUP_HEIGHT;
            }
            new GroupController(this).createControl(composite,curParam,numInRow,nbInRow,heightSize,lastControl);
            groupPosition.put(groupName,heightSize);
          }
          subComposite=(Composite)hashCurControls.get(groupName);
          curTop=heightSize - groupPosition.get(groupName);
        }
 else {
          subComposite=composite;
          curTop=DEFAULT_GROUP_HEIGHT * (groupPosition.size() > 0 ? 1 : 0) + heightSize;
        }
        lastControl=controller.createControl(subComposite,curParam,curNumInRow,curNbInRow,curTop,cutLastControl);
        if (curRowSize > maxRowSize) {
          maxRowSize=curRowSize;
        }
      }
    }
    heightSize+=maxRowSize;
  }
  if (synchronizeSchemaParam != null) {
    synchronizeSchemaParam.setShow(false);
  }
  resizeScrolledComposite();
}