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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

Null pointer execption error while fetching plan using PlanManager.

Hi,

Can someone please provide a hint as to what could be going wrong, I am using atlassian-sdk to develop a plugin which displays a new tab when a job containing a specific task (RobotTask) is clicked..

I am getting Null pointer exception error for a very simple thing that I am doing which is fetching the Plan by using the planKey and PlanManager.

Code

64: Plan plan = planManager.getPlanByKey(planKey).

I have a valid plan key which is "TPRO1-TPLAN1-JOB1". Even when I try to use "TPRO1-TPLAN1" as the plan key, I still get the exception...

 

My code looks like this

public boolean shouldDisplay(Map<String, Object> context) {
    	PlanKey planKey = PlanKeys.getPlanKey((String) context.get("planKey"));
        Plan plan = planManager.getPlanByKey(planKey);
       
        List<TaskDefinition> tasks = plan.getBuildDefinition().getTaskDefinitions();
        for(TaskDefinition task : tasks) {
            if(task.getPluginKey().equals(RobotTask.KEY) ) {
                return true;
            }
        }

        return false;
    }

 

Below is the stack strace

[INFO] [talledLocalContainer] 2018-05-10 12:14:39,083 ERROR [http-nio-6990-exec-12] [DefaultWebInterfaceManager] Could not evaluate condition 'isode.robot.RobotReportViewCondition@72267783' for descriptor: isode.robotplugin:KeyWebItemRobotReportTab (null)
[INFO] [talledLocalContainer] java.lang.NullPointerException
[INFO] [talledLocalContainer]     at isode.robot.RobotReportViewCondition.shouldDisplay(RobotReportViewCondition.java:64)
[INFO] [talledLocalContainer]     at com.atlassian.plugin.web.DefaultWebInterfaceManager.filterFragmentsByCondition(DefaultWebInterfaceManager.java:153)
[INFO] [talledLocalContainer]     at com.atlassian.plugin.web.DefaultWebInterfaceManager.getDisplayableItems(DefaultWebInterfaceManager.java:106)
[INFO] [talledLocalContainer]     at com.atlassian.bamboo.ww2.BambooActionSupport.getWebItemsForSection(BambooActionSupport.java:431)
[INFO] [talledLocalContainer]     at sun.reflect.GeneratedMethodAccessor1656.invoke(Unknown Source)
[INFO] [talledLocalContainer]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [talledLocalContainer]     at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] [talledLocalContainer]     at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1459)
[INFO] [talledLocalContainer]     at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:69)
[INFO] [talledLocalContainer]     at freemarker.core.MethodCall._eval(MethodCall.java:76)
[INFO] [talledLocalContainer]     at freemarker.core.Expression.eval(Expression.java:81)
[INFO] [talledLocalContainer]     at freemarker.core.Assignment.accept(Assignment.java:134)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.visit(Environment.java:362)
[INFO] [talledLocalContainer]     at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:239)
[INFO] [talledLocalContainer]     at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:200)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.visitIteratorBlock(Environment.java:595)
[INFO] [talledLocalContainer]     at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:81)
[INFO] [talledLocalContainer]     at freemarker.core.IteratorBlock.accept(IteratorBlock.java:67)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.visit(Environment.java:362)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.invoke(Environment.java:714)
[INFO] [talledLocalContainer]     at freemarker.core.UnifiedCall.accept(UnifiedCall.java:86)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.visit(Environment.java:326)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.visit(Environment.java:368)
[INFO] [talledLocalContainer]     at freemarker.core.Environment.invoke(Environment.java:714)
[

1 comment

I found what the problem was, I did not have the constructor to do the initialization.

Below solved it.

public RobotReportViewCondition(final PlanManager planManager){
this.planManager = planManager;

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Bamboo

Bamboo 7.2 is here!

I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...

146 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you