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