nus-yam/ex-repair huggingface dataset:
Program: 62253
Project: 62253
Buggy source:
private void doSave() throws IOException {
  EditionContext context=EditionContextManager.get();
  if (context.getLastOperationIndex() <= context.getLastSavedOperationIndex()) {
    return;
  }
  StringBuilder commitMessage=new StringBuilder();
  for (int i=context.getLastSavedOperationIndex() + 1; i <= context.getLastOperationIndex(); i++) {
    AbstractEditorOperation operation=context.getOperations().get(i);
    IEditorOperationProcessor<?> processor=(IEditorOperationProcessor)processorMap.get(operation.getClass());
    if (processor instanceof IEditorCommitableProcessor) {
      ((IEditorCommitableProcessor)processor).beforeCommit(operation);
    }
    commitMessage.append(operation.getAuthor()).append("String_Node_Str").append(operation.commitMessage()).append("String_Node_Str");
  }
  saveYamlFile();
  Topology topology=EditionContextManager.getTopology();
  topologyServiceCore.save(topology);
  topologySubstitutionServive.updateSubstitutionType(topology,EditionContextManager.getCsar());
  csarService.setDependencies(topology.getId(),topology.getDependencies());
  repositoryService.commit(EditionContextManager.get().getCsar(),commitMessage.toString());
  context.setOperations(Lists.newArrayList(context.getOperations().subList(context.getLastOperationIndex() + 1,context.getOperations().size())));
  context.setLastOperationIndex(-1);
}

Fixed version (ground truth):
private void doSave() throws IOException {
  EditionContext context=EditionContextManager.get();
  if (context.getLastOperationIndex() <= context.getLastSavedOperationIndex()) {
    return;
  }
  StringBuilder commitMessage=new StringBuilder();
  for (int i=context.getLastSavedOperationIndex() + 1; i <= context.getLastOperationIndex(); i++) {
    AbstractEditorOperation operation=context.getOperations().get(i);
    IEditorOperationProcessor<?> processor=(IEditorOperationProcessor)processorMap.get(operation.getClass());
    if (processor instanceof IEditorCommitableProcessor) {
      ((IEditorCommitableProcessor)processor).beforeCommit(operation);
    }
    commitMessage.append(operation.getAuthor()).append("String_Node_Str").append(operation.commitMessage()).append("String_Node_Str");
  }
  saveYamlAndZipFile();
  Topology topology=EditionContextManager.getTopology();
  topologyServiceCore.save(topology);
  topologySubstitutionServive.updateSubstitutionType(topology,EditionContextManager.getCsar());
  csarService.setDependencies(topology.getId(),topology.getDependencies());
  repositoryService.commit(EditionContextManager.get().getCsar(),commitMessage.toString());
  context.setOperations(Lists.newArrayList(context.getOperations().subList(context.getLastOperationIndex() + 1,context.getOperations().size())));
  context.setLastOperationIndex(-1);
}
Program: 62255
Project: 62255
Buggy source:
@Override public Resource resolveResource(HttpServletRequest request,String requestPath,List<? extends Resource> locations,ResourceResolverChain chain){
  log.debug("String_Node_Str");
  ServletWebRequest webRequest=new ServletWebRequest(request);
  Map uriTemplateVars=(Map)webRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE,0);
  String csarId=(String)uriTemplateVars.get("String_Node_Str");
  if (editorService == null) {
    throw new NotFoundException("String_Node_Str");
  }
 else {
    editorService.checkAuthorization(csarId);
  }
  String[] splitted=csarId.split("String_Node_Str");
  return chain.resolveResource(request,splitted[0] + "String_Node_Str" + splitted[1]+ "String_Node_Str"+ requestPath,locations);
}

Fixed version (ground truth):
@Override public Resource resolveResource(HttpServletRequest request,String requestPath,List<? extends Resource> locations,ResourceResolverChain chain){
  log.debug("String_Node_Str");
  ServletWebRequest webRequest=new ServletWebRequest(request);
  Map uriTemplateVars=(Map)webRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE,0);
  String csarName=(String)uriTemplateVars.get("String_Node_Str");
  String csarVersion=(String)uriTemplateVars.get("String_Node_Str");
  if (csarAuthorizationFilter == null) {
    throw new NotFoundException("String_Node_Str");
  }
 else {
    csarAuthorizationFilter.checkReadAccess(new Csar(csarName,csarVersion));
  }
  return chain.resolveResource(request,csarName + "String_Node_Str" + csarVersion+ "String_Node_Str"+ requestPath,locations);
}
Program: 62256
Project: 62256
Buggy source:
@PreDestroy public void unregister(){
  log.info("String_Node_Str");
  configuration.setEditorService(null);
}

Fixed version (ground truth):
@PreDestroy public void unregister(){
  log.info("String_Node_Str");
  configuration.setCsarAuthorizationFilter(null);
}
Program: 62257
Project: 62257
Buggy source:
@PostConstruct public void register(){
  log.info("String_Node_Str");
  configuration.setEditorService(editorService);
}

Fixed version (ground truth):
@PostConstruct public void register(){
  log.info("String_Node_Str");
  configuration.setCsarAuthorizationFilter(csarAuthorizationFilter);
}
Program: 62258
Project: 62258
Buggy source:
/** 
 * Pull modifications from the git repository.
 * @param csar The concerned archive.
 * @param username The username of the git repository, null if none.
 * @param password The password of the git repository, null if none.
 * @param remoteBranch The name of the remote branch to pull from.
 */
public void pull(Csar csar,String username,String password,String remoteBranch){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
  RepositoryManager.pull(archiveGitPath,username,password,remoteBranch);
}

Fixed version (ground truth):
/** 
 * Pull modifications from the git repository.
 * @param csar The concerned archive.
 * @param username The username of the git repository, null if none.
 * @param password The password of the git repository, null if none.
 * @param remoteBranch The name of the remote branch to pull from.
 */
public void pull(Csar csar,String username,String password,String remoteBranch){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getName(),csar.getVersion());
  RepositoryManager.pull(archiveGitPath,username,password,remoteBranch);
}
Program: 62259
Project: 62259
Buggy source:
/** 
 * Get the url of the remote git repository.
 * @param csar The concerned archive.
 * @param remoteName The name of the remote
 * @return The url corresponding to the remote name.
 */
public String getRemoteUrl(Csar csar,String remoteName){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
  return RepositoryManager.getRemoteUrl(archiveGitPath,remoteName);
}

Fixed version (ground truth):
/** 
 * Get the url of the remote git repository.
 * @param csar The concerned archive.
 * @param remoteName The name of the remote
 * @return The url corresponding to the remote name.
 */
public String getRemoteUrl(Csar csar,String remoteName){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getName(),csar.getVersion());
  return RepositoryManager.getRemoteUrl(archiveGitPath,remoteName);
}
Program: 62260
Project: 62260
Buggy source:
/** 
 * Push modifications to git repository.
 * @param csar The concerned archive.
 * @param username The username of the git repository, null if none.
 * @param password The password of the git repository, null if none.
 * @param remoteBranch The name of the remote branch to push to.
 */
public void push(Csar csar,String username,String password,String remoteBranch){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
  RepositoryManager.push(archiveGitPath,username,password,remoteBranch);
}

Fixed version (ground truth):
/** 
 * Push modifications to git repository.
 * @param csar The concerned archive.
 * @param username The username of the git repository, null if none.
 * @param password The password of the git repository, null if none.
 * @param remoteBranch The name of the remote branch to push to.
 */
public void push(Csar csar,String username,String password,String remoteBranch){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getName(),csar.getVersion());
  RepositoryManager.push(archiveGitPath,username,password,remoteBranch);
}
Program: 62261
Project: 62261
Buggy source:
/** 
 * Set a remote repository.
 * @param csar The archive for which to set the remote.
 * @param remoteName The remote name.
 * @param remoteUrl The repository url.
 */
public void setRemote(Csar csar,String remoteName,String remoteUrl){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
  RepositoryManager.setRemote(archiveGitPath,remoteName,remoteUrl);
}

Fixed version (ground truth):
/** 
 * Set a remote repository.
 * @param csar The archive for which to set the remote.
 * @param remoteName The remote name.
 * @param remoteUrl The repository url.
 */
public void setRemote(Csar csar,String remoteName,String remoteUrl){
  Path archiveGitPath=csarRepositry.getExpandedCSAR(csar.getName(),csar.getVersion());
  RepositoryManager.setRemote(archiveGitPath,remoteName,remoteUrl);
}
Program: 62262
Project: 62262
Buggy source:
private void loadArchives(Path rootDirectory){
  if (!Files.exists(rootDirectory) || !Files.isDirectory(rootDirectory)) {
    log.warn("String_Node_Str",rootDirectory.toString());
    return;
  }
  SecurityContextImpl adminContext=new SecurityContextImpl();
  Set<SimpleGrantedAuthority> authorities=Sets.newHashSet();
  authorities.add(new SimpleGrantedAuthority(Role.ADMIN.name()));
  UsernamePasswordAuthenticationToken auth=new UsernamePasswordAuthenticationToken("String_Node_Str","String_Node_Str",authorities);
  adminContext.setAuthentication(auth);
  SecurityContextHolder.setContext(adminContext);
  try {
    List<Path> archives=FileUtil.listFiles(rootDirectory,"String_Node_Str");
    Collections.sort(archives);
    for (    Path archive : archives) {
      try {
        log.debug("String_Node_Str",archive.toString());
        csarUploadService.upload(archive,CSARSource.ALIEN);
      }
 catch (      CSARVersionAlreadyExistsException e) {
        log.debug("String_Node_Str",archive.toString(),e);
      }
catch (      CSARUsedInActiveDeployment e) {
        log.debug("String_Node_Str",archive.toString(),e);
      }
catch (      ParsingException e) {
        log.error("String_Node_Str",archive.toString(),e);
      }
    }
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
 finally {
    SecurityContextHolder.clearContext();
  }
}

Fixed version (ground truth):
private void loadArchives(Path rootDirectory){
  if (!Files.exists(rootDirectory) || !Files.isDirectory(rootDirectory)) {
    log.warn("String_Node_Str",rootDirectory.toString());
    return;
  }
  SecurityContextImpl adminContext=new SecurityContextImpl();
  Set<SimpleGrantedAuthority> authorities=Sets.newHashSet();
  authorities.add(new SimpleGrantedAuthority(Role.ADMIN.name()));
  UsernamePasswordAuthenticationToken auth=new UsernamePasswordAuthenticationToken("String_Node_Str","String_Node_Str",authorities);
  adminContext.setAuthentication(auth);
  SecurityContextHolder.setContext(adminContext);
  try {
    List<Path> archives=FileUtil.listFiles(rootDirectory,"String_Node_Str");
    Collections.sort(archives);
    for (    Path archive : archives) {
      try {
        log.debug("String_Node_Str",archive.toString());
        csarUploadService.upload(archive,CSARSource.ALIEN);
      }
 catch (      AlreadyExistException e) {
        log.debug("String_Node_Str",archive.toString(),e);
      }
catch (      CSARUsedInActiveDeployment e) {
        log.debug("String_Node_Str",archive.toString(),e);
      }
catch (      ParsingException e) {
        log.error("String_Node_Str",archive.toString(),e);
      }
    }
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
 finally {
    SecurityContextHolder.clearContext();
  }
}
Program: 62263
Project: 62263
Buggy source:
private List<ParsingResult<Csar>> processImport(CsarGitRepository csarGitRepository,CsarGitCheckoutLocation csarGitCheckoutLocation,String gitHash){
  Path archiveZipRoot=tempZipDirPath.resolve(csarGitRepository.getId());
  Path archiveGitRoot=tempDirPath.resolve(csarGitRepository.getId());
  Set<Path> archivePaths=csarFinderService.prepare(archiveGitRoot,archiveZipRoot,csarGitCheckoutLocation.getSubPath());
  List<ParsingResult<Csar>> parsingResult=Lists.newArrayList();
  try {
    Map<CSARDependency,CsarDependenciesBean> csarDependenciesBeans=uploadService.preParsing(archivePaths,parsingResult);
    List<CsarDependenciesBean> sorted=sort(csarDependenciesBeans);
    for (    CsarDependenciesBean csarBean : sorted) {
      if (csarGitCheckoutLocation.getLastImportedHash() != null && csarGitCheckoutLocation.getLastImportedHash().equals(gitHash)) {
        if (csarService.get(csarBean.getSelf().getName(),csarBean.getSelf().getVersion()) != null) {
          continue;
        }
      }
      ParsingResult<Csar> result=uploadService.upload(csarBean.getPath(),CSARSource.GIT);
      parsingResult.add(result);
    }
    return parsingResult;
  }
 catch (  ParsingException e) {
    throw new GitException("String_Node_Str",e);
  }
catch (  CSARVersionAlreadyExistsException e) {
    return parsingResult;
  }
catch (  CSARUsedInActiveDeployment e) {
    return parsingResult;
  }
}

Fixed version (ground truth):
private List<ParsingResult<Csar>> processImport(CsarGitRepository csarGitRepository,CsarGitCheckoutLocation csarGitCheckoutLocation,String gitHash){
  Path archiveZipRoot=tempZipDirPath.resolve(csarGitRepository.getId());
  Path archiveGitRoot=tempDirPath.resolve(csarGitRepository.getId());
  Set<Path> archivePaths=csarFinderService.prepare(archiveGitRoot,archiveZipRoot,csarGitCheckoutLocation.getSubPath());
  List<ParsingResult<Csar>> parsingResult=Lists.newArrayList();
  try {
    Map<CSARDependency,CsarDependenciesBean> csarDependenciesBeans=uploadService.preParsing(archivePaths,parsingResult);
    List<CsarDependenciesBean> sorted=sort(csarDependenciesBeans);
    for (    CsarDependenciesBean csarBean : sorted) {
      if (csarGitCheckoutLocation.getLastImportedHash() != null && csarGitCheckoutLocation.getLastImportedHash().equals(gitHash)) {
        if (csarService.get(csarBean.getSelf().getName(),csarBean.getSelf().getVersion()) != null) {
          continue;
        }
      }
      ParsingResult<Csar> result=uploadService.upload(csarBean.getPath(),CSARSource.GIT);
      parsingResult.add(result);
    }
    return parsingResult;
  }
 catch (  ParsingException e) {
    throw new GitException("String_Node_Str",e);
  }
catch (  AlreadyExistException e) {
    return parsingResult;
  }
catch (  CSARUsedInActiveDeployment e) {
    return parsingResult;
  }
}
Program: 62264
Project: 62264
Buggy source:
private void indexArchive(PluginArchive pluginArchive,Orchestrator orchestrator,Location location){
  ArchiveRoot archive=pluginArchive.getArchive();
  injectWorkSpace(archive.getNodeTypes().values(),orchestrator,location);
  injectWorkSpace(archive.getArtifactTypes().values(),orchestrator,location);
  injectWorkSpace(archive.getCapabilityTypes().values(),orchestrator,location);
  injectWorkSpace(archive.getRelationshipTypes().values(),orchestrator,location);
  List<ParsingError> parsingErrors=Lists.newArrayList();
  try {
    archiveIndexer.importArchive(archive,CSARSource.ORCHESTRATOR,pluginArchive.getArchiveFilePath(),parsingErrors);
  }
 catch (  CSARVersionAlreadyExistsException e) {
    log.info("String_Node_Str");
  }
catch (  CSARUsedInActiveDeployment e) {
    log.info("String_Node_Str" + e.getMessage());
  }
  publishLocationTypeIndexedEvent(archive.getNodeTypes().values(),orchestrator,location);
}

Fixed version (ground truth):
private void indexArchive(PluginArchive pluginArchive,Orchestrator orchestrator,Location location){
  ArchiveRoot archive=pluginArchive.getArchive();
  injectWorkSpace(archive.getNodeTypes().values(),orchestrator,location);
  injectWorkSpace(archive.getArtifactTypes().values(),orchestrator,location);
  injectWorkSpace(archive.getCapabilityTypes().values(),orchestrator,location);
  injectWorkSpace(archive.getRelationshipTypes().values(),orchestrator,location);
  List<ParsingError> parsingErrors=Lists.newArrayList();
  try {
    archiveIndexer.importArchive(archive,CSARSource.ORCHESTRATOR,pluginArchive.getArchiveFilePath(),parsingErrors);
  }
 catch (  AlreadyExistException e) {
    log.info("String_Node_Str");
  }
catch (  CSARUsedInActiveDeployment e) {
    log.info("String_Node_Str" + e.getMessage());
  }
  publishLocationTypeIndexedEvent(archive.getNodeTypes().values(),orchestrator,location);
}
Program: 62265
Project: 62265
Buggy source:
/** 
 * Index archives defined at the orchestrator level by a plugin.
 * @param orchestratorFactory The orchestrator factory.
 * @param orchestratorInstance The instance of the orchestrator (created by the factory).
 */
public void indexOrchestratorArchives(IOrchestratorPluginFactory<IOrchestratorPlugin<?>,?> orchestratorFactory,IOrchestratorPlugin<Object> orchestratorInstance){
  for (  PluginArchive pluginArchive : orchestratorInstance.pluginArchives()) {
    try {
      archiveIndexer.importArchive(pluginArchive.getArchive(),CSARSource.ORCHESTRATOR,pluginArchive.getArchiveFilePath(),Lists.<ParsingError>newArrayList());
      publishLocationTypeIndexedEvent(pluginArchive.getArchive().getNodeTypes().values(),orchestratorFactory,null);
    }
 catch (    CSARVersionAlreadyExistsException e) {
      log.info("String_Node_Str" + e.getMessage());
    }
catch (    CSARUsedInActiveDeployment e) {
      log.info("String_Node_Str" + e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Index archives defined at the orchestrator level by a plugin.
 * @param orchestratorFactory The orchestrator factory.
 * @param orchestratorInstance The instance of the orchestrator (created by the factory).
 */
public void indexOrchestratorArchives(IOrchestratorPluginFactory<IOrchestratorPlugin<?>,?> orchestratorFactory,IOrchestratorPlugin<Object> orchestratorInstance){
  for (  PluginArchive pluginArchive : orchestratorInstance.pluginArchives()) {
    try {
      archiveIndexer.importArchive(pluginArchive.getArchive(),CSARSource.ORCHESTRATOR,pluginArchive.getArchiveFilePath(),Lists.<ParsingError>newArrayList());
      publishLocationTypeIndexedEvent(pluginArchive.getArchive().getNodeTypes().values(),orchestratorFactory,null);
    }
 catch (    AlreadyExistException e) {
      log.info("String_Node_Str" + e.getMessage());
    }
catch (    CSARUsedInActiveDeployment e) {
      log.info("String_Node_Str" + e.getMessage());
    }
  }
}
Program: 62266
Project: 62266
Buggy source:
@SuppressWarnings("String_Node_Str") private <V extends AbstractInheritableToscaType>void fillType(TypeMap typeMap,Topology topology,AbstractTemplate template,IPaaSTemplate<V> paaSTemplate,Class<V> clazz){
  V indexedToscaElement=getToscaType(template.getType(),typeMap,topology.getDependencies(),clazz);
  paaSTemplate.setIndexedToscaElement(indexedToscaElement);
  List<String> derivedFroms=indexedToscaElement.getDerivedFrom();
  List<V> derivedFromTypes=Lists.newArrayList();
  if (derivedFroms != null) {
    for (    String derivedFrom : derivedFroms) {
      derivedFromTypes.add(getToscaType(derivedFrom,typeMap,topology.getDependencies(),clazz));
    }
  }
  paaSTemplate.setDerivedFroms(derivedFromTypes);
  try {
    Path csarPath=repository.getCSAR(indexedToscaElement.getArchiveName(),indexedToscaElement.getArchiveVersion());
    paaSTemplate.setCsarPath(csarPath);
  }
 catch (  CSARVersionNotFoundException e) {
    log.debug("String_Node_Str" + indexedToscaElement + "String_Node_Str"+ paaSTemplate);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <V extends AbstractInheritableToscaType>void fillType(TypeMap typeMap,Topology topology,AbstractTemplate template,IPaaSTemplate<V> paaSTemplate,Class<V> clazz){
  V indexedToscaElement=getToscaType(template.getType(),typeMap,topology.getDependencies(),clazz);
  paaSTemplate.setIndexedToscaElement(indexedToscaElement);
  List<String> derivedFroms=indexedToscaElement.getDerivedFrom();
  List<V> derivedFromTypes=Lists.newArrayList();
  if (derivedFroms != null) {
    for (    String derivedFrom : derivedFroms) {
      derivedFromTypes.add(getToscaType(derivedFrom,typeMap,topology.getDependencies(),clazz));
    }
  }
  paaSTemplate.setDerivedFroms(derivedFromTypes);
  try {
    Path csarPath=repository.getCSAR(indexedToscaElement.getWorkspace(),indexedToscaElement.getArchiveName(),indexedToscaElement.getArchiveVersion());
    paaSTemplate.setCsarPath(csarPath);
  }
 catch (  AlreadyExistException e) {
    log.debug("String_Node_Str" + indexedToscaElement + "String_Node_Str"+ paaSTemplate);
  }
}
Program: 62267
Project: 62267
Buggy source:
/** 
 * Upload a TOSCA archive and index its components.
 * @param path The archive path.
 * @param csarSource The source of the upload.
 * @return The Csar object from the parsing.
 * @throws ParsingException
 * @throws CSARVersionAlreadyExistsException
 * @throws CSARUsedInActiveDeployment
 */
@ToscaContextual public ParsingResult<Csar> upload(Path path,CSARSource csarSource) throws ParsingException, CSARVersionAlreadyExistsException, CSARUsedInActiveDeployment {
  ParsingResult<ArchiveRoot> parsingResult=parser.parseWithExistingContext(path);
  final ArchiveRoot archiveRoot=parsingResult.getResult();
  if (archiveRoot.hasToscaTopologyTemplate()) {
    AuthorizationUtil.checkHasOneRoleIn(Role.ARCHITECT,Role.ADMIN);
  }
  if (archiveRoot.hasToscaTypes()) {
    AuthorizationUtil.checkHasOneRoleIn(Role.COMPONENTS_MANAGER,Role.ADMIN);
  }
  if (parsingResult.hasError(ParsingErrorLevel.ERROR)) {
    return toSimpleResult(parsingResult);
  }
  archiveIndexer.importArchive(archiveRoot,csarSource,path,parsingResult.getContext().getParsingErrors());
  try {
    suggestionService.postProcessSuggestionFromArchive(parsingResult);
    suggestionService.setAllSuggestionIdOnPropertyDefinition();
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  return toSimpleResult(parsingResult);
}

Fixed version (ground truth):
/** 
 * Upload a TOSCA archive and index its components.
 * @param path The archive path.
 * @param csarSource The source of the upload.
 * @return The Csar object from the parsing.
 * @throws ParsingException
 * @throws CSARUsedInActiveDeployment
 */
@ToscaContextual public ParsingResult<Csar> upload(Path path,CSARSource csarSource) throws ParsingException, CSARUsedInActiveDeployment {
  ParsingResult<ArchiveRoot> parsingResult=parser.parseWithExistingContext(path);
  final ArchiveRoot archiveRoot=parsingResult.getResult();
  if (archiveRoot.hasToscaTopologyTemplate()) {
    AuthorizationUtil.checkHasOneRoleIn(Role.ARCHITECT,Role.ADMIN);
  }
  if (archiveRoot.hasToscaTypes()) {
    AuthorizationUtil.checkHasOneRoleIn(Role.COMPONENTS_MANAGER,Role.ADMIN);
  }
  if (parsingResult.hasError(ParsingErrorLevel.ERROR)) {
    return toSimpleResult(parsingResult);
  }
  archiveIndexer.importArchive(archiveRoot,csarSource,path,parsingResult.getContext().getParsingErrors());
  try {
    suggestionService.postProcessSuggestionFromArchive(parsingResult);
    suggestionService.setAllSuggestionIdOnPropertyDefinition();
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  return toSimpleResult(parsingResult);
}
Program: 62268
Project: 62268
Buggy source:
@Override @Before public void before() throws Exception {
  super.before();
  saveDataToES(true);
}

Fixed version (ground truth):
@Override @Before public void before() throws Exception {
  super.before();
  saveDataToES();
}
Program: 62269
Project: 62269
Buggy source:
private void saveDataToES(boolean refresh) throws IOException, IndexingServiceException {
  testDataList.clear();
  Path path=Paths.get("String_Node_Str");
  FacetedSearchResult res=jsonMapper.readValue(path.toFile(),FacetedSearchResult.class);
  Object[] data=res.getData();
  for (  Object element : data) {
    String serializeDatum=jsonMapper.writeValueAsString(element);
    NodeType indexedNodeType=jsonMapper.readValue(serializeDatum,NodeType.class);
    String typeName=MappingBuilder.indexTypeFromClass(NodeType.class);
    dao.save(indexedNodeType);
    assertDocumentExisit(ElasticSearchDAO.TOSCA_ELEMENT_INDEX,typeName,indexedNodeType.getId(),true);
    testDataList.add(indexedNodeType);
    for (    CapabilityDefinition capaDef : indexedNodeType.getCapabilities()) {
      if (capaDef.getType().equals("String_Node_Str")) {
        jndiTestDataList.add(indexedNodeType);
      }
    }
  }
  refresh();
}

Fixed version (ground truth):
private void saveDataToES() throws IOException, IndexingServiceException {
  testDataList.clear();
  Path path=Paths.get("String_Node_Str");
  FacetedSearchResult res=jsonMapper.readValue(path.toFile(),FacetedSearchResult.class);
  Object[] data=res.getData();
  for (  Object element : data) {
    String serializeDatum=jsonMapper.writeValueAsString(element);
    NodeType indexedNodeType=jsonMapper.readValue(serializeDatum,NodeType.class);
    indexedNodeType.setWorkspace(AlienConstants.GLOBAL_WORKSPACE_ID);
    String typeName=MappingBuilder.indexTypeFromClass(NodeType.class);
    dao.save(indexedNodeType);
    assertDocumentExisit(ElasticSearchDAO.TOSCA_ELEMENT_INDEX,typeName,indexedNodeType.getId(),true);
    testDataList.add(indexedNodeType);
    for (    CapabilityDefinition capaDef : indexedNodeType.getCapabilities()) {
      if (capaDef.getType().equals("String_Node_Str")) {
        jndiTestDataList.add(indexedNodeType);
      }
    }
  }
  refresh();
}
Program: 62271
Project: 62271
Buggy source:
public static NodeType createIndexedNodeType(String id,String archiveName,String archiveVersion,String description,List<CapabilityDefinition> capabilities,List<RequirementDefinition> requirements,List<String> derivedFroms,List<String> defaultCapabilities,List<Tag> tags,Date creationDate,Date lastUpdateDate){
  NodeType nodeType=new NodeType();
  nodeType.setElementId(id);
  nodeType.setArchiveName(archiveName);
  nodeType.setArchiveVersion(archiveVersion);
  nodeType.setCapabilities(capabilities);
  nodeType.setDescription(description);
  nodeType.setDefaultCapabilities(defaultCapabilities);
  nodeType.setRequirements(requirements);
  nodeType.setDerivedFrom(derivedFroms);
  nodeType.setTags(tags);
  nodeType.setCreationDate(creationDate);
  nodeType.setLastUpdateDate(lastUpdateDate);
  return nodeType;
}

Fixed version (ground truth):
public static NodeType createIndexedNodeType(String id,String archiveName,String archiveVersion,String description,List<CapabilityDefinition> capabilities,List<RequirementDefinition> requirements,List<String> derivedFroms,List<String> defaultCapabilities,List<Tag> tags,Date creationDate,Date lastUpdateDate){
  NodeType nodeType=new NodeType();
  nodeType.setElementId(id);
  nodeType.setArchiveName(archiveName);
  nodeType.setArchiveVersion(archiveVersion);
  nodeType.setWorkspace(AlienConstants.GLOBAL_WORKSPACE_ID);
  nodeType.setCapabilities(capabilities);
  nodeType.setDescription(description);
  nodeType.setDefaultCapabilities(defaultCapabilities);
  nodeType.setRequirements(requirements);
  nodeType.setDerivedFrom(derivedFroms);
  nodeType.setTags(tags);
  nodeType.setCreationDate(creationDate);
  nodeType.setLastUpdateDate(lastUpdateDate);
  return nodeType;
}
Program: 62272
Project: 62272
Buggy source:
private void resetRemovedArtifact(IArtifact artifact,String removedFilePath){
  if (artifact.getArtifactRepository() == null) {
    if (removedFilePath.equals(artifact.getArtifactRef())) {
      artifact.setArtifactRef(null);
    }
  }
}

Fixed version (ground truth):
private void resetRemovedArtifact(IArtifact artifact,String removedFilePath){
  if (artifact != null && artifact.getArtifactRepository() == null) {
    if (removedFilePath.equals(artifact.getArtifactRef())) {
      artifact.setArtifactRef(null);
    }
  }
}
Program: 62273
Project: 62273
Buggy source:
/** 
 * Update the name and description of an application.
 * @param applicationId The application id.
 * @param newName The new name for the application.
 * @param newDescription The new description for the application.
 */
public void update(String applicationId,String newName,String newDescription){
  Application application=getOrFail(applicationId);
  AuthorizationUtil.checkAuthorizationForApplication(application,ApplicationRole.APPLICATION_MANAGER);
  if (application.getName() == null || application.getName().isEmpty()) {
    throw new InvalidArgumentException("String_Node_Str");
  }
  if (!application.getName().equals(newName)) {
    checkApplicationName(newName);
  }
  application.setName(newName);
  application.setDescription(newDescription);
  application.setLastUpdateDate(new Date());
  alienDAO.save(application);
}

Fixed version (ground truth):
/** 
 * Update the name and description of an application.
 * @param applicationId The application id.
 * @param newName The new name for the application.
 * @param newDescription The new description for the application.
 */
public void update(String applicationId,String newName,String newDescription){
  Application application=getOrFail(applicationId);
  AuthorizationUtil.checkAuthorizationForApplication(application,ApplicationRole.APPLICATION_MANAGER);
  if (newName != null && !newName.isEmpty() && !application.getName().equals(newName)) {
    checkApplicationName(newName);
    application.setName(newName);
  }
  if (newDescription != null) {
    application.setDescription(newDescription);
  }
  application.setLastUpdateDate(new Date());
  alienDAO.save(application);
}
Program: 62274
Project: 62274
Buggy source:
@Override @SneakyThrows public void beforeCommit(T operation){
  Path targetPath=EditionContextManager.get().getLocalGitPath().resolve(operation.getPath());
  Files.createDirectories(targetPath.getParent());
  try (InputStream inputStream=artifactRepository.getFile(operation.getTempFileId())){
    Files.copy(inputStream,targetPath,StandardCopyOption.REPLACE_EXISTING);
  }
   FileProcessorHelper.getFileTreeNode(operation.getPath()).setArtifactId(null);
  artifactRepository.deleteFile(operation.getTempFileId());
}

Fixed version (ground truth):
@Override @SneakyThrows public void beforeCommit(T operation){
  try {
    TreeNode fileTreeNode=FileProcessorHelper.getFileTreeNode(operation.getPath());
    Path targetPath=EditionContextManager.get().getLocalGitPath().resolve(operation.getPath());
    Files.createDirectories(targetPath.getParent());
    try (InputStream inputStream=artifactRepository.getFile(operation.getTempFileId())){
      Files.copy(inputStream,targetPath,StandardCopyOption.REPLACE_EXISTING);
    }
     artifactRepository.deleteFile(operation.getTempFileId());
    fileTreeNode.setArtifactId(null);
  }
 catch (  NotFoundException e) {
    log.debug("String_Node_Str",e);
  }
}
Program: 62275
Project: 62275
Buggy source:
/** 
 * Initialize the dao after being loaded by spring (Create the indexes).
 */
@PostConstruct public void initEnvironment(){
  try {
    getMappingBuilder().initialize("String_Node_Str");
    getMappingBuilder().initialize("String_Node_Str");
  }
 catch (  IntrospectionException|IOException e) {
    throw new IndexingServiceException("String_Node_Str",e);
  }
  setJsonMapper(ElasticSearchMapper.getInstance());
  initIndices(TOSCA_ELEMENT_INDEX,null,CapabilityType.class,ArtifactType.class,RelationshipType.class,NodeType.class,DataType.class,PrimitiveDataType.class);
  initIndices(TOSCA_ELEMENT_INDEX,null,AbstractInstantiableToscaType.class,AbstractToscaType.class);
  initIndice(Application.class);
  initIndice(ApplicationVersion.class);
  initIndice(ApplicationEnvironment.class);
  initIndice(Topology.class);
  initIndice(Csar.class);
  initIndice(Repository.class);
  initIndice(Plugin.class);
  initIndice(PluginConfiguration.class);
  initIndice(MetaPropConfiguration.class);
  initIndice(Orchestrator.class);
  initIndice(OrchestratorConfiguration.class);
  initIndice(Location.class);
  initIndice(LocationResourceTemplate.class);
  initIndice(Deployment.class);
  initIndice(CsarGitRepository.class);
  initIndice(DeploymentTopology.class);
  initIndices(SUGGESTION_INDEX,null,AbstractSuggestionEntry.class,SuggestionEntry.class,SimpleSuggestionEntry.class);
  initCompleted();
}

Fixed version (ground truth):
/** 
 * Initialize the dao after being loaded by spring (Create the indexes).
 */
@PostConstruct public void initEnvironment(){
  try {
    getMappingBuilder().initialize("String_Node_Str");
    getMappingBuilder().initialize("String_Node_Str");
    getMappingBuilder().parseClassMapping(AbstractToscaType.class,"String_Node_Str");
  }
 catch (  IntrospectionException|IOException e) {
    throw new IndexingServiceException("String_Node_Str",e);
  }
  setJsonMapper(ElasticSearchMapper.getInstance());
  initIndices(TOSCA_ELEMENT_INDEX,null,CapabilityType.class,ArtifactType.class,RelationshipType.class,NodeType.class,DataType.class,PrimitiveDataType.class);
  initIndices(TOSCA_ELEMENT_INDEX,null,AbstractInstantiableToscaType.class,AbstractToscaType.class);
  initIndice(Application.class);
  initIndice(ApplicationVersion.class);
  initIndice(ApplicationEnvironment.class);
  initIndice(Topology.class);
  initIndice(Csar.class);
  initIndice(Repository.class);
  initIndice(Plugin.class);
  initIndice(PluginConfiguration.class);
  initIndice(MetaPropConfiguration.class);
  initIndice(Orchestrator.class);
  initIndice(OrchestratorConfiguration.class);
  initIndice(Location.class);
  initIndice(LocationResourceTemplate.class);
  initIndice(Deployment.class);
  initIndice(CsarGitRepository.class);
  initIndice(DeploymentTopology.class);
  initIndices(SUGGESTION_INDEX,null,AbstractSuggestionEntry.class,SuggestionEntry.class,SimpleSuggestionEntry.class);
  initCompleted();
}
Program: 62276
Project: 62276
Buggy source:
/** 
 * Delete an archive an all its registered / saved elements Abort the deletion if the archive is used by some resources
 * @param csar
 * @return A List of {@link Usage} representing the resources using this archive.
 */
public List<Usage> deleteCsarWithElements(Csar csar){
  List<Usage> relatedResourceList=getCsarRelatedResourceList(csar);
  if (relatedResourceList.isEmpty()) {
    indexerService.deleteElements(csar.getName(),csar.getVersion(),csar.getHash());
    csarDAO.delete(Csar.class,csar.getId());
    alienRepository.removeCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
  }
  return relatedResourceList;
}

Fixed version (ground truth):
/** 
 * Delete an archive an all its registered / saved elements Abort the deletion if the archive is used by some resources
 * @param csar
 * @return A List of {@link Usage} representing the resources using this archive.
 */
public List<Usage> deleteCsarWithElements(Csar csar){
  List<Usage> relatedResourceList=getCsarRelatedResourceList(csar);
  if (relatedResourceList.isEmpty()) {
    deleteCsar(csar);
  }
  return relatedResourceList;
}
Program: 62277
Project: 62277
Buggy source:
private void deleteCsar(Csar csar){
  csarDAO.delete(Topology.class,csar.getId());
  indexerService.deleteElements(csar.getName(),csar.getVersion(),csar.getWorkspace());
  csarDAO.delete(Csar.class,csar.getId());
  alienRepository.removeCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
}

Fixed version (ground truth):
private void deleteCsar(Csar csar){
  csarDAO.delete(Topology.class,csar.getId());
  indexerService.deleteElements(csar.getName(),csar.getVersion(),csar.getWorkspace());
  csarDAO.delete(Csar.class,csar.getId());
  if (csarDAO.buildQuery(Csar.class).setFilters(singleKeyFilter("String_Node_Str",csar.getWorkspace())).count() == 0) {
    alienRepository.removeWorkspace(csar.getWorkspace());
  }
 else {
    alienRepository.removeCSAR(csar.getWorkspace(),csar.getName(),csar.getVersion());
  }
}
Program: 62278
Project: 62278
Buggy source:
@Override public void removeCSAR(String workspace,String name,String version){
  Path csarDirectoryPath=rootPath.resolve(name).resolve(version);
  if (Files.isDirectory(csarDirectoryPath)) {
    FileSystemUtils.deleteRecursively(csarDirectoryPath.toFile());
  }
}

Fixed version (ground truth):
@Override public void removeCSAR(String workspace,String name,String version){
  Path csarDirectoryPath=rootPath.resolve(workspace).resolve(name).resolve(version);
  if (Files.isDirectory(csarDirectoryPath)) {
    FileSystemUtils.deleteRecursively(csarDirectoryPath.toFile());
  }
}
Program: 62279
Project: 62279
Buggy source:
/** 
 * Create if not exist indices. A TTL can be defined for all indices under this index (ESearch TTL notation)
 * @param indexName The index to initialize
 * @param classes An array of classes to map to this index.
 */
@SneakyThrows({IOException.class,IntrospectionException.class}) public void initIndices(String indexName,String ttl,Class<?>... classes){
  if (indexExist(indexName)) {
    addToMappedClasses(indexName,classes);
  }
 else {
    CreateIndexRequestBuilder createIndexRequestBuilder=esClient.getClient().admin().indices().prepareCreate(indexName);
    for (    Class<?> clazz : classes) {
      String typeName=addToMappedClasses(indexName,clazz);
      String typeMapping=mappingBuilder.getMapping(clazz);
      Map<String,Object> typesMap=JsonUtil.toMap(typeMapping);
      addAlienScore(typesMap);
      addTTL(typesMap,ttl);
      String mapping=jsonMapper.writeValueAsString(typesMap);
      createIndexRequestBuilder.addMapping(typeName,mapping);
    }
    try {
      final CreateIndexResponse createResponse=createIndexRequestBuilder.execute().actionGet();
      if (!createResponse.isAcknowledged()) {
        throw new IndexingServiceException("String_Node_Str" + indexName + "String_Node_Str");
      }
    }
 catch (    Exception e) {
      log.warn("String_Node_Str",indexName);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create if not exist indices. A TTL can be defined for all indices under this index (ESearch TTL notation)
 * @param indexName The index to initialize
 * @param classes An array of classes to map to this index.
 */
@SneakyThrows({IOException.class,IntrospectionException.class}) public void initIndices(String indexName,String ttl,Class<?>... classes){
  if (indexExist(indexName)) {
    addToMappedClasses(indexName,classes);
  }
 else {
    CreateIndexRequestBuilder createIndexRequestBuilder=esClient.getClient().admin().indices().prepareCreate(indexName);
    for (    Class<?> clazz : classes) {
      String typeName=addToMappedClasses(indexName,clazz);
      if (Modifier.isAbstract(clazz.getModifiers())) {
        continue;
      }
      String typeMapping=mappingBuilder.getMapping(clazz);
      Map<String,Object> typesMap=JsonUtil.toMap(typeMapping);
      addAlienScore(typesMap);
      addTTL(typesMap,ttl);
      String mapping=jsonMapper.writeValueAsString(typesMap);
      createIndexRequestBuilder.addMapping(typeName,mapping);
    }
    try {
      final CreateIndexResponse createResponse=createIndexRequestBuilder.execute().actionGet();
      if (!createResponse.isAcknowledged()) {
        throw new IndexingServiceException("String_Node_Str" + indexName + "String_Node_Str");
      }
    }
 catch (    Exception e) {
      log.warn("String_Node_Str",indexName);
    }
  }
}
Program: 62280
Project: 62280
Buggy source:
/** 
 * <p> Import a new empty archive with a topology. </p> <p> Note: this archive is not created from parsing but from alien4cloud API. This service will index the archive and topology as well as initialize the file repository and tosca yaml. </p> <p> This method cannot be used to override a topology, even a SNAPSHOT as any update to a topology from the API MUST be done through the editor. </p>
 * @param csar The archive to be imported.
 * @param topology The topology to be part of the topology.
 */
public synchronized void importNewArchive(Csar csar,Topology topology){
  ensureUniqueness(csar.getName(),csar.getVersion());
  workflowBuilderService.initWorkflows(workflowBuilderService.buildTopologyContext(topology));
  csarService.save(csar);
  topologyServiceCore.save(topology);
  if (csar.getYamlFilePath() == null) {
    csar.setYamlFilePath("String_Node_Str");
  }
  String yaml=exportService.getYaml(csar,topology);
  archiveRepositry.storeCSAR(csar,yaml);
}

Fixed version (ground truth):
/** 
 * <p> Import a new empty archive with a topology. </p> <p> Note: this archive is not created from parsing but from alien4cloud API. This service will index the archive and topology as well as initialize the file repository and tosca yaml. </p> <p> This method cannot be used to override a topology, even a SNAPSHOT as any update to a topology from the API MUST be done through the editor. </p>
 * @param csar The archive to be imported.
 * @param topology The topology to be part of the topology.
 */
public synchronized void importNewArchive(Csar csar,Topology topology){
  ensureUniqueness(csar.getName(),csar.getVersion());
  workflowBuilderService.initWorkflows(workflowBuilderService.buildTopologyContext(topology));
  if (csar.getYamlFilePath() == null) {
    csar.setYamlFilePath("String_Node_Str");
  }
  String yaml=exportService.getYaml(csar,topology);
  csarService.save(csar);
  topologyServiceCore.save(topology);
  archiveRepositry.storeCSAR(csar,yaml);
}
Program: 62282
Project: 62282
Buggy source:
@Override public Resource resolveResource(HttpServletRequest request,String requestPath,List<? extends Resource> locations,ResourceResolverChain chain){
  log.debug("String_Node_Str");
  ServletWebRequest webRequest=new ServletWebRequest(request);
  Map uriTemplateVars=(Map)webRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE,0);
  String topologyId=(String)uriTemplateVars.get("String_Node_Str");
  if (editorService == null) {
    throw new NotFoundException("String_Node_Str");
  }
 else {
    editorService.checkAuthorization(topologyId);
  }
  return chain.resolveResource(request,topologyId + "String_Node_Str" + requestPath,locations);
}

Fixed version (ground truth):
@Override public Resource resolveResource(HttpServletRequest request,String requestPath,List<? extends Resource> locations,ResourceResolverChain chain){
  log.debug("String_Node_Str");
  ServletWebRequest webRequest=new ServletWebRequest(request);
  Map uriTemplateVars=(Map)webRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE,0);
  String csarId=(String)uriTemplateVars.get("String_Node_Str");
  if (editorService == null) {
    throw new NotFoundException("String_Node_Str");
  }
 else {
    editorService.checkAuthorization(csarId);
  }
  String[] splitted=csarId.split("String_Node_Str");
  return chain.resolveResource(request,splitted[2] + "String_Node_Str" + splitted[0]+ "String_Node_Str"+ splitted[1]+ "String_Node_Str"+ requestPath,locations);
}
Program: 62283
Project: 62283
Buggy source:
/** 
 * Perform validation of a Tosca archive.
 * @param archiveRoot The archive to validate and post process.
 */
public void process(ArchiveRoot archiveRoot){
  String archiveName=archiveRoot.getArchive().getName();
  String archiveVersion=archiveRoot.getArchive().getVersion();
  if (archiveName == null) {
    archiveRoot.getArchive().setName(ParsingContextExecution.getFileName());
  }
  if (archiveVersion == null) {
    archiveRoot.getArchive().setVersion("String_Node_Str");
  }
  archiveRoot.getArchive().setWorkspace("String_Node_Str");
  ToscaContext.get().register(archiveRoot);
  doProcess(archiveRoot);
  archiveRoot.getArchive().setName(archiveName);
  archiveRoot.getArchive().setVersion(archiveVersion);
}

Fixed version (ground truth):
/** 
 * Perform validation of a Tosca archive.
 * @param archiveRoot The archive to validate and post process.
 */
public void process(ArchiveRoot archiveRoot){
  String archiveName=archiveRoot.getArchive().getName();
  String archiveVersion=archiveRoot.getArchive().getVersion();
  archiveRoot.getArchive().setYamlFilePath(ParsingContextExecution.getFileName());
  if (archiveName == null) {
    archiveRoot.getArchive().setName(ParsingContextExecution.getFileName());
  }
  if (archiveVersion == null) {
    archiveRoot.getArchive().setVersion("String_Node_Str");
  }
  archiveRoot.getArchive().setWorkspace("String_Node_Str");
  ToscaContext.get().register(archiveRoot);
  doProcess(archiveRoot);
  archiveRoot.getArchive().setName(archiveName);
  archiveRoot.getArchive().setVersion(archiveVersion);
}
Program: 62285
Project: 62285
Buggy source:
@Override public Resource resolveResource(HttpServletRequest request,String requestPath,List<? extends Resource> locations,ResourceResolverChain chain){
  log.debug("String_Node_Str");
  ServletWebRequest webRequest=new ServletWebRequest(request);
  Map uriTemplateVars=(Map)webRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE,0);
  String csarId=(String)uriTemplateVars.get("String_Node_Str");
  if (editorService == null) {
    throw new NotFoundException("String_Node_Str");
  }
 else {
    editorService.checkAuthorization(csarId);
  }
  String[] splitted=csarId.split("String_Node_Str");
  return chain.resolveResource(request,splitted[2] + "String_Node_Str" + splitted[0]+ "String_Node_Str"+ splitted[1]+ "String_Node_Str"+ requestPath,locations);
}

Fixed version (ground truth):
@Override public Resource resolveResource(HttpServletRequest request,String requestPath,List<? extends Resource> locations,ResourceResolverChain chain){
  log.debug("String_Node_Str");
  ServletWebRequest webRequest=new ServletWebRequest(request);
  Map uriTemplateVars=(Map)webRequest.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE,0);
  String csarId=(String)uriTemplateVars.get("String_Node_Str");
  if (editorService == null) {
    throw new NotFoundException("String_Node_Str");
  }
 else {
    editorService.checkAuthorization(csarId);
  }
  String[] splitted=csarId.split("String_Node_Str");
  return chain.resolveResource(request,splitted[0] + "String_Node_Str" + splitted[1]+ "String_Node_Str"+ requestPath,locations);
}
Program: 62287
Project: 62287
Buggy source:
/** 
 * Initialize the dao after being loaded by spring (Create the indexes).
 */
@PostConstruct public void initEnvironment(){
  try {
    getMappingBuilder().initialize("String_Node_Str");
  }
 catch (  IntrospectionException|IOException e) {
    throw new IndexingServiceException("String_Node_Str",e);
  }
  setJsonMapper(ElasticSearchMapper.getInstance());
  initIndices(TOSCA_ELEMENT_INDEX,null,CapabilityType.class,ArtifactType.class,RelationshipType.class,NodeType.class,DataType.class,PrimitiveDataType.class);
  initIndices(TOSCA_ELEMENT_INDEX,null,AbstractInstantiableToscaType.class,AbstractToscaType.class);
  initIndice(Application.class);
  initIndice(ApplicationVersion.class);
  initIndice(ApplicationEnvironment.class);
  initIndice(Topology.class);
  initIndice(Csar.class);
  initIndice(Repository.class);
  initIndice(Plugin.class);
  initIndice(PluginConfiguration.class);
  initIndice(TopologyTemplate.class);
  initIndice(TopologyTemplateVersion.class);
  initIndice(MetaPropConfiguration.class);
  initIndice(Orchestrator.class);
  initIndice(OrchestratorConfiguration.class);
  initIndice(Location.class);
  initIndice(LocationResourceTemplate.class);
  initIndice(Deployment.class);
  initIndice(CsarGitRepository.class);
  initIndice(DeploymentTopology.class);
  initIndices(SUGGESTION_INDEX,null,AbstractSuggestionEntry.class,SuggestionEntry.class,SimpleSuggestionEntry.class);
  initCompleted();
}

Fixed version (ground truth):
/** 
 * Initialize the dao after being loaded by spring (Create the indexes).
 */
@PostConstruct public void initEnvironment(){
  try {
    getMappingBuilder().initialize("String_Node_Str");
  }
 catch (  IntrospectionException|IOException e) {
    throw new IndexingServiceException("String_Node_Str",e);
  }
  setJsonMapper(ElasticSearchMapper.getInstance());
  initIndices(TOSCA_ELEMENT_INDEX,null,CapabilityType.class,ArtifactType.class,RelationshipType.class,NodeType.class,DataType.class,PrimitiveDataType.class);
  initIndices(TOSCA_ELEMENT_INDEX,null,AbstractInstantiableToscaType.class,AbstractToscaType.class);
  initIndice(Application.class);
  initIndice(ApplicationVersion.class);
  initIndice(ApplicationEnvironment.class);
  initIndice(Topology.class);
  initIndice(Csar.class);
  initIndice(Repository.class);
  initIndice(Plugin.class);
  initIndice(PluginConfiguration.class);
  initIndice(MetaPropConfiguration.class);
  initIndice(Orchestrator.class);
  initIndice(OrchestratorConfiguration.class);
  initIndice(Location.class);
  initIndice(LocationResourceTemplate.class);
  initIndice(Deployment.class);
  initIndice(CsarGitRepository.class);
  initIndice(DeploymentTopology.class);
  initIndices(SUGGESTION_INDEX,null,AbstractSuggestionEntry.class,SuggestionEntry.class,SimpleSuggestionEntry.class);
  initCompleted();
}