Disabling the Groovyrunner plugin (https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner) seemed to fix the problem. Not getting the error message anymore. Anyone else seen this before? Do you know what caused it?
We are using JIRA 5.0.4
Any help would be greatly appreciated. The plugin has a lot of features we are interested in and wish to remain using. Is there some part of it that may cause this error that we should be aware of?
I had the same issue and found that the field type and scripted fied type was mismatched.
Check the script field type (Text Field, Number Field... etc) and also verify the Search Template type <custom= field/ your field name > edit (Text Field, Number Field...etc) – Both should match the same based on the script output.
You can find the error if you test your code with any JIRA issue. There should be a field under the script console, named as "Preview with issue" --Type the issue key and test it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is minoir change.Please refer to this code:
import static java.util.Calendar.*
def startDate = new Date("22/05/2013");
def endDate = new Date("24/06/2013");
if ((startDate == null || startDate.equals("")) || (endDate == null || endDate.equals(""))){
return 0 as Double;
}
Calendar startCal;
Calendar endCal;
startCal = Calendar.getInstance();
startCal.setTime(startDate);
endCal = Calendar.getInstance();
endCal.setTime(endDate);
def getWorkDays(Calendar startCal, Calendar endCal){
int workDays = -1;
//Return 0 if start and end are the same
if (startCal.getTimeInMillis() == endCal.getTimeInMillis()) {
++workDays;
return workDays as Double;
}
if (startCal.getTimeInMillis() > endCal.getTimeInMillis()) {
return workDays as Double;
}
while (startCal.getTimeInMillis() <= endCal.getTimeInMillis()){
// Uncomment this block to exclude Weekends and Holidays
//if (startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY
// && startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY
// && !isHoliday(startCal)) {
++workDays;
//}
startCal.add(Calendar.DAY_OF_MONTH, 1);
}
return workDays as Double;
}
def isHoliday(Calendar calendarDay){
def holidays = getCalendarForYear(calendarDay.get(Calendar.YEAR))
for (holiday in holidays) {
if (calendarDay.get(Calendar.YEAR) == holiday.get(Calendar.YEAR)
&& calendarDay.get(Calendar.MONTH) == holiday.get(Calendar.MONTH)
&& calendarDay.get(Calendar.DAY_OF_MONTH) == holiday.get(Calendar.DAY_OF_MONTH)){
return true;
}
}
return false;
}
def getCalendarForYear(year){
def holidays2011 = [new GregorianCalendar(2011, Calendar.SEPTEMBER, 5),
new GregorianCalendar(2011, Calendar.NOVEMBER, 24),
new GregorianCalendar(2011, Calendar.NOVEMBER, 25),
new GregorianCalendar(2011, Calendar.DECEMBER, 26),
new GregorianCalendar(2011, Calendar.DECEMBER, 27)]
def holidays2012 = [new GregorianCalendar(2012, Calendar.JANUARY, 2),
new GregorianCalendar(2012, Calendar.JANUARY, 16),
new GregorianCalendar(2012, Calendar.MAY, 28),
new GregorianCalendar(2012, Calendar.JULY, 4),
new GregorianCalendar(2012, Calendar.SEPTEMBER, 3),
new GregorianCalendar(2012, Calendar.NOVEMBER, 22),
new GregorianCalendar(2012, Calendar.NOVEMBER, 23),
new GregorianCalendar(2012, Calendar.DECEMBER, 24),
new GregorianCalendar(2012, Calendar.DECEMBER, 25),
new GregorianCalendar(2012, Calendar.DECEMBER, 31)]
def holidays2013 = [new GregorianCalendar(2013, Calendar.JANUARY, 1),
new GregorianCalendar(2013, Calendar.JANUARY, 21),
new GregorianCalendar(2013, Calendar.MAY, 27),
new GregorianCalendar(2013, Calendar.JULY, 4),
new GregorianCalendar(2013, Calendar.JULY, 5)]
switch (year) {
case "2011" :
return holidays2011;
break
case "2012" :
return holidays2012;
break
case "2013" :
return holidays2013;
break
}
}
return getWorkDays(startCal, endCal);
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.
I have been facing this issue for the long time. Can someone help me please to resolve the issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My JIRA version is 4.4 and below is my code
import static java.util.Calendar.*
def startDate = getCustomFieldValue("22/05/2013");
def endDate = getCustomFieldValue("24/06/2013");
if ((startDate == null || startDate.equals("")) || (endDate == null || endDate.equals(""))){
return 0 as Double;
}
Calendar startCal;
Calendar endCal;
startCal = Calendar.getInstance();
startCal.setTime(startDate);
endCal = Calendar.getInstance();
endCal.setTime(endDate);
def getWorkDays(Calendar startCal, Calendar endCal){
int workDays = 0;
//Return 0 if start and end are the same
if (startCal.getTimeInMillis() == endCal.getTimeInMillis()) {
++workDays;
return workDays as Double;
}
if (startCal.getTimeInMillis() > endCal.getTimeInMillis()) {
return workDays as Double;
}
while (startCal.getTimeInMillis() <= endCal.getTimeInMillis()){
// Uncomment this block to exclude Weekends and Holidays
//if (startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY
// && startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY
// && !isHoliday(startCal)) {
++workDays;
//}
startCal.add(Calendar.DAY_OF_MONTH, 1);
}
return workDays as Double;
}
def isHoliday(Calendar calendarDay){
def holidays = getCalendarForYear(calendarDay.get(Calendar.YEAR))
for (holiday in holidays) {
if (calendarDay.get(Calendar.YEAR) == holiday.get(Calendar.YEAR)
&& calendarDay.get(Calendar.MONTH) == holiday.get(Calendar.MONTH)
&& calendarDay.get(Calendar.DAY_OF_MONTH) == holiday.get(Calendar.DAY_OF_MONTH)){
return true;
}
}
return false;
}
def getCalendarForYear(year){
def holidays2011 = [new GregorianCalendar(2011, Calendar.SEPTEMBER, 5),
new GregorianCalendar(2011, Calendar.NOVEMBER, 24),
new GregorianCalendar(2011, Calendar.NOVEMBER, 25),
new GregorianCalendar(2011, Calendar.DECEMBER, 26),
new GregorianCalendar(2011, Calendar.DECEMBER, 27)]
def holidays2012 = [new GregorianCalendar(2012, Calendar.JANUARY, 2),
new GregorianCalendar(2012, Calendar.JANUARY, 16),
new GregorianCalendar(2012, Calendar.MAY, 28),
new GregorianCalendar(2012, Calendar.JULY, 4),
new GregorianCalendar(2012, Calendar.SEPTEMBER, 3),
new GregorianCalendar(2012, Calendar.NOVEMBER, 22),
new GregorianCalendar(2012, Calendar.NOVEMBER, 23),
new GregorianCalendar(2012, Calendar.DECEMBER, 24),
new GregorianCalendar(2012, Calendar.DECEMBER, 25),
new GregorianCalendar(2012, Calendar.DECEMBER, 31)]
def holidays2013 = [new GregorianCalendar(2013, Calendar.JANUARY, 1),
new GregorianCalendar(2013, Calendar.JANUARY, 21),
new GregorianCalendar(2013, Calendar.MAY, 27),
new GregorianCalendar(2013, Calendar.JULY, 4),
new GregorianCalendar(2013, Calendar.JULY, 5)]
switch (year) {
case "2011" :
return holidays2011;
break
case "2012" :
return holidays2012;
break
case "2013" :
return holidays2013;
break
}
}
return getWorkDays(startCal, endCal);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of the script runner plugin are you using... maybe you need to upgrade it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
We are using version 2.0.7 of the script runner plugin. Which seems to be the most up-to-date version (at least thats the version on the marketplace). We also have been using JIRA 5.0.4. for a while. We had the script runner enabled for at least a week or so and everything worked fine. The most recent change that we started making was using the scripts as post functions in the workflow. Could that have something to do with it?
The error it gives is a little peculiar. The link (http://confluence.atlassian.com/x/3McB) is to a page about upgrading workflow plugins for JIRA 3.2. So, I thought it might have something to do with some of the scripts that run in the workflows themselves. Any thoughts?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, I would say so. The exception is probably thrown by a deprecated method in your code... unless you are using the built-in scripts? If it's your code could you post it, if it's a built-in script then which one is causing the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe we were only using the built in scripts. Specifically the custom email on transition, script field and fast-tracking an issue on transition. And most of the time these were done in the plugin itself rather than the workflows. Unfortunately I can't go in and see exactly what was wrong yet; the plugin is disabled and we are on a production instance so I can't enable it just to check. But we are looking into the log files to see if we can find anything there. So, we don't know what exactly was causing the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hrm. Well, I haven't seen that issue before. I'd recommend you try to reproduce the issue in a dev instance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.