/** * Method detects the service states of the given service type. * * @param serviceType the type of the service states. * @throws CouldNotPerformException is thrown if the detection fails. */ private void detectAndRegisterServiceStates(final ServiceType serviceType) throws CouldNotPerformException { try { final MultiException.ExceptionStack exceptionStack = new MultiException.ExceptionStack(); Services.getServiceStateValues(serviceType).forEach((stateValue) -> { try { // filter unknown state values if (stateValue.name().equals("UNKNOWN")) { return; } // add built service state registerServiceState(Services.buildServiceState(serviceType, stateValue)); } catch (final Exception ex) { MultiException.push(this, ex, exceptionStack); } }); MultiException.checkAndThrow("Could not generate all service values!", exceptionStack); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not generate service states!", ex); } } }
ExceptionStack exceptionStack = new ExceptionStack();
private void initServiceSimulators(final UnitController unitController) throws InitializationException, InterruptedException { try { final MultiException.ExceptionStack exceptionStack = new MultiException.ExceptionStack(); for (final ServiceDescription serviceDescription : unitController.getUnitTemplate().getServiceDescriptionList()) { try { serviceSimulatorList.add(serviceSimulatorFactory.newInstance(unitController, serviceDescription.getType())); } catch (final CouldNotPerformException ex) { MultiException.push(this, ex, exceptionStack); } } try { MultiException.checkAndThrow("Could not init all service simulators!", exceptionStack); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(ex, LOGGER); } } catch (CouldNotPerformException ex) { throw new InitializationException(this, ex); } }
final String url = OntConfig.getOntologyDbUrl(); final ResultSet resultSet = SparqlHttp.sparqlQuery(query, url, 0); ExceptionStack exceptionStack = new ExceptionStack();
final ExceptionStack exceptionStack = new ExceptionStack();
final ExceptionStack exceptionStack = new ExceptionStack(); String currentObservationId = "";
/** * Method ensures that one or multiple object reference(s) passed as a parameter to the calling method is/are not * null. Throws Exception otherwise. * * @param source is the source of the reference(s). Can be ignored by NULL. * @param objects are the reference parameter, which should be checked. * @throws MultiException is thrown in case at least one reference parameter is NULL. */ static void multipleCheckNotNullAndThrow(final Object source, final Object... objects) throws MultiException { final ExceptionStack exceptionStack = new ExceptionStack(); for (int i = 0; i < objects.length; i++) { try { checkNotNull(objects[i], "Parameter " + i + " in argument array is null!"); } catch (NotAvailableException e) { MultiException.push(source, e, exceptionStack); } } MultiException.checkAndThrow("Input is invalid.", exceptionStack); }
/** * Method initializes the input exceptionStack if it's null. * * @param exceptionStack which should be initialized. * @return an initialized and empty exceptionStack if input is null. Otherwise the unchanged input exceptionStack. */ static ExceptionStack initializeIfNull(ExceptionStack exceptionStack) { exceptionStack = (exceptionStack == null) ? new ExceptionStack() : exceptionStack; return exceptionStack; }