I have tried using the below code and got a NullPointerException error log. I've imported as many classes as I could find. Some even twice XD
Maybe I'm using the update function wrong or the ErrorCollection wrong. Any suggestions/solutions are greatly appreciated.
please check How to edit a Kanban Board quick filter using groovy? which is proving the solution for your problem.
Kind regards
Andre
Ah, a challenge :-)
Imports are not a problem - you'd get "can't find out how to do this" type errors. Like "please multiply 6 by blue", the message would be "blue is not something any of our libraries know how to multiply by 6". If your imports were wrong, you'd get "unrecognisable function" type messages.
NPEs are what Java throws when you try to say, "do this with a null/incomprehensible value", and the function can't cope. (Don't blame the developers, they can't code for every possible NPE all the time, albeit I'm really bad at it)
So. Your error report should be reporting the (first) line an NPE occurs. One of the (not large numbers of) things I like about Java is that it reports the line of code it failed on, unlike the languages I learned to code in before 2004.
If you've got a 250-line script and you load it up in an editor that shows you line numbers, when you get an NPE reporting line 42, it really is happening on line 42, including all the empty lines you used to make it more readable.
So. Can you tell us what line the NPE happens on? Given your script posted above, what I would need to get started is a minimal "it happens on the line that says "XYZ"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The line that throws the NullPointerException (NPE) is:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!
So this is where you need to start working backwards - that update function needs broadly what you've named the variables you've put into it - the user to act as, the rapidview (board), a quickfilter, and an error collection object.
The user looks fine to me, so I'd start with the other three.
The easiest one to amend would be the error collection - you've already created the object, but you've given the function null, so change it to the error collection instead.
If that doesn't work, or even just change the error message, then I'd look at the other two - one of them probably does not contain what the function needs.
You could try to trace it back through the code, but you could do a much quicker and brutal test - try dumping the content of them in a simple log string "log.debug (rapidViews + "/" + newQuickFilterBuild)"
Java will try to convert it to something moderately human-readable, but the obvious one is if you get a null in one, or both, you need to look at the code that is populating the variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've narrowed down the source of the error. It's the errorCollection parameter. The only issue now is I do not know how to populate that.
The errorCollection in use in the update function is from the Greenhopper library: https://docs.atlassian.com/jira-software/6.3.2.1/com/atlassian/greenhopper/model/validation/ErrorCollection.html
Unlike the errorCollection in https://docs.atlassian.com/software/jira/docs/api/7.4.1/com/atlassian/jira/util/ErrorCollection.html. The Greenhopper version has no known implementing classes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.