Hi,
I wrore a new jira custom plugin , in this i m trying to read the mailqueue size using size() method from MailQueue Interface , here i got the NullpointerException , i can't understand why it happens?
can you share the your code?
class JiraCustomMailService extends AbstractService{
MailQueue mailqueue;
public void run() {
sizequeue = mailqueue.size();// here i got the plroblem
}
how your getting "mailqueue" object?
You're not initialising mailqueue so it's just null based on the snipped you've sent, hense why you get the nullpointerexception. You need to initialise it, something like this:-
MailQueue mailqueue = ComponentAccessor.getMailQueue();
Or alternatively, just do this:-
int mbsize = ComponentAccessor.getMailQueue().size();
Hi Mitchell,
instatiated the mailQueue is fine same as for MailQueItem how can i instatiate , when i m using ComponentAccessor for this there is no method like getMailQueueItem()
It depends what you're trying to do exactly. This would get an item being sent:-
MailQueue mailqueue = ComponentAccessor.getMailQueue(); MailQueueItem mailqueueitem = mailqueue.getItemBeingSent();
This would get a list of items in the queue in the form of a java queue:-
MailQueue mailqueue = ComponentAccessor.getMailQueue(); Queue<MailQueueItem> mailqueueitem = mailqueue.getQueue();
This would get the error queue in the form of a java queue:-
MailQueue mailqueue = ComponentAccessor.getMailQueue(); Queue<MailQueueItem> mailqueueitem = mailqueue.getErrorQueue();
i want to get getDateQueued() , i m searching for that..
How to get the getDateQueued() ,
It looks like you're new here. Sign in or register to get started.