Program: 101988
Project: 101988
Buggy source:
/** 
 * Overridden method from   {@link StructuralCopyModelFeaturePopulator}.  Copy selected nodes of the source model to the target.  Overridden because also have to do transformations on tables and procedures.
 * @param sourceModelResource modelResource containing the old information
 * @param targetResource        the target
 * @param extraProperties       optional properties to tweak creation of objects.Currently, this only deals with whether virtual tables have their supportsUpdate properties cleared.  See TransformationNewModelObjectHelper for details.
 * @param copyAllDescriptions option to copy or suppress copying all descriptions
 * @param monitor               a progress monitor
 * @throws ModelerCoreException 
 */
@Override public void copyModel(ModelResource sourceModelResource,ModelResource targetModelResource,Map extraProperties,boolean copyAllDescriptions,IProgressMonitor monitor) throws ModelerCoreException {
  List sourceFirstLevelChildren=sourceModelResource.getEObjects();
  int jdbcSourceIndex=-1;
  for (int i=0; i < sourceFirstLevelChildren.size(); i++) {
    EObject nextObj=(EObject)sourceFirstLevelChildren.get(i);
    if (ModelObjectUtilities.isJdbcSource(nextObj)) {
      jdbcSourceIndex=i;
      break;
    }
  }
  if (jdbcSourceIndex > -1) {
    sourceFirstLevelChildren.remove(jdbcSourceIndex);
  }
  if (copyAllDescriptions) {
    List allRootContents=sourceModelResource.getEmfResource().getContents();
    for (Iterator iter=allRootContents.iterator(); iter.hasNext(); ) {
      EObject nextChild=(EObject)iter.next();
      if (nextChild instanceof AnnotationContainer) {
        sourceFirstLevelChildren.add(nextChild);
        break;
      }
    }
  }
  Collection sourceFirstLevelChildrenCopies=null;
  final Map originalsToCopies=new HashMap();
  try {
    sourceFirstLevelChildrenCopies=modelEditor.copyAll(sourceFirstLevelChildren,originalsToCopies);
  }
 catch (  ModelerCoreException ex) {
    throw ex;
  }
  final Map copiesToOriginals=invertMap(originalsToCopies);
  List targetFirstLevelChildren=targetModelResource.getEmfResource().getContents();
  int numInitialFirstLevelNodes=targetFirstLevelChildren.size();
  targetModelResource.getEmfResource().getContents().addAll(sourceFirstLevelChildrenCopies);
  List copiedFirstLevelChildrenList=targetModelResource.getEmfResource().getContents();
  List modifiedCopiedFirstLevelChildrenList=new ArrayList(copiedFirstLevelChildrenList.size() - numInitialFirstLevelNodes);
  for (int i=numInitialFirstLevelNodes; i < copiedFirstLevelChildrenList.size(); i++) {
    modifiedCopiedFirstLevelChildrenList.add(copiedFirstLevelChildrenList.get(i));
  }
  doTransformations(copiesToOriginals,modifiedCopiedFirstLevelChildrenList,extraProperties);
}

Fixed version (ground truth):
/** 
 * Overridden method from   {@link StructuralCopyModelFeaturePopulator}.  Copy selected nodes of the source model to the target.  Overridden because also have to do transformations on tables and procedures.
 * @param sourceModelResource modelResource containing the old information
 * @param targetResource        the target
 * @param extraProperties       optional properties to tweak creation of objects.Currently, this only deals with whether virtual tables have their supportsUpdate properties cleared.  See TransformationNewModelObjectHelper for details.
 * @param copyAllDescriptions option to copy or suppress copying all descriptions
 * @param monitor               a progress monitor
 * @throws ModelerCoreException 
 */
@Override public void copyModel(ModelResource sourceModelResource,ModelResource targetModelResource,Map extraProperties,boolean copyAllDescriptions,IProgressMonitor monitor) throws ModelerCoreException {
  List sourceFirstLevelChildren=sourceModelResource.getEObjects();
  int jdbcSourceIndex=-1;
  for (int i=0; i < sourceFirstLevelChildren.size(); i++) {
    EObject nextObj=(EObject)sourceFirstLevelChildren.get(i);
    if (ModelObjectUtilities.isJdbcSource(nextObj)) {
      jdbcSourceIndex=i;
      break;
    }
  }
  if (jdbcSourceIndex > -1) {
    sourceFirstLevelChildren.remove(jdbcSourceIndex);
  }
  if (copyAllDescriptions) {
    List allRootContents=sourceModelResource.getEmfResource().getContents();
    for (Iterator iter=allRootContents.iterator(); iter.hasNext(); ) {
      EObject nextChild=(EObject)iter.next();
      if (nextChild instanceof AnnotationContainer) {
        sourceFirstLevelChildren.add(nextChild);
        break;
      }
    }
  }
  Collection sourceFirstLevelChildrenCopies=null;
  final Map originalsToCopies=new HashMap();
  try {
    sourceFirstLevelChildrenCopies=ModelerCore.getModelEditor().copyAll(sourceFirstLevelChildren,originalsToCopies);
  }
 catch (  ModelerCoreException ex) {
    throw ex;
  }
  final Map copiesToOriginals=invertMap(originalsToCopies);
  List targetFirstLevelChildren=targetModelResource.getEmfResource().getContents();
  int numInitialFirstLevelNodes=targetFirstLevelChildren.size();
  targetModelResource.getEmfResource().getContents().addAll(sourceFirstLevelChildrenCopies);
  List copiedFirstLevelChildrenList=targetModelResource.getEmfResource().getContents();
  List modifiedCopiedFirstLevelChildrenList=new ArrayList(copiedFirstLevelChildrenList.size() - numInitialFirstLevelNodes);
  for (int i=numInitialFirstLevelNodes; i < copiedFirstLevelChildrenList.size(); i++) {
    modifiedCopiedFirstLevelChildrenList.add(copiedFirstLevelChildrenList.get(i));
  }
  doTransformations(copiesToOriginals,modifiedCopiedFirstLevelChildrenList,extraProperties);
}