{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/smarthome/pulls/comments/168478352","pull_request_review_id":96836217,"id":168478352,"diff_hunk":"@@ -370,32 +369,7 @@ public void setCategory(@Nullable String category) {\n \n     @Override\n     public @Nullable StateDescription getStateDescription(@Nullable Locale locale) {\n-        StateDescription result = null;\n-        List<StateOption> stateOptions = Collections.emptyList();\n-        if (stateDescriptionProviders != null) {\n-            for (StateDescriptionProvider stateDescriptionProvider : stateDescriptionProviders) {\n-                StateDescription stateDescription = stateDescriptionProvider.getStateDescription(this.name, locale);\n-\n-                // as long as no valid StateDescription is provided we reassign here:\n-                if (result == null) {\n-                    result = stateDescription;\n-                }\n-\n-                // if the current StateDescription does provide options and we don't already have some, we pick them up\n-                // here\n-                if (stateDescription != null && !stateDescription.getOptions().isEmpty() && stateOptions.isEmpty()) {\n-                    stateOptions = stateDescription.getOptions();\n-                }\n-            }\n-        }\n-\n-        // we recreate the StateDescription if we found a valid one and state options are given:\n-        if (result != null && !stateOptions.isEmpty()) {\n-            result = new StateDescription(result.getMinimum(), result.getMaximum(), result.getStep(),\n-                    result.getPattern(), result.isReadOnly(), stateOptions);\n-        }\n-\n-        return result;\n+        return stateDescriptionService.getStateDescription(this.name, locale);","path":"bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/items/GenericItem.java","position":64,"original_position":64,"commit_id":"559aacd3c4d5d97a310dcc29c4691a44171c2300","original_commit_id":"559aacd3c4d5d97a310dcc29c4691a44171c2300","user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars3.githubusercontent.com/u/3244965?v=4","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"body":"This could result in an NPE as stateDescriptionService is nullable (and a dynamic+optional dependency in ItemRegistryImpl).","created_at":"2018-02-15T13:44:58Z","updated_at":"2018-02-15T13:46:19Z","html_url":"https://github.com/eclipse/smarthome/pull/4882#discussion_r168478352","pull_request_url":"https://api.github.com/repos/eclipse/smarthome/pulls/4882","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/comments/168478352"},"html":{"href":"https://github.com/eclipse/smarthome/pull/4882#discussion_r168478352"},"pull_request":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/4882"}}},"pull_request":{"url":"https://api.github.com/repos/eclipse/smarthome/pulls/4882","id":162067930,"html_url":"https://github.com/eclipse/smarthome/pull/4882","diff_url":"https://github.com/eclipse/smarthome/pull/4882.diff","patch_url":"https://github.com/eclipse/smarthome/pull/4882.patch","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/4882","number":4882,"state":"open","locked":false,"title":"Create state description merging service","user":{"login":"lpapazow","id":7544898,"avatar_url":"https://avatars0.githubusercontent.com/u/7544898?v=4","gravatar_id":"","url":"https://api.github.com/users/lpapazow","html_url":"https://github.com/lpapazow","followers_url":"https://api.github.com/users/lpapazow/followers","following_url":"https://api.github.com/users/lpapazow/following{/other_user}","gists_url":"https://api.github.com/users/lpapazow/gists{/gist_id}","starred_url":"https://api.github.com/users/lpapazow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpapazow/subscriptions","organizations_url":"https://api.github.com/users/lpapazow/orgs","repos_url":"https://api.github.com/users/lpapazow/repos","events_url":"https://api.github.com/users/lpapazow/events{/privacy}","received_events_url":"https://api.github.com/users/lpapazow/received_events","type":"User","site_admin":false},"body":"Created as a fix for #2267.\r\n\r\nAs suggested in this [discussion](https://github.com/eclipse/smarthome/pull/4428#issuecomment-340480706), created a **StateDescriptionService** that has a **getStateDescription** method, which iterates over all **StateDescriptionProviders** and sets the **StateDescription**'s fields if they haven't been set by a **StateDescriptionProvider** with higher ranking.\r\n\r\nThe list of **stateDescriptionProviders** is moved from the **ItemRegistryImpl** class to the **StateDescriptionService** and a **StateDescriptionService** reference is added to the **ItemRegistryImpl** which is later passed to the **GenericItem** class. \r\n\r\nChanged **GenericItem**'s **getStateDescription** method implementation to use **StateDescriptionService**'s **getStateDescription** method.\r\n\r\nAdded tests for the StateDescription service in the **StateDescriptionServiceImplTest** class.\r\n\r\n\r\nSigned-off-by: Lyubomir V. Papazov <lpapazow@gmail.com>","created_at":"2018-01-10T09:02:21Z","updated_at":"2018-02-15T13:46:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2246986d48cd394c10974cd11ddd80332bb526a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":232237622,"url":"https://api.github.com/repos/eclipse/smarthome/labels/feedback","name":"feedback","color":"e11d21","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/smarthome/pulls/4882/commits","review_comments_url":"https://api.github.com/repos/eclipse/smarthome/pulls/4882/comments","review_comment_url":"https://api.github.com/repos/eclipse/smarthome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/4882/comments","statuses_url":"https://api.github.com/repos/eclipse/smarthome/statuses/559aacd3c4d5d97a310dcc29c4691a44171c2300","head":{"label":"MusalaSoft:state-description-merging-service","ref":"state-description-merging-service","sha":"559aacd3c4d5d97a310dcc29c4691a44171c2300","user":{"login":"MusalaSoft","id":19668691,"avatar_url":"https://avatars0.githubusercontent.com/u/19668691?v=4","gravatar_id":"","url":"https://api.github.com/users/MusalaSoft","html_url":"https://github.com/MusalaSoft","followers_url":"https://api.github.com/users/MusalaSoft/followers","following_url":"https://api.github.com/users/MusalaSoft/following{/other_user}","gists_url":"https://api.github.com/users/MusalaSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/MusalaSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusalaSoft/subscriptions","organizations_url":"https://api.github.com/users/MusalaSoft/orgs","repos_url":"https://api.github.com/users/MusalaSoft/repos","events_url":"https://api.github.com/users/MusalaSoft/events{/privacy}","received_events_url":"https://api.github.com/users/MusalaSoft/received_events","type":"Organization","site_admin":false},"repo":{"id":63421435,"name":"smarthome","full_name":"MusalaSoft/smarthome","owner":{"login":"MusalaSoft","id":19668691,"avatar_url":"https://avatars0.githubusercontent.com/u/19668691?v=4","gravatar_id":"","url":"https://api.github.com/users/MusalaSoft","html_url":"https://github.com/MusalaSoft","followers_url":"https://api.github.com/users/MusalaSoft/followers","following_url":"https://api.github.com/users/MusalaSoft/following{/other_user}","gists_url":"https://api.github.com/users/MusalaSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/MusalaSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusalaSoft/subscriptions","organizations_url":"https://api.github.com/users/MusalaSoft/orgs","repos_url":"https://api.github.com/users/MusalaSoft/repos","events_url":"https://api.github.com/users/MusalaSoft/events{/privacy}","received_events_url":"https://api.github.com/users/MusalaSoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MusalaSoft/smarthome","description":"Eclipse SmartHome project","fork":true,"url":"https://api.github.com/repos/MusalaSoft/smarthome","forks_url":"https://api.github.com/repos/MusalaSoft/smarthome/forks","keys_url":"https://api.github.com/repos/MusalaSoft/smarthome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MusalaSoft/smarthome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MusalaSoft/smarthome/teams","hooks_url":"https://api.github.com/repos/MusalaSoft/smarthome/hooks","issue_events_url":"https://api.github.com/repos/MusalaSoft/smarthome/issues/events{/number}","events_url":"https://api.github.com/repos/MusalaSoft/smarthome/events","assignees_url":"https://api.github.com/repos/MusalaSoft/smarthome/assignees{/user}","branches_url":"https://api.github.com/repos/MusalaSoft/smarthome/branches{/branch}","tags_url":"https://api.github.com/repos/MusalaSoft/smarthome/tags","blobs_url":"https://api.github.com/repos/MusalaSoft/smarthome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MusalaSoft/smarthome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MusalaSoft/smarthome/git/refs{/sha}","trees_url":"https://api.github.com/repos/MusalaSoft/smarthome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MusalaSoft/smarthome/statuses/{sha}","languages_url":"https://api.github.com/repos/MusalaSoft/smarthome/languages","stargazers_url":"https://api.github.com/repos/MusalaSoft/smarthome/stargazers","contributors_url":"https://api.github.com/repos/MusalaSoft/smarthome/contributors","subscribers_url":"https://api.github.com/repos/MusalaSoft/smarthome/subscribers","subscription_url":"https://api.github.com/repos/MusalaSoft/smarthome/subscription","commits_url":"https://api.github.com/repos/MusalaSoft/smarthome/commits{/sha}","git_commits_url":"https://api.github.com/repos/MusalaSoft/smarthome/git/commits{/sha}","comments_url":"https://api.github.com/repos/MusalaSoft/smarthome/comments{/number}","issue_comment_url":"https://api.github.com/repos/MusalaSoft/smarthome/issues/comments{/number}","contents_url":"https://api.github.com/repos/MusalaSoft/smarthome/contents/{+path}","compare_url":"https://api.github.com/repos/MusalaSoft/smarthome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MusalaSoft/smarthome/merges","archive_url":"https://api.github.com/repos/MusalaSoft/smarthome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MusalaSoft/smarthome/downloads","issues_url":"https://api.github.com/repos/MusalaSoft/smarthome/issues{/number}","pulls_url":"https://api.github.com/repos/MusalaSoft/smarthome/pulls{/number}","milestones_url":"https://api.github.com/repos/MusalaSoft/smarthome/milestones{/number}","notifications_url":"https://api.github.com/repos/MusalaSoft/smarthome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MusalaSoft/smarthome/labels{/name}","releases_url":"https://api.github.com/repos/MusalaSoft/smarthome/releases{/id}","deployments_url":"https://api.github.com/repos/MusalaSoft/smarthome/deployments","created_at":"2016-07-15T12:50:09Z","updated_at":"2016-07-15T12:50:16Z","pushed_at":"2018-02-15T12:56:08Z","git_url":"git://github.com/MusalaSoft/smarthome.git","ssh_url":"git@github.com:MusalaSoft/smarthome.git","clone_url":"https://github.com/MusalaSoft/smarthome.git","svn_url":"https://github.com/MusalaSoft/smarthome","homepage":null,"size":38433,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"75ccd36cc041252556486c3194d409940ddce121","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":15778981,"name":"smarthome","full_name":"eclipse/smarthome","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/smarthome","description":"Eclipse SmartHome™ project","fork":false,"url":"https://api.github.com/repos/eclipse/smarthome","forks_url":"https://api.github.com/repos/eclipse/smarthome/forks","keys_url":"https://api.github.com/repos/eclipse/smarthome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/smarthome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/smarthome/teams","hooks_url":"https://api.github.com/repos/eclipse/smarthome/hooks","issue_events_url":"https://api.github.com/repos/eclipse/smarthome/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/smarthome/events","assignees_url":"https://api.github.com/repos/eclipse/smarthome/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/smarthome/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/smarthome/tags","blobs_url":"https://api.github.com/repos/eclipse/smarthome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/smarthome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/smarthome/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/smarthome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/smarthome/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/smarthome/languages","stargazers_url":"https://api.github.com/repos/eclipse/smarthome/stargazers","contributors_url":"https://api.github.com/repos/eclipse/smarthome/contributors","subscribers_url":"https://api.github.com/repos/eclipse/smarthome/subscribers","subscription_url":"https://api.github.com/repos/eclipse/smarthome/subscription","commits_url":"https://api.github.com/repos/eclipse/smarthome/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/smarthome/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/smarthome/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/smarthome/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/smarthome/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/smarthome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/smarthome/merges","archive_url":"https://api.github.com/repos/eclipse/smarthome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/smarthome/downloads","issues_url":"https://api.github.com/repos/eclipse/smarthome/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/smarthome/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/smarthome/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/smarthome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/smarthome/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/smarthome/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/smarthome/deployments","created_at":"2014-01-09T20:47:19Z","updated_at":"2018-02-13T15:55:36Z","pushed_at":"2018-02-15T13:29:47Z","git_url":"git://github.com/eclipse/smarthome.git","ssh_url":"git@github.com:eclipse/smarthome.git","clone_url":"https://github.com/eclipse/smarthome.git","svn_url":"https://github.com/eclipse/smarthome","homepage":"https://www.eclipse.org/smarthome/","size":49146,"stargazers_count":642,"watchers_count":642,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":631,"mirror_url":null,"archived":false,"open_issues_count":399,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":631,"open_issues":399,"watchers":642,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/4882"},"html":{"href":"https://github.com/eclipse/smarthome/pull/4882"},"issue":{"href":"https://api.github.com/repos/eclipse/smarthome/issues/4882"},"comments":{"href":"https://api.github.com/repos/eclipse/smarthome/issues/4882/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/4882/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/4882/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/smarthome/statuses/559aacd3c4d5d97a310dcc29c4691a44171c2300"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kaikreuzer"}}