File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
kotlin-jira-client/kotlin-jira-client-sdk/src/main/kotlin/com/linkedplanet/kotlinjiraclient/sdk/util Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,21 @@ class IssueJsonConverter {
4545 private val log = LoggerFactory .getLogger(FieldAccessorImpl ::class .java)
4646 private val fieldLayoutManager = ComponentAccessor .getFieldLayoutManager()
4747 private val fieldManager = ComponentAccessor .getFieldManager()
48- private val beanBuilderFactory = ComponentAccessor .getOSGiComponentInstanceOfType(BeanBuilderFactory ::class .java)
48+ private var _beanBuilderFactory = ComponentAccessor .getOSGiComponentInstanceOfType(BeanBuilderFactory ::class .java)
49+ private val beanBuilderFactory: BeanBuilderFactory
50+ get() {
51+ // For unknown reasons the factory is sometimes null. This workaround tries to fetch the instance again.
52+ if (_beanBuilderFactory == null ) {
53+ log.warn(" _beanBuilderFactory is null. Using getOSGiComponentInstanceOfType" )
54+ _beanBuilderFactory = ComponentAccessor .getOSGiComponentInstanceOfType(BeanBuilderFactory ::class .java)
55+ }
56+ if (_beanBuilderFactory == null ) {
57+ log.warn(" _beanBuilderFactory is null. Using getComponent" )
58+ _beanBuilderFactory = ComponentAccessor .getComponent(BeanBuilderFactory ::class .java)
59+ }
60+ log.error(" unable to find _beanBuilderFactory" )
61+ return _beanBuilderFactory
62+ }
4963 private val jiraBaseUrls: JiraBaseUrls = ComponentAccessor .getComponent(JiraBaseUrls ::class .java)
5064 private val uriBuilder: UriBuilder = UriBuilder .fromPath(jiraBaseUrls.restApi2BaseUrl())
5165 private val gson = setupGson()
You can’t perform that action at this time.
0 commit comments