Program: 76440
Project: 76440
Buggy source:
public Object[] getChildren(Object parentElement){
  if (parentElement instanceof Object[]) {
    return (Object[])parentElement;
  }
  if (parentElement instanceof DimensionHandle) {
    HierarchyHandle hierarchy=(HierarchyHandle)((DimensionHandle)parentElement).getContent(DimensionHandle.HIERARCHIES_PROP,0);
    if (hierarchy.getLevelCount() > 0)     return new Object[]{hierarchy.getLevel(0)};
 else {
      virtualLevel.setModel(parentElement);
      return new Object[]{virtualLevel};
    }
  }
  if (parentElement instanceof CubeHandle) {
    CubeHandle handle=(CubeHandle)parentElement;
    if (dimension == null)     dimension=new CubeModel(handle,CubeModel.TYPE_DIMENSION);
 else     if (dimension.getModel() != handle)     dimension.setModel(handle);
    if (measures == null)     measures=new CubeModel(handle,CubeModel.TYPE_MEASURES);
 else     if (measures.getModel() != handle)     measures.setModel(handle);
    return new Object[]{dimension,measures};
  }
  if (parentElement instanceof CubeModel) {
    CubeModel model=(CubeModel)parentElement;
    if (model.getType() == CubeModel.TYPE_DIMENSION) {
      Object[] dimensions=model.getModel().getContents(CubeHandle.DIMENSIONS_PROP).toArray();
      if (dimensions == null || dimensions.length == 0) {
        TabularDimensionHandle dimension=DesignElementFactory.getInstance().newTabularDimension("String_Node_Str");
        try {
          model.getModel().add(CubeHandle.DIMENSIONS_PROP,dimension);
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
      return model.getModel().getContents(CubeHandle.DIMENSIONS_PROP).toArray();
    }
    if (model.getType() == CubeModel.TYPE_MEASURES) {
      Object[] measures=model.getModel().getContents(CubeHandle.MEASURE_GROUPS_PROP).toArray();
      if (measures == null || measures.length == 0) {
        TabularMeasureGroupHandle measureGroup=DesignElementFactory.getInstance().newTabularMeasureGroup("String_Node_Str");
        try {
          model.getModel().add(CubeHandle.MEASURE_GROUPS_PROP,measureGroup);
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
      return model.getModel().getContents(CubeHandle.MEASURE_GROUPS_PROP).toArray();
    }
  }
  if (parentElement instanceof LevelHandle) {
    HierarchyHandle hierarchy=(HierarchyHandle)((LevelHandle)parentElement).getContainer();
    int pos=((LevelHandle)parentElement).getIndex();
    return new Object[]{hierarchy.getLevel(pos + 1)};
  }
  if (parentElement instanceof MeasureGroupHandle) {
    Object[] measures=((MeasureGroupHandle)parentElement).getContents(MeasureGroupHandle.MEASURES_PROP).toArray();
    if (measures == null || measures.length == 0) {
      virtualMeasure.setModel(parentElement);
      return new Object[]{virtualMeasure};
    }
 else     return measures;
  }
  return new Object[0];
}

Fixed version (ground truth):
public Object[] getChildren(Object parentElement){
  if (parentElement instanceof Object[]) {
    return (Object[])parentElement;
  }
  if (parentElement instanceof DimensionHandle) {
    HierarchyHandle hierarchy=(HierarchyHandle)((DimensionHandle)parentElement).getContent(DimensionHandle.HIERARCHIES_PROP,0);
    if (hierarchy.getLevelCount() > 0)     return new Object[]{hierarchy.getLevel(0)};
 else {
      virtualLevel.setModel(parentElement);
      return new Object[]{virtualLevel};
    }
  }
  if (parentElement instanceof CubeHandle) {
    CubeHandle handle=(CubeHandle)parentElement;
    if (dimension == null)     dimension=new CubeModel(handle,CubeModel.TYPE_DIMENSION);
 else     if (dimension.getModel() != handle)     dimension.setModel(handle);
    if (measures == null)     measures=new CubeModel(handle,CubeModel.TYPE_MEASURES);
 else     if (measures.getModel() != handle)     measures.setModel(handle);
    return new Object[]{dimension,measures};
  }
  if (parentElement instanceof CubeModel) {
    CubeModel model=(CubeModel)parentElement;
    if (model.getType() == CubeModel.TYPE_DIMENSION) {
      return model.getModel().getContents(CubeHandle.DIMENSIONS_PROP).toArray();
    }
    if (model.getType() == CubeModel.TYPE_MEASURES) {
      return model.getModel().getContents(CubeHandle.MEASURE_GROUPS_PROP).toArray();
    }
  }
  if (parentElement instanceof LevelHandle) {
    HierarchyHandle hierarchy=(HierarchyHandle)((LevelHandle)parentElement).getContainer();
    int pos=((LevelHandle)parentElement).getIndex();
    return new Object[]{hierarchy.getLevel(pos + 1)};
  }
  if (parentElement instanceof MeasureGroupHandle) {
    Object[] measures=((MeasureGroupHandle)parentElement).getContents(MeasureGroupHandle.MEASURES_PROP).toArray();
    if (measures == null || measures.length == 0) {
      virtualMeasure.setModel(parentElement);
      return new Object[]{virtualMeasure};
    }
 else     return measures;
  }
  return new Object[0];
}