/*
(non-Javadoc)

@see es.upm.dit.gsi.shanks.model.scenario.Scenario#generateFailures()
11179
public void generateNetworkElementsEvents(ShanksSimulation sim)
            throws ShanksException {
        super.generateNetworkElementEvents(sim);
        for (Scenario scenario : this.scenarios.keySet()) {
            scenario.generateNetworkElementEvents(sim);
        }
    }
506325
def gen_outputs(self, riskinput, monitor, epspath=None, hazard=None):
        
        self.monitor = monitor
        hazard_getter = riskinput.hazard_getter
        if hazard is None:
            with monitor('getting hazard'):
                hazard_getter.init()
                hazard = hazard_getter.get_hazard()
        sids = hazard_getter.sids
        assert len(sids) == 1
        with monitor('computing risk', measuremem=False):
            # this approach is slow for event_based_risk since a lot of
            # small arrays are passed (one per realization) instead of
            # a long array with all realizations; ebrisk does the right
            # thing since it calls get_output directly
            assets_by_taxo = get_assets_by_taxo(riskinput.assets, epspath)
            for rlzi, haz in sorted(hazard[sids[0]].items()):
                out = self.get_output(assets_by_taxo, haz, rlzi)
                yield out
538140
public void onFailure (Throwable cause)
    {
        Console.log("Callback failure", "for", _trigger, cause);
        setEnabled(true);
        reportFailure(cause);
    }
1179967
@Override
  public FailsafeExecutor<R> onFailure(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener) {
    return super.onFailure(listener);
  }
443431
public void setFailures(java.util.Collection<Failure> failures) {
        if (failures == null) {
            this.failures = null;
            return;
        }

        this.failures = new com.amazonaws.internal.SdkInternalList<Failure>(failures);
    }
816308
public static Failure copy(Failure failure) {
        if (failure == null) {
            return null;
        }
        Failure result = new Failure();
        result.code = failure.code;
        result.details = failure.details;
        result.title = failure.title;
        return result;
    }
1231991
def addFailure(self, test, exception):
        
        result = self._handle_result(
            test, TestCompletionStatus.failure, exception=exception)
        self.failures.append(result)
        self._mirror_output = True
277194
public void writeCoverageResults() {
        File coverageFile = new File(this.testSessionDir,
                ICS_MAP.get(this.requestId));
        if (coverageFile.exists()) {
            return;
        }
        OutputStream fos = null;
        try {
            fos = new FileOutputStream(coverageFile, false);
            writeDocument(fos, this.coverageDoc);
        } catch (FileNotFoundException e) {
        } finally {
            try {
                // Fortify Mod: If fos is null, then nothing was written
                if( fos != null) {
                    fos.close();
                    LOGR.config("Wrote coverage results to "
                        + coverageFile.getCanonicalPath());
                    }
                else {
                    // If nothing was written, then there should be an exception message.  
                    // If an additional message is desired, then add it here.
                    }
            } catch (IOException ioe) {
                LOGR.warning(ioe.getMessage());
            }
        }

    }
1023184
private ModelAndView generateErrorView(final String code, final Object[] args) {
        val modelAndView = new ModelAndView(this.failureView);
        val convertedDescription = getMessageSourceAccessor().getMessage(code, args, code);
        modelAndView.addObject("code", StringEscapeUtils.escapeHtml4(code));
        modelAndView.addObject("description", StringEscapeUtils.escapeHtml4(convertedDescription));
        return modelAndView;
    }
1033127
public void reportFailure(E failureException) {
        assert failureException != null;
        connectionLock.lock();
        try {
            state = State.Failure;
            this.failureException = failureException;
            condition.signalAll();
        }
        finally {
            connectionLock.unlock();
        }
    }
208375
public Reportable generateReports() {
        Trends trends = null;

        try {
            // first copy static resources so ErrorPage is displayed properly
            copyStaticResources();

            // create directory for embeddings before files are generated
            createEmbeddingsDirectory();

            // add metadata info sourced from files
            reportParser.parseClassificationsFiles(configuration.getClassificationFiles());

            // parse json files for results
            List<Feature> features = reportParser.parseJsonFiles(jsonFiles);
            reportResult = new ReportResult(features, configuration);
            Reportable reportable = reportResult.getFeatureReport();

            if (configuration.isTrendsAvailable()) {
                // prepare data required by generators, collect generators and generate pages
                trends = updateAndSaveTrends(reportable);
            }

            // Collect and generate pages in a single pass
            generatePages(trends);

            return reportable;

            // whatever happens we want to provide at least error page instead of incomplete report or exception
        } catch (Exception e) {
            generateErrorPage(e);
            // update trends so there is information in history that the build failed

            // if trends was not created then something went wrong
            // and information about build failure should be saved
            if (!wasTrendsFileSaved && configuration.isTrendsAvailable()) {
                Reportable reportable = new EmptyReportable();
                updateAndSaveTrends(reportable);
            }

            // something went wrong, don't pass result that might be incomplete
            return null;
        }
    }
389219
public void setFailedEvaluations(java.util.Collection<Evaluation> failedEvaluations) {
        if (failedEvaluations == null) {
            this.failedEvaluations = null;
            return;
        }

        this.failedEvaluations = new com.amazonaws.internal.SdkInternalList<Evaluation>(failedEvaluations);
    }
948284
public S handle(List<Class<? extends Throwable>> failures) {
    Assert.notNull(failures, "failures");
    Assert.isTrue(!failures.isEmpty(), "failures cannot be empty");
    failuresChecked = true;
    failureConditions.add(failurePredicateFor(failures));
    return (S) this;
  }
1120869
public void setErrors(java.util.Collection<ErrorDetail> errors) {
        if (errors == null) {
            this.errors = null;
            return;
        }

        this.errors = new java.util.ArrayList<ErrorDetail>(errors);
    }
553308
public function onFailure()
    {
        if ($this->onConnected) {
            $this->onConnected->executeAll($this);
            $this->onConnected = null;
        }
    }
557667
public void setFailedBatches(java.util.Collection<FailedRemediationBatch> failedBatches) {
        if (failedBatches == null) {
            this.failedBatches = null;
            return;
        }

        this.failedBatches = new com.amazonaws.internal.SdkInternalList<FailedRemediationBatch>(failedBatches);
    }
954050
protected Map<String, Collection<StepExecutionResult>> convertFailures(
            final Map<Integer, StepExecutionResult> failedMap
    )
    {

        final Map<String, Collection<StepExecutionResult>> failures
                = new HashMap<>();
        for (final Map.Entry<Integer, StepExecutionResult> entry : failedMap.entrySet()) {
            final StepExecutionResult o = entry.getValue();

            if (NodeDispatchStepExecutor.isWrappedDispatcherResult(o)) {
                //indicates dispatcher returned node results
                final DispatcherResult dispatcherResult = NodeDispatchStepExecutor.extractDispatcherResult(o);

                for (final String s : dispatcherResult.getResults().keySet()) {
                    final NodeStepResult interpreterResult = dispatcherResult.getResults().get(s);
                    if (!failures.containsKey(s)) {
                        failures.put(s, new ArrayList<>());
                    }
                    failures.get(s).add(interpreterResult);
                }
            } else if (NodeDispatchStepExecutor.isWrappedDispatcherException(o)) {
                DispatcherException e = NodeDispatchStepExecutor.extractDispatcherException(o);
                final INodeEntry node = e.getNode();
                if (null != node) {
                    //dispatch failed for a specific node
                    final String key = node.getNodename();
                    if (!failures.containsKey(key)) {
                        failures.put(key, new ArrayList<>());
                    }
                    NodeStepException nodeStepException = e.getNodeStepException();
                    if (null != nodeStepException) {
                        failures.get(key).add(
                                nodeStepResultFromNodeStepException(node, nodeStepException)
                        );
                    }
                }
            }
        }
        return failures;
    }