Program: 35615
Project: 35615
Buggy source:
@Override public void importModel(InputStream inputStream,EntityManager em,Authentication authentication) throws ExportException {
  ObjectInputStream objectInputStream;
  em.getTransaction().begin();
  try {
    objectInputStream=new ObjectInputStream(inputStream);
    ProjectModel projectModel=(ProjectModel)objectInputStream.readObject();
    projectModel.setStatus(ProjectModelStatus.DRAFT);
    final HashMap<Object,Object> modelesReset=new HashMap<Object,Object>();
    final HashSet<Object> modelesImport=new HashSet<Object>();
    projectModel.resetImport(modelesReset,modelesImport);
    saveProjectFlexibleElement(projectModel,em,modelesReset,modelesImport);
    final ProjectModelVisibility visibility=new ProjectModelVisibility();
    visibility.setModel(projectModel);
    visibility.setType(projectModelType);
    visibility.setOrganization(authentication.getUser().getOrganization());
    final ArrayList<ProjectModelVisibility> visibilities=new ArrayList<ProjectModelVisibility>();
    visibilities.add(visibility);
    projectModel.setVisibilities(visibilities);
    projectModel.setStatus(ProjectModelStatus.DRAFT);
    for (    PhaseModel pm : projectModel.getPhases()) {
      for (      LayoutGroup lg : pm.getLayout().getGroups()) {
        for (        LayoutConstraint lc : lg.getConstraints()) {
          FlexibleElement fe=lc.getElement();
          System.out.println(fe.getClass() + "String_Node_Str" + fe.getId());
          if (fe instanceof QuestionElement) {
            for (            QuestionChoiceElement qce : ((QuestionElement)fe).getChoices()) {
              System.out.println(qce.getClass() + "String_Node_Str" + qce.getId());
            }
          }
        }
      }
    }
    em.merge(projectModel);
    em.getTransaction().commit();
    LOG.debug("String_Node_Str" + projectModel.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    LOG.debug("String_Node_Str",e);
    throw new ExportException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void importModel(InputStream inputStream,EntityManager em,Authentication authentication) throws ExportException {
  ObjectInputStream objectInputStream;
  em.getTransaction().begin();
  try {
    objectInputStream=new ObjectInputStream(inputStream);
    ProjectModel projectModel=(ProjectModel)objectInputStream.readObject();
    projectModel.setStatus(ProjectModelStatus.DRAFT);
    final HashMap<Object,Object> modelesReset=new HashMap<Object,Object>();
    final HashSet<Object> modelesImport=new HashSet<Object>();
    projectModel.resetImport(modelesReset,modelesImport);
    saveProjectFlexibleElement(projectModel,em,modelesReset,modelesImport,authentication);
    final ProjectModelVisibility visibility=new ProjectModelVisibility();
    visibility.setModel(projectModel);
    visibility.setType(projectModelType);
    visibility.setOrganization(authentication.getUser().getOrganization());
    final ArrayList<ProjectModelVisibility> visibilities=new ArrayList<ProjectModelVisibility>();
    visibilities.add(visibility);
    projectModel.setVisibilities(visibilities);
    projectModel.setStatus(ProjectModelStatus.DRAFT);
    for (    PhaseModel pm : projectModel.getPhases()) {
      for (      LayoutGroup lg : pm.getLayout().getGroups()) {
        for (        LayoutConstraint lc : lg.getConstraints()) {
          FlexibleElement fe=lc.getElement();
          System.out.println(fe.getClass() + "String_Node_Str" + fe.getId());
          if (fe instanceof QuestionElement) {
            for (            QuestionChoiceElement qce : ((QuestionElement)fe).getChoices()) {
              System.out.println(qce.getClass() + "String_Node_Str" + qce.getId());
            }
          }
        }
      }
    }
    em.merge(projectModel);
    em.getTransaction().commit();
    LOG.debug("String_Node_Str" + projectModel.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    LOG.debug("String_Node_Str",e);
    throw new ExportException("String_Node_Str",e);
  }
}