The simplest Groovy

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...

1 answer

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...

NB - you don't have to do it like the code Rambanam posted - both ways are valid, and both will produce the same result.

Hi Jamie and Rambanam,

The question actually primarily was a question of: Can I avoid the stacktraces in catalina.out from (working) code?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

125 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you