Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,390
Community Members
 
Community Events
176
Community Groups

Behaviour: formField.setFormValue causes java.lang.StackOverflowError

Edited

Hello,

i am trying to set a formfield using a behaviour.

The data i am trying to set is read from another issue.

When i try to set the field value like this

Issue presetFound = (Issue) issueIterator.next()
Customfield field = customfieldManager.getCustomFieldObject(11603L)
java.lang.Object fieldValue = presetFound.getCustomFieldValue(field)
if (fieldValue != null) {
com.onresolve.jira.groovy.user.FormField formField = getFieldById(field.getId())
errorMessage += "set field " + field.getId() + " to " + fieldValue.toString() + ", field is " + formField.getClass().toString()
formField.setFormValue(fieldValue)
}

When i comment out the last statement the errorMessage is 

set field customfield_11700 to KLE-VE-4753 field is class com.onresolve.jira.groovy.user.FormField

When the statement is not uncommented the beheviour is not executed and this errror is logged:

2018-10-30 16:41:43,441 http-nio-8080-exec-79 ERROR admin 1001x12741x1 1s5x3j9 80.147.223.246,127.0.0.1 /rest/scriptrunner/behaviours/latest/runvalidator.json [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: null
java.lang.StackOverflowError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:62)
at groovy.lang.PropertyValue.getValue(PropertyValue.java:42)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:389)
at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:327)
at groovy.json.JsonOutput.writeObject(JsonOutput.java:320)

See here for the Full Exception

1 answer

1 accepted

0 votes
Answer accepted

Hi @Jens Kisters __SM,

your are add an Object to custom field and this cause the error. Please, could you verify what is the type of your custom field?

If it is a text, you need to add String as value, if it is a select list you need to add an Option and so on.

Great, that was exactly the problem.

Thanks a lot!

You're welcome Jens!

brbojorque Community Leader Dec 03, 2018

Hi Jens, can you provide the full working code?

Hi Bryan,

 

i have nothing i can quickly paste for you, but the working version should be something like this (3rd line is the one with the change):

 


Issue presetFound = (Issue) issueIterator.next()
Customfield field = customfieldManager.getCustomFieldObject(11603L)
String fieldValue = (String) presetFound.getCustomFieldValue(field)
if (fieldValue != null) {
com.onresolve.jira.groovy.user.FormField formField = getFieldById(field.getId())
errorMessage += "set field " + field.getId() + " to " + fieldValue.toString() + ", field is " + formField.getClass().toString()
formField.setFormValue(fieldValue)
}

Am I the only one left wondering why this causes a StackOverflowError?

Like Marko Slijepčević likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events