Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SAL ComponentLocator returns null for ApplicationProperties

Parashar Joshi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 15, 2018 edited

Hi,

Was working on a plugin that does some basic stuff in both Jira & Confluence.
I need to get some application property and determine if the application the plugin is in Jira or Confluence. 

I found that SAL has a class that can help me determine the application. So i am trying to get the instance for the class from SAL ComponentLocator method.

However the issue is that it works fine in Confluence and returns the ApplicationProperties instance but returns null for Jira.

Java code snippet.

import com.atlassian.sal.api.ApplicationProperties;
import com.atlassian.sal.api.component.ComponentLocator;

...

String getPlatform(){
ApplicationProperties applicationProperties = ComponentLocator.getComponent(ApplicationProperties.class);
System.out.println("Is AppProp Null? : " + applicationProperties==null);
if (applicationProperties != null) {
System.out.println("Current platform is : " + applicationProperties.getPlatformId());
}
...
}
...

Logs in Confluence :

Is AppProp Null? : false
Current platform is : conf

Logs in Jira:

Is AppProp Null? : true

0 answers

Suggest an answer

Log in or Sign up to answer