Getting package import error while creating due-date-indicator plugin?

parvati r October 23, 2017

Hi Guys,

I am attempting to build a due-date-indicator plugin. I have imported my code into the eclipse. I am getting errors in the package import statement in the .java file. In the .java file I am getting error in the "package com.atlassian.jira.user;" statement. In the eclipse it is showing error hint as "The declared package "com.atlassian.jira.user" does not match the expected package "com.example.plugins.tutorial". By keeping this error in the file I run my code using atlas command. I got the error in the Jira view issue page "Error rendering 'com.example.plugins.tutorial.duedate:due-date-indicator'. Please contact your JIRA administrators". How to resolve this error?

My .java file:

package com.example.plugins.tutorial;
package com.atlassian.jira.user;
import com.atlassian.jira.user.ApplicationUser;

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;

import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import java.io.*;
import java.lang.*;
public class DueDateIndicator extends AbstractJiraContextProvider
{
private static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;

@Override
public Map getContextMap(ApplicationUser applicationUser, JiraHelper jiraHelper) {
Map contextMap = new HashMap();
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
Timestamp dueDate = currentIssue.getDueDate();
if (dueDate != null)
{
int currentTimeInDays = (int) (System.currentTimeMillis() / MILLIS_IN_DAY);
int dueDateTimeInDays = (int) (dueDate.getTime() / MILLIS_IN_DAY);

int daysAwayFromDueDateCalc = dueDateTimeInDays - currentTimeInDays + 1;
contextMap.put("daysAwayFromDueDate", daysAwayFromDueDateCalc);
}
return contextMap;
}

//@Override
//public Map getContextMap(ApplicationUser arg0, JiraHelper arg1) {
//TODO Auto-generated method stub
// return null;
//}



}

Thanks in advance




0 answers

Suggest an answer

Log in or Sign up to answer