Community
Participate
Working Groups
Build Identifier: BIRT 2.6.0 Hello! I am working with BIRT 2.6.0 and a use RunAndRenderTask validateParameters(), and i know that the validation fails, but i need to know which parameter makes the validations fails and why. Is it possible ? Could i make a loop to validate the parameters one to one ? any workaround? could I get the ParameterValidationException list ? Thanks in advanced. Pico Reproducible: Always Steps to Reproduce: 1.validate parameters with RunAndRenderTask.validateParameters() 2.validation fails 3.we know that validations fails but not why
Actually, there is a log message telling the invalid parameter and its desired type. Another way to locate invalid parameter is to check parameter values one by one. For example: task.setParameterValue( "p1", "v1"); task.validateParameterValues(); task.setParameterValue( "p2", "v2"); task.validateParameterValues();
Hi, I know the log message but i`d need it at runtime to show to de user. where is the method validateParametersValues() ? I only know validateParameters() and if i use it to check parameters one to one, always give me false because it check all the parameters not only the parameter set. In your example if p2 is required the first validateParameters return false although p1 is ok. task.setParameterValue( "p1", "v1"); task.validateParameters(); ->> False because p2 is required and p1 is ok task.setParameterValue( "p2", "v2"); task.validateParameters(); another way ? Thanks a lot.
Oh, sorry, it's my typo, I mean validateParameters() by validateParameterValues(). There is no API to get detail result of validation at render time. We need to add a new method like: boolean validateParameters( boolean verbose ) throw EngineException; to throw exception with detail failure information. There are 2 workarounds for now: 1. In EngineTask, method doValidateParameters(), which does the actual validation, does throw out the exception. You can manage to create a dynamic proxy of the class and catch the exception. 2. If above solution is too tricky for you, you'd better use same logic in EngineTask to validate parameters by yourself. It's not difficult.
After calling task.validateParameters, you can call task.getErrors() to retrieve the error
Verified.