{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/leshan/pulls/comments/146212696","pull_request_review_id":71120701,"id":146212696,"diff_hunk":"@@ -326,9 +326,30 @@ public synchronized DiscoverResponse discover(ServerIdentity identity, DiscoverR\n \n     @Override\n     public synchronized ObserveResponse observe(ServerIdentity identity, ObserveRequest request) {\n-        ReadResponse readResponse = this.read(identity, new ReadRequest(request.getPath().toString()));\n-        return new ObserveResponse(readResponse.getCode(), readResponse.getContent(), null, null,\n-                readResponse.getErrorMessage());\n+        LwM2mPath path = request.getPath();\n+\n+        // observe is not supported for bootstrap\n+        if (identity.isLwm2mBootstrapServer())\n+            return ObserveResponse.methodNotAllowed();\n+\n+        if (!identity.isSystem()) {\n+            // observe or read of the security object is forbidden\n+            if (id == LwM2mId.SECURITY)\n+                return ObserveResponse.notFound();\n+\n+            // check if the resource is readable.\n+            if (path.isResource()) {\n+                ResourceModel resourceModel = objectModel.resources.get(path.getResourceId());\n+                if (resourceModel != null && !resourceModel.operations.isReadable())\n+                    return ObserveResponse.methodNotAllowed();\n+            }\n+        }\n+        return doObserve(identity, request);\n+    }\n+\n+    protected ObserveResponse doObserve(ServerIdentity identity, ObserveRequest request) {\n+        // This should be a not implemented error, but this is not defined in the spec.\n+        return ObserveResponse.internalServerError(\"not implemented\");","path":"leshan-client-core/src/main/java/org/eclipse/leshan/client/resource/BaseObjectEnabler.java","position":30,"original_position":30,"commit_id":"f6707ca2ba2c5c65816c9594f581f0bc97189a32","original_commit_id":"f6707ca2ba2c5c65816c9594f581f0bc97189a32","user":{"login":"danielhqv","id":32630811,"avatar_url":"https://avatars1.githubusercontent.com/u/32630811?v=4","gravatar_id":"","url":"https://api.github.com/users/danielhqv","html_url":"https://github.com/danielhqv","followers_url":"https://api.github.com/users/danielhqv/followers","following_url":"https://api.github.com/users/danielhqv/following{/other_user}","gists_url":"https://api.github.com/users/danielhqv/gists{/gist_id}","starred_url":"https://api.github.com/users/danielhqv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielhqv/subscriptions","organizations_url":"https://api.github.com/users/danielhqv/orgs","repos_url":"https://api.github.com/users/danielhqv/repos","events_url":"https://api.github.com/users/danielhqv/events{/privacy}","received_events_url":"https://api.github.com/users/danielhqv/received_events","type":"User","site_admin":false},"body":"OK, I've replaced the default behavior with your suggestion","created_at":"2017-10-23T09:36:43Z","updated_at":"2017-10-23T09:36:43Z","html_url":"https://github.com/eclipse/leshan/pull/406#discussion_r146212696","pull_request_url":"https://api.github.com/repos/eclipse/leshan/pulls/406","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/eclipse/leshan/pulls/comments/146212696"},"html":{"href":"https://github.com/eclipse/leshan/pull/406#discussion_r146212696"},"pull_request":{"href":"https://api.github.com/repos/eclipse/leshan/pulls/406"}},"in_reply_to_id":145999504},"pull_request":{"url":"https://api.github.com/repos/eclipse/leshan/pulls/406","id":147772730,"html_url":"https://github.com/eclipse/leshan/pull/406","diff_url":"https://github.com/eclipse/leshan/pull/406.diff","patch_url":"https://github.com/eclipse/leshan/pull/406.patch","issue_url":"https://api.github.com/repos/eclipse/leshan/issues/406","number":406,"state":"open","locked":false,"title":"Observe support in object and instance enablers","user":{"login":"bolddp","id":5508714,"avatar_url":"https://avatars3.githubusercontent.com/u/5508714?v=4","gravatar_id":"","url":"https://api.github.com/users/bolddp","html_url":"https://github.com/bolddp","followers_url":"https://api.github.com/users/bolddp/followers","following_url":"https://api.github.com/users/bolddp/following{/other_user}","gists_url":"https://api.github.com/users/bolddp/gists{/gist_id}","starred_url":"https://api.github.com/users/bolddp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bolddp/subscriptions","organizations_url":"https://api.github.com/users/bolddp/orgs","repos_url":"https://api.github.com/users/bolddp/repos","events_url":"https://api.github.com/users/bolddp/events{/privacy}","received_events_url":"https://api.github.com/users/bolddp/received_events","type":"User","site_admin":false},"body":"These changes add an observe method to the LwM2mInstanceEnabler interface, and default behavior to the base classes that implement it.\r\n\r\nSigned-off-by: Daniel Persson <daniel.p.persson@husqvarnagroup.com>","created_at":"2017-10-20T10:55:49Z","updated_at":"2017-10-23T09:36:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b8d307bc34a6bfdc64eb55aa52f806f3833001c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/leshan/pulls/406/commits","review_comments_url":"https://api.github.com/repos/eclipse/leshan/pulls/406/comments","review_comment_url":"https://api.github.com/repos/eclipse/leshan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/leshan/issues/406/comments","statuses_url":"https://api.github.com/repos/eclipse/leshan/statuses/f6707ca2ba2c5c65816c9594f581f0bc97189a32","head":{"label":"husqvarnagroup:client_observe_support","ref":"client_observe_support","sha":"f6707ca2ba2c5c65816c9594f581f0bc97189a32","user":{"login":"husqvarnagroup","id":17142631,"avatar_url":"https://avatars3.githubusercontent.com/u/17142631?v=4","gravatar_id":"","url":"https://api.github.com/users/husqvarnagroup","html_url":"https://github.com/husqvarnagroup","followers_url":"https://api.github.com/users/husqvarnagroup/followers","following_url":"https://api.github.com/users/husqvarnagroup/following{/other_user}","gists_url":"https://api.github.com/users/husqvarnagroup/gists{/gist_id}","starred_url":"https://api.github.com/users/husqvarnagroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/husqvarnagroup/subscriptions","organizations_url":"https://api.github.com/users/husqvarnagroup/orgs","repos_url":"https://api.github.com/users/husqvarnagroup/repos","events_url":"https://api.github.com/users/husqvarnagroup/events{/privacy}","received_events_url":"https://api.github.com/users/husqvarnagroup/received_events","type":"Organization","site_admin":false},"repo":{"id":106245751,"name":"leshan","full_name":"husqvarnagroup/leshan","owner":{"login":"husqvarnagroup","id":17142631,"avatar_url":"https://avatars3.githubusercontent.com/u/17142631?v=4","gravatar_id":"","url":"https://api.github.com/users/husqvarnagroup","html_url":"https://github.com/husqvarnagroup","followers_url":"https://api.github.com/users/husqvarnagroup/followers","following_url":"https://api.github.com/users/husqvarnagroup/following{/other_user}","gists_url":"https://api.github.com/users/husqvarnagroup/gists{/gist_id}","starred_url":"https://api.github.com/users/husqvarnagroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/husqvarnagroup/subscriptions","organizations_url":"https://api.github.com/users/husqvarnagroup/orgs","repos_url":"https://api.github.com/users/husqvarnagroup/repos","events_url":"https://api.github.com/users/husqvarnagroup/events{/privacy}","received_events_url":"https://api.github.com/users/husqvarnagroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/husqvarnagroup/leshan","description":"Eclipse Leshan is an OMA Lightweight M2M (LWM2M) implementation in Java.","fork":true,"url":"https://api.github.com/repos/husqvarnagroup/leshan","forks_url":"https://api.github.com/repos/husqvarnagroup/leshan/forks","keys_url":"https://api.github.com/repos/husqvarnagroup/leshan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/husqvarnagroup/leshan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/husqvarnagroup/leshan/teams","hooks_url":"https://api.github.com/repos/husqvarnagroup/leshan/hooks","issue_events_url":"https://api.github.com/repos/husqvarnagroup/leshan/issues/events{/number}","events_url":"https://api.github.com/repos/husqvarnagroup/leshan/events","assignees_url":"https://api.github.com/repos/husqvarnagroup/leshan/assignees{/user}","branches_url":"https://api.github.com/repos/husqvarnagroup/leshan/branches{/branch}","tags_url":"https://api.github.com/repos/husqvarnagroup/leshan/tags","blobs_url":"https://api.github.com/repos/husqvarnagroup/leshan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/husqvarnagroup/leshan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/husqvarnagroup/leshan/git/refs{/sha}","trees_url":"https://api.github.com/repos/husqvarnagroup/leshan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/husqvarnagroup/leshan/statuses/{sha}","languages_url":"https://api.github.com/repos/husqvarnagroup/leshan/languages","stargazers_url":"https://api.github.com/repos/husqvarnagroup/leshan/stargazers","contributors_url":"https://api.github.com/repos/husqvarnagroup/leshan/contributors","subscribers_url":"https://api.github.com/repos/husqvarnagroup/leshan/subscribers","subscription_url":"https://api.github.com/repos/husqvarnagroup/leshan/subscription","commits_url":"https://api.github.com/repos/husqvarnagroup/leshan/commits{/sha}","git_commits_url":"https://api.github.com/repos/husqvarnagroup/leshan/git/commits{/sha}","comments_url":"https://api.github.com/repos/husqvarnagroup/leshan/comments{/number}","issue_comment_url":"https://api.github.com/repos/husqvarnagroup/leshan/issues/comments{/number}","contents_url":"https://api.github.com/repos/husqvarnagroup/leshan/contents/{+path}","compare_url":"https://api.github.com/repos/husqvarnagroup/leshan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/husqvarnagroup/leshan/merges","archive_url":"https://api.github.com/repos/husqvarnagroup/leshan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/husqvarnagroup/leshan/downloads","issues_url":"https://api.github.com/repos/husqvarnagroup/leshan/issues{/number}","pulls_url":"https://api.github.com/repos/husqvarnagroup/leshan/pulls{/number}","milestones_url":"https://api.github.com/repos/husqvarnagroup/leshan/milestones{/number}","notifications_url":"https://api.github.com/repos/husqvarnagroup/leshan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/husqvarnagroup/leshan/labels{/name}","releases_url":"https://api.github.com/repos/husqvarnagroup/leshan/releases{/id}","deployments_url":"https://api.github.com/repos/husqvarnagroup/leshan/deployments","created_at":"2017-10-09T06:41:17Z","updated_at":"2017-10-09T06:41:21Z","pushed_at":"2017-10-23T09:23:28Z","git_url":"git://github.com/husqvarnagroup/leshan.git","ssh_url":"git@github.com:husqvarnagroup/leshan.git","clone_url":"https://github.com/husqvarnagroup/leshan.git","svn_url":"https://github.com/husqvarnagroup/leshan","homepage":"","size":3532,"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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"08594abee7415108f55a028c1ae88ae01a55c764","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":30419413,"name":"leshan","full_name":"eclipse/leshan","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/leshan","description":"Eclipse Leshan is an OMA Lightweight M2M (LWM2M) implementation in Java.","fork":false,"url":"https://api.github.com/repos/eclipse/leshan","forks_url":"https://api.github.com/repos/eclipse/leshan/forks","keys_url":"https://api.github.com/repos/eclipse/leshan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/leshan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/leshan/teams","hooks_url":"https://api.github.com/repos/eclipse/leshan/hooks","issue_events_url":"https://api.github.com/repos/eclipse/leshan/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/leshan/events","assignees_url":"https://api.github.com/repos/eclipse/leshan/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/leshan/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/leshan/tags","blobs_url":"https://api.github.com/repos/eclipse/leshan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/leshan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/leshan/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/leshan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/leshan/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/leshan/languages","stargazers_url":"https://api.github.com/repos/eclipse/leshan/stargazers","contributors_url":"https://api.github.com/repos/eclipse/leshan/contributors","subscribers_url":"https://api.github.com/repos/eclipse/leshan/subscribers","subscription_url":"https://api.github.com/repos/eclipse/leshan/subscription","commits_url":"https://api.github.com/repos/eclipse/leshan/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/leshan/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/leshan/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/leshan/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/leshan/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/leshan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/leshan/merges","archive_url":"https://api.github.com/repos/eclipse/leshan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/leshan/downloads","issues_url":"https://api.github.com/repos/eclipse/leshan/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/leshan/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/leshan/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/leshan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/leshan/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/leshan/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/leshan/deployments","created_at":"2015-02-06T15:44:24Z","updated_at":"2017-10-22T19:50:14Z","pushed_at":"2017-10-23T09:23:30Z","git_url":"git://github.com/eclipse/leshan.git","ssh_url":"git@github.com:eclipse/leshan.git","clone_url":"https://github.com/eclipse/leshan.git","svn_url":"https://github.com/eclipse/leshan","homepage":"","size":3504,"stargazers_count":165,"watchers_count":165,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":143,"mirror_url":null,"archived":false,"open_issues_count":36,"forks":143,"open_issues":36,"watchers":165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/leshan/pulls/406"},"html":{"href":"https://github.com/eclipse/leshan/pull/406"},"issue":{"href":"https://api.github.com/repos/eclipse/leshan/issues/406"},"comments":{"href":"https://api.github.com/repos/eclipse/leshan/issues/406/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/leshan/pulls/406/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/leshan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/leshan/pulls/406/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/leshan/statuses/f6707ca2ba2c5c65816c9594f581f0bc97189a32"}},"author_association":"NONE"}}
{"actor":{"display_login":"danielhqv"}}