Program: 70397
Project: 70397
Buggy source:
public SplitResult splitLines(int lineCount) throws BirtException {
  if (isPageBreakInsideAvoid()) {
    if (isPageBreakBeforeAvoid()) {
      return SplitResult.BEFORE_AVOID_WITH_NULL;
    }
 else {
      return SplitResult.SUCCEED_WITH_NULL;
    }
  }
  int contentHeight=getContentHeight();
  LinkedList result=new LinkedList();
  int size=children.size();
  SplitResult childSplit=null;
  int status=SplitResult.SPLIT_BREFORE_AVOID_WITH_NULL;
  for (int i=size - 1; i >= 0; i--) {
    ContainerArea child=(ContainerArea)children.get(i);
    int ah=child.getAllocatedHeight();
    childSplit=child.splitLines(lineCount);
    if (childSplit.status == SplitResult.SPLIT_BREFORE_AVOID_WITH_NULL) {
      result.addFirst(child);
      contentHeight-=ah;
    }
 else     if (childSplit.status == SplitResult.SPLIT_SUCCEED_WITH_NULL) {
      result.addFirst(child);
      contentHeight-=ah;
      if (i > 0) {
        ContainerArea preChild=(ContainerArea)children.get(i - 1);
        if (preChild.isPageBreakAfterAvoid()) {
          continue;
        }
 else {
          status=SplitResult.SPLIT_SUCCEED_WITH_PART;
          contentHeight=contentHeight - ah + child.getAllocatedHeight();
          BlockContainerArea newContainer=cloneArea();
          newContainer.setContentHeight(contentHeight);
          Iterator iter=children.iterator();
          while (iter.hasNext()) {
            ContainerArea childArea=(ContainerArea)iter.next();
            if (!result.contains(childArea)) {
              iter.remove();
              newContainer.addChild(childArea);
              newContainer.setParent(newContainer);
            }
          }
          updateChildrenPosition();
          return new SplitResult(newContainer,SplitResult.SPLIT_SUCCEED_WITH_PART);
        }
      }
 else {
        if (isPageBreakBeforeAvoid()) {
          return SplitResult.BEFORE_AVOID_WITH_NULL;
        }
 else {
          return SplitResult.SUCCEED_WITH_NULL;
        }
      }
    }
 else     if (childSplit.status == SplitResult.SPLIT_SUCCEED_WITH_PART) {
      result.addFirst(child);
      ContainerArea splitChildArea=childSplit.getResult();
      contentHeight=contentHeight - ah + splitChildArea.getAllocatedHeight();
      BlockContainerArea newContainer=cloneArea();
      newContainer.setContentHeight(contentHeight);
      Iterator iter=children.iterator();
      while (iter.hasNext()) {
        ContainerArea childArea=(ContainerArea)iter.next();
        if (!result.contains(childArea)) {
          iter.remove();
          newContainer.addChild(childArea);
          newContainer.setParent(newContainer);
        }
      }
      newContainer.addChild(splitChildArea);
      updateChildrenPosition();
      return new SplitResult(newContainer,SplitResult.SPLIT_SUCCEED_WITH_PART);
    }
  }
  return SplitResult.BEFORE_AVOID_WITH_NULL;
}

Fixed version (ground truth):
public SplitResult splitLines(int lineCount) throws BirtException {
  if (isPageBreakInsideAvoid()) {
    if (isPageBreakBeforeAvoid()) {
      return SplitResult.BEFORE_AVOID_WITH_NULL;
    }
 else {
      return SplitResult.SUCCEED_WITH_NULL;
    }
  }
  int contentHeight=getContentHeight();
  LinkedList result=new LinkedList();
  int size=children.size();
  SplitResult childSplit=null;
  int status=SplitResult.SPLIT_BREFORE_AVOID_WITH_NULL;
  for (int i=size - 1; i >= 0; i--) {
    ContainerArea child=(ContainerArea)children.get(i);
    int ah=child.getAllocatedHeight();
    childSplit=child.splitLines(lineCount);
    if (childSplit.status == SplitResult.SPLIT_BREFORE_AVOID_WITH_NULL) {
      result.addFirst(child);
      contentHeight-=ah;
    }
 else     if (childSplit.status == SplitResult.SPLIT_SUCCEED_WITH_NULL) {
      result.addFirst(child);
      contentHeight-=ah;
      if (i > 0) {
        ContainerArea preChild=(ContainerArea)children.get(i - 1);
        if (preChild.isPageBreakAfterAvoid()) {
          continue;
        }
 else {
          status=SplitResult.SPLIT_SUCCEED_WITH_PART;
          contentHeight=contentHeight - ah + child.getAllocatedHeight();
          BlockContainerArea newContainer=cloneArea();
          newContainer.setContentHeight(contentHeight);
          Iterator iter=children.iterator();
          while (iter.hasNext()) {
            ContainerArea childArea=(ContainerArea)iter.next();
            if (!result.contains(childArea)) {
              iter.remove();
              newContainer.addChild(childArea);
              newContainer.setParent(newContainer);
            }
          }
          addRepeatedItem();
          updateChildrenPosition();
          return new SplitResult(newContainer,SplitResult.SPLIT_SUCCEED_WITH_PART);
        }
      }
 else {
        if (isPageBreakBeforeAvoid()) {
          return SplitResult.BEFORE_AVOID_WITH_NULL;
        }
 else {
          return SplitResult.SUCCEED_WITH_NULL;
        }
      }
    }
 else     if (childSplit.status == SplitResult.SPLIT_SUCCEED_WITH_PART) {
      result.addFirst(child);
      ContainerArea splitChildArea=childSplit.getResult();
      contentHeight=contentHeight - ah + splitChildArea.getAllocatedHeight();
      BlockContainerArea newContainer=cloneArea();
      newContainer.setContentHeight(contentHeight);
      Iterator iter=children.iterator();
      while (iter.hasNext()) {
        ContainerArea childArea=(ContainerArea)iter.next();
        if (!result.contains(childArea)) {
          iter.remove();
          newContainer.addChild(childArea);
          newContainer.setParent(newContainer);
        }
      }
      newContainer.addChild(splitChildArea);
      addRepeatedItem();
      updateChildrenPosition();
      return new SplitResult(newContainer,SplitResult.SPLIT_SUCCEED_WITH_PART);
    }
  }
  return SplitResult.BEFORE_AVOID_WITH_NULL;
}