Running this:
import com.opensymphony.workflow.InvalidInputException
invalidInputException = newInvalidInputException("Incident Resolved is not filled.")
puts this error in the JIRA screen just as expected, but also produces this in catalina.out - why?
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at Script18.run(Script18.groovy:6) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:103) at com.onresolve.jira.groovy.GroovyRunner.runFile(GroovyRunner.java:102) at com.onresolve.jira.groovy.GroovyRunner.run(GroovyRunner.java:62) at com.onresolve.jira.groovy.GroovyValidator.validate(GroovyValidator.java:44)
Even though it works, error message is concerning...
you have to use as follows
InvalidInputException e= new InvalidInputException(); e.addError("error message"); throw e;
refer this question
https://answers.atlassian.com/questions/225982/simple-script-validation?page=1#226000
Thank, the script
import com.opensymphony.workflow.InvalidInputException InvalidInputException e= new InvalidInputException(); e.addError("Incident Resolved is not filled."); throw e;
Gives:
2013-11-06 12:06:07,600 http-bio-6060-exec-3 ERROR npn 726x339302x1 3wpz9n 77.243.49.10 /secure/CommentAssignIssue.jspa [onresolve.jira.groovy.GroovyRunner] The script failed : javax.script.ScriptException: javax.script.ScriptException: [InvalidInputException: [Error map: [{}]] [Error list: [[Incident Resolved is not filled.]]] at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at Script20.run(Script20.groovy:6) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:103) at com.onresolve.jira.groovy.GroovyRunner.runFile(GroovyRunner.java:102) at com.onresolve.jira.groovy.GroovyRunner.run(GroovyRunner.java:62) at com.onresolve.jira.groovy.GroovyValidator.validate(GroovyValidator.java:44)
This may be because of the thrown execption - and behavior as designed? Still - my catalina.out is filled with exeptions enough already...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
here explained about that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
NB - you don't have to do it like the code Rambanam posted - both ways are valid, and both will produce the same result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie and Rambanam,
The question actually primarily was a question of: Can I avoid the stacktraces in catalina.out from (working) code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
little bit configuration need to be done, check this Q
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.