Program: 141325
Project: 141325
Buggy source:
private void scanWorkflow() throws EoulsanException {
  final Context context=this.context;
  final Set<DataFile> checkedDatafile=newHashSet();
  final Map<DataFormat,Checker> checkers=newHashMap();
  boolean firstSample=true;
  for (  Sample s : this.design.getSamples()) {
    final Cart cart=new Cart();
    fillCartWithDesignFiles(cart,s);
    for (    Step step : this.steps) {
      if (firstSample)       checkStepInOutFormat(step);
      final Map<DataType,Set<DataFormat>> map=getDataFormatByDataType(step.getInputFormats());
      if (map != null && map.size() > 0)       for (      Map.Entry<DataType,Set<DataFormat>> e : map.entrySet()) {
        int foundInCart=0;
        int foundFile=0;
        boolean canBeGenerated=false;
        for (        DataFormat df : e.getValue()) {
          if (df.isGenerator())           canBeGenerated=true;
          if (cart.cart.contains(df)) {
            cart.cartUsed.add(df);
            if (df.isChecker())             checkers.put(df,df.getChecker());
            if (cart.cartGenerated.contains(df))             cart.cartReUsed.add(df);
            foundInCart++;
          }
 else           foundFile=swCheckExistingFiles(df,s,cart,foundFile);
        }
        if (foundInCart == 0 && foundFile == 0) {
          if (canBeGenerated) {
            cart.cartUsed.add(e.getValue().iterator().next());
          }
 else           throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ step.getName()+ "String_Node_Str");
        }
        if (foundFile > 1 || foundInCart > 1)         throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ step.getName()+ "String_Node_Str"+ e.getKey()+ "String_Node_Str");
      }
      if (step.getOutputFormats() != null)       for (      DataFormat df : step.getOutputFormats()) {
        cart.cartGenerated.add(df);
        cart.cart.add(df);
      }
    }
    cart.cartNotGenerated.addAll(cart.cartUsed);
    cart.cartNotGenerated.removeAll(cart.cartGenerated);
    for (    DataFormat df : cart.cartNotGenerated) {
      final List<DataFile> files=swGetAllDataFiles(df,s);
      for (      DataFile file : files)       if (!checkedDatafile.contains(file)) {
        if (!file.exists()) {
          if (df.isGenerator()) {
            final Step generator=df.getGenerator();
            this.steps.add(swfindFirstStepThatNeedDataFormat(df),generator);
            LOGGER.info("String_Node_Str" + generator.getName());
            scanWorkflow();
            return;
          }
          throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ df.getFormatName()+ "String_Node_Str");
        }
        checkedDatafile.add(file);
      }
    }
    for (    DataFormat df : cart.cartGenerated) {
      for (      DataFile file : swGetAllDataFiles(df,s))       if (!checkedDatafile.contains(file)) {
        if (context.getDataFile(df,s).exists())         throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ df.getFormatName()+ "String_Node_Str");
        checkedDatafile.add(file);
      }
    }
    cart.cartOnlyGenerated.addAll(cart.cartGenerated);
    cart.cartOnlyGenerated.removeAll(cart.cartReUsed);
    globalInputDataFormats.put(s.getId(),Collections.unmodifiableSet(cart.cartNotGenerated));
    globalOutputDataFormats.put(s.getId(),Collections.unmodifiableSet(cart.cartGenerated));
    if (firstSample)     firstSample=false;
  }
  runChecker(checkers);
}

Fixed version (ground truth):
private void scanWorkflow() throws EoulsanException {
  final Set<DataFile> checkedDatafile=newHashSet();
  final Map<DataFormat,Checker> checkers=newHashMap();
  boolean firstSample=true;
  for (  Sample s : this.design.getSamples()) {
    final Cart cart=new Cart();
    fillCartWithDesignFiles(cart,s);
    for (    Step step : this.steps) {
      if (firstSample)       checkStepInOutFormat(step);
      final Map<DataType,Set<DataFormat>> map=getDataFormatByDataType(step.getInputFormats());
      if (map != null && map.size() > 0)       for (      Map.Entry<DataType,Set<DataFormat>> e : map.entrySet()) {
        int foundInCart=0;
        int foundFile=0;
        boolean canBeGenerated=false;
        for (        DataFormat df : e.getValue()) {
          if (df.isGenerator())           canBeGenerated=true;
          if (cart.cart.contains(df)) {
            cart.cartUsed.add(df);
            if (df.isChecker())             checkers.put(df,df.getChecker());
            if (cart.cartGenerated.contains(df))             cart.cartReUsed.add(df);
            foundInCart++;
          }
 else           foundFile=swCheckExistingFiles(df,s,cart,foundFile);
        }
        if (foundInCart == 0 && foundFile == 0) {
          if (canBeGenerated) {
            cart.cartUsed.add(e.getValue().iterator().next());
          }
 else           throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ step.getName()+ "String_Node_Str");
        }
        if (foundFile > 1 || foundInCart > 1)         throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ step.getName()+ "String_Node_Str"+ e.getKey()+ "String_Node_Str");
      }
      if (step.getOutputFormats() != null)       for (      DataFormat df : step.getOutputFormats()) {
        cart.cartGenerated.add(df);
        cart.cart.add(df);
      }
    }
    cart.cartNotGenerated.addAll(cart.cartUsed);
    cart.cartNotGenerated.removeAll(cart.cartGenerated);
    for (    DataFormat df : cart.cartNotGenerated) {
      final List<DataFile> files=swGetAllDataFiles(df,s);
      for (      DataFile file : files)       if (!checkedDatafile.contains(file)) {
        if (!file.exists()) {
          if (df.isGenerator()) {
            final Step generator=df.getGenerator();
            this.steps.add(swfindFirstStepThatNeedDataFormat(df),generator);
            LOGGER.info("String_Node_Str" + generator.getName());
            scanWorkflow();
            return;
          }
          throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ df.getFormatName()+ "String_Node_Str");
        }
        checkedDatafile.add(file);
      }
    }
    for (    DataFormat df : cart.cartGenerated) {
      for (      DataFile file : swGetAllDataFiles(df,s))       if (!checkedDatafile.contains(file)) {
        if (file.exists())         throw new EoulsanException("String_Node_Str" + s.getId() + "String_Node_Str"+ df.getFormatName()+ "String_Node_Str");
        checkedDatafile.add(file);
      }
    }
    cart.cartOnlyGenerated.addAll(cart.cartGenerated);
    cart.cartOnlyGenerated.removeAll(cart.cartReUsed);
    globalInputDataFormats.put(s.getId(),Collections.unmodifiableSet(cart.cartNotGenerated));
    globalOutputDataFormats.put(s.getId(),Collections.unmodifiableSet(cart.cartGenerated));
    if (firstSample)     firstSample=false;
  }
  runChecker(checkers);
}