@Test public void test130EvaluateExpressionEmployeeTypeError() throws Exception { final String TEST_NAME = "testEvaluateExpressionEmployeeTypeError"; TestUtil.displayTestTitle(TEST_NAME); // GIVEN OperationResult result = new OperationResult(TestFilterExpression.class.getName() + "." + TEST_NAME); Task task = taskManager.createTaskInstance(TEST_NAME); try { evaluateExpressionAssertFilter("expression-employeeType-error.xml", null, NoneFilter.class, task, result); AssertJUnit.fail("Unexpected success"); } catch (ExpressionEvaluationException e) { // this is expected assertTrue("Unexpected exception message: "+e.getMessage(), e.getMessage().contains("evaluated to no value")); } }
private <T> T convertScalarResult(Class<T> expectedType, Function<Object, Object> additionalConvertor, Object rawValue, String contextDescription) throws ExpressionEvaluationException { try { T convertedValue = ExpressionUtil.convertValue(expectedType, additionalConvertor, rawValue, protector, prismContext); return convertedValue; } catch (IllegalArgumentException e) { throw new ExpressionEvaluationException(e.getMessage() + " in " + contextDescription, e); } }
+ " resolution in " + contextDescription + ": " + e.getMessage(), e); } catch (ExpressionEvaluationException e) { throw new ExpressionEvaluationException("Expression evaluation error during variable " + varDesc + " resolution in " + contextDescription + ": " + e.getMessage(), e);
Throwable cause = e.getCause(); if (!(cause instanceof AssertionError)) { throw e;
throw new TunnelException( localizationService.translate( new ExpressionEvaluationException( e.getMessage() + "("+dumpSourceValues(sourceVariables)+") in "+contextDescription, e, ExceptionUtil.getUserFriendlyMessage(e))));
public static <V extends PrismValue> V getExpressionOutputValue(PrismValueDeltaSetTriple<V> outputTriple, String shortDesc) throws ExpressionEvaluationException { if (outputTriple == null) { return null; } Collection<V> nonNegativeValues = outputTriple.getNonNegativeValues(); if (nonNegativeValues == null || nonNegativeValues.isEmpty()) { return null; } if (nonNegativeValues.size() > 1) { throw new ExpressionEvaluationException("Expression returned more than one value (" + nonNegativeValues.size() + ") in " + shortDesc); } return nonNegativeValues.iterator().next(); }
throw new ExpressionEvaluationException(ex); throw new ExpressionEvaluationException(ex); LoggingUtils.logException(LOGGER, "Couldn't evaluate expression " + PrettyPrinter.prettyPrint(valueExpression) + ".", ex); throw new ExpressionEvaluationException( "Couldn't evaluate expression " + PrettyPrinter.prettyPrint(valueExpression) + ": " + ex.getMessage(), ex);
return null; } catch (ExpressionEvaluationException ex) { LOGGER.error("Import: Error getting {} {}: {}", typeName, objectOid, ex.getMessage(), ex); opResult.recordFatalError("Error getting "+typeName+" " + objectOid+": "+ex.getMessage(), ex); runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR); return null;
private CompiledScript createCompiledScript(String codeString, String contextDescription) throws ExpressionEvaluationException { CompiledScript compiledScript = scriptCache.get(codeString); if (compiledScript != null) { return compiledScript; } try { InternalMonitor.recordCount(InternalCounters.SCRIPT_COMPILE_COUNT); compiledScript = ((Compilable)scriptEngine).compile(codeString); } catch (ScriptException e) { throw new ExpressionEvaluationException(e.getMessage() + " in " + contextDescription, e); } scriptCache.put(codeString, compiledScript); return compiledScript; }
} catch (ExpressionEvaluationException ex) { result.recordFatalError( "Expression error while setting up the resource: " + ex.getMessage(), ex); throw new ExpressionEvaluationException("Expression error while setting up the resource: " + ex.getMessage(), ex); } catch (GenericFrameworkException ex) { result.recordFatalError("Generic error in connector: " + ex.getMessage(), ex);
throw e; } catch (ExpressionEvaluationException e) { ProvisioningUtil.recordFatalError(LOGGER, result, "Couldn't delete object: expression errror: " + e.getMessage(), e); throw e; } catch (PolicyViolationException | RuntimeException | Error e) {
throw new ExpressionEvaluationException("No script code in " + contextDescription); evalRawResult = compiledScript.eval(bindings); } catch (Throwable e) { throw new ExpressionEvaluationException(e.getMessage() + " in " + contextDescription, e);
evaluateScriptingHook(context, hookType, scriptExpressionEvaluatorType, shortDesc, task, result); } catch (ExpressionEvaluationException e) { LOGGER.error("Evaluation of {} failed: {}", shortDesc, e.getMessage(), e); throw new ExpressionEvaluationException("Evaluation of "+shortDesc+" failed: "+e.getMessage(), e); } catch (ObjectNotFoundException e) { LOGGER.error("Evaluation of {} failed: {}", shortDesc, e.getMessage(), e);
throw ex; } catch (ExpressionEvaluationException ex) { parentResult.recordFatalError("Can't get resource object, expression error: " + ex.getMessage(), ex); throw ex; } catch (ConfigurationException e) {
Collection<PrismPropertyValue<Boolean>> nonNegativeValues = outputTriple.getNonNegativeValues(); if (nonNegativeValues == null || nonNegativeValues.isEmpty()) { throw new ExpressionEvaluationException("Expression returned no value ("+nonNegativeValues.size()+") in "+shortDesc); throw new ExpressionEvaluationException("Expression returned more than one value ("+nonNegativeValues.size()+") in "+shortDesc); throw new ExpressionEvaluationException("Expression returned no value ("+nonNegativeValues.size()+") in "+shortDesc); throw new ExpressionEvaluationException("Expression returned no value ("+nonNegativeValues.size()+") in "+shortDesc);
output.add(new PipelineItem(resourceValue, item.getResult())); } catch (ExpressionEvaluationException e) { throw new ScriptExecutionException("Error getting resource "+resourceTypePrismObject.getOid()+": "+e.getMessage(), e);
Collection<PrismPropertyValue<Boolean>> nonNegativeValues = outputTriple.getNonNegativeValues(); if (nonNegativeValues == null || nonNegativeValues.isEmpty()) { throw new ExpressionEvaluationException("Expression returned no value ("+nonNegativeValues.size()+") in "+shortDesc); throw new ExpressionEvaluationException("Expression returned more than one value ("+nonNegativeValues.size()+") in "+shortDesc); throw new ExpressionEvaluationException("Expression returned no value ("+nonNegativeValues.size()+") in "+shortDesc); throw new ExpressionEvaluationException("Expression returned no value ("+nonNegativeValues.size()+") in "+shortDesc);
throw new SystemException( "Couldn't evaluate filter expression for the resource in account construction in " + getSource() + ": " + e.getMessage(), e);
private ResourceType resolveResource(ShadowType shadow, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { if (shadow.getResource() != null) { return shadow.getResource(); } ObjectReferenceType ref = shadow.getResourceRef(); if (ref == null) { throw new ExpressionEvaluationException("Resource shadow object " + shadow + " doesn't have defined resource."); } if (ref.getOid() == null) { throw new ExpressionEvaluationException("Resource shadow object " + shadow + " defines null resource OID."); } return modelObjectResolver.getObjectSimple(ResourceType.class, ref.getOid(), null, null, result); }
return runResult; } catch (ExpressionEvaluationException ex) { LOGGER.error("Recompute: Expression error: {}",ex.getMessage(),ex); opResult.recordFatalError("Expression error: "+ex.getMessage(),ex); runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR); return runResult;