Program: 134519
Project: 134519
Buggy source:
@Override public Set<IProject> build(int kind,IProgressMonitor monitor) throws Exception {
  IMaven maven=MavenPlugin.getMaven();
  BuildContext buildContext=getBuildContext();
  File source=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),YangM2EPlugin.YANG_FILES_ROOT_DIR,File.class,monitor);
  if (source == null) {
    source=new File(getSession().getCurrentProject().getBasedir(),YangM2EPlugin.YANG_FILES_ROOT_DIR_DEFAULT);
  }
  Scanner ds=buildContext.newScanner(source);
  ds.scan();
  String[] includedFiles=ds.getIncludedFiles();
  if (includedFiles == null || includedFiles.length <= 0) {
    return null;
  }
  getMavenProjectFacade().getProject().deleteMarkers(YangCorePlugin.YANGIDE_PROBLEM_MARKER,true,IResource.DEPTH_INFINITE);
  for (  String path : includedFiles) {
    final IFile ifile=YangCorePlugin.getIFileFromFile(new File(ds.getBasedir(),path));
    if (ifile != null) {
      YangParserUtil.validateYangFile(YangCorePlugin.createYangFile(ifile).getBuffer().getContents().toCharArray(),ifile.getProject(),new IYangValidationListener(){
        @Override public void validationError(        String msg,        int lineNumber,        int charStart,        int charEnd){
          YangCorePlugin.createProblemMarker(ifile,msg,lineNumber,charStart,charEnd);
        }
        @Override public void syntaxError(        String msg,        int lineNumber,        int charStart,        int charEnd){
          YangCorePlugin.createProblemMarker(ifile,msg,lineNumber,charStart,charEnd);
        }
      }
);
    }
  }
  Set<File> outputDirs=new HashSet<>();
  YangGeneratorConfiguration[] confs=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),YangM2EPlugin.YANG_CODE_GENERATORS,YangGeneratorConfiguration[].class,monitor);
  if (confs != null) {
    for (    YangGeneratorConfiguration conf : confs) {
      if (conf.getOutputBaseDir() != null) {
        outputDirs.add(conf.getOutputBaseDir());
      }
    }
  }
  boolean isCleanRequired=YangUIPlugin.getDefault().getPreferenceStore().getBoolean(YangPreferenceConstants.M2E_PLUGIN_CLEAN_TARGET);
  if (isCleanRequired) {
    for (    File outputDir : outputDirs) {
      IContainer[] containers=ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(outputDir.getAbsolutePath()));
      if (containers != null && containers.length > 0) {
        containers[0].delete(true,monitor);
      }
    }
  }
  Set<IProject> result=super.build(kind,monitor);
  for (  Throwable ex : getSession().getResult().getExceptions()) {
    YangCorePlugin.log(ex);
  }
  for (  File outputDir : outputDirs) {
    buildContext.refresh(outputDir);
  }
  return result;
}

Fixed version (ground truth):
@Override public Set<IProject> build(int kind,IProgressMonitor monitor) throws Exception {
  IMaven maven=MavenPlugin.getMaven();
  BuildContext buildContext=getBuildContext();
  File source=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),YangM2EPlugin.YANG_FILES_ROOT_DIR,File.class,monitor);
  if (source == null) {
    source=new File(getSession().getCurrentProject().getBasedir(),YangM2EPlugin.YANG_FILES_ROOT_DIR_DEFAULT);
  }
  Scanner ds=buildContext.newScanner(source);
  ds.scan();
  String[] includedFiles=ds.getIncludedFiles();
  if (includedFiles == null || includedFiles.length <= 0) {
    return null;
  }
  getMavenProjectFacade().getProject().deleteMarkers(YangCorePlugin.YANGIDE_PROBLEM_MARKER,true,IResource.DEPTH_INFINITE);
  if (kind == FULL_BUILD) {
    YangModelManager.getIndexManager().indexAll(getMavenProjectFacade().getProject());
    try {
      while (YangModelManager.getIndexManager().awaitingJobsCount() > 0) {
        Thread.sleep(100);
      }
    }
 catch (    InterruptedException e) {
    }
  }
  for (  String path : includedFiles) {
    final IFile ifile=YangCorePlugin.getIFileFromFile(new File(ds.getBasedir(),path));
    if (ifile != null) {
      YangParserUtil.validateYangFile(YangCorePlugin.createYangFile(ifile).getBuffer().getContents().toCharArray(),ifile.getProject(),new IYangValidationListener(){
        @Override public void validationError(        String msg,        int lineNumber,        int charStart,        int charEnd){
          YangCorePlugin.createProblemMarker(ifile,msg,lineNumber,charStart,charEnd);
        }
        @Override public void syntaxError(        String msg,        int lineNumber,        int charStart,        int charEnd){
          YangCorePlugin.createProblemMarker(ifile,msg,lineNumber,charStart,charEnd);
        }
      }
);
    }
  }
  Set<File> outputDirs=new HashSet<>();
  YangGeneratorConfiguration[] confs=maven.getMojoParameterValue(getSession().getCurrentProject(),getMojoExecution(),YangM2EPlugin.YANG_CODE_GENERATORS,YangGeneratorConfiguration[].class,monitor);
  if (confs != null) {
    for (    YangGeneratorConfiguration conf : confs) {
      if (conf.getOutputBaseDir() != null) {
        outputDirs.add(conf.getOutputBaseDir());
      }
    }
  }
  boolean isCleanRequired=YangUIPlugin.getDefault().getPreferenceStore().getBoolean(YangPreferenceConstants.M2E_PLUGIN_CLEAN_TARGET);
  if (isCleanRequired) {
    for (    File outputDir : outputDirs) {
      IContainer[] containers=ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(outputDir.getAbsolutePath()));
      if (containers != null && containers.length > 0) {
        containers[0].delete(true,monitor);
      }
    }
  }
  Set<IProject> result=super.build(kind,monitor);
  for (  Throwable ex : getSession().getResult().getExceptions()) {
    YangCorePlugin.log(ex);
  }
  for (  File outputDir : outputDirs) {
    buildContext.refresh(outputDir);
  }
  return result;
}