{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/kura/pulls/comments/89530889","pull_request_review_id":10076630,"id":89530889,"diff_hunk":"@@ -121,110 +118,115 @@ public DataOutputStream openDataOutputStream() throws IOException {\n \n     @Override\n     public synchronized OutputStream openOutputStream() throws IOException {\n-        if (this.m_outputStream == null) {\n-            this.m_outputStream = this.m_serialPort.getOutputStream();\n+        if (this.outputStream == null) {\n+            this.outputStream = this.serialPort.getOutputStream();\n         }\n-        return this.m_outputStream;\n+        return this.outputStream;\n     }\n \n     @Override\n     public synchronized void close() throws IOException {\n-        if (this.m_serialPort != null) {\n-            this.m_serialPort.notifyOnDataAvailable(false);\n-            this.m_serialPort.removeEventListener();\n-            if (this.m_inputStream != null) {\n-                this.m_inputStream.close();\n-                this.m_inputStream = null;\n+        if (this.serialPort != null) {\n+            this.serialPort.notifyOnDataAvailable(false);\n+            this.serialPort.removeEventListener();\n+            if (this.inputStream != null) {\n+                this.inputStream.close();\n+                this.inputStream = null;\n             }\n-            if (this.m_outputStream != null) {\n-                this.m_outputStream.close();\n-                this.m_outputStream = null;\n+            if (this.outputStream != null) {\n+                this.outputStream.close();\n+                this.outputStream = null;\n             }\n \n-            this.m_serialPort.close();\n-            this.m_serialPort = null;\n+            this.serialPort.close();\n+            this.serialPort = null;\n         }\n     }\n \n     @Override\n     public synchronized void sendMessage(byte[] message) throws KuraException, IOException {\n-        if (message != null) {\n-            s_logger.debug(\"sendMessage() - {}\", getBytesAsString(message));\n+        if (message == null) {\n+            throw new NullPointerException(\"Messahe must not be null\");\n+        }\n \n-            if (this.m_outputStream == null) {\n-                openOutputStream();\n-            }\n+        if (logger.isDebugEnabled()) {\n+            logger.debug(\"sendMessage() - {}\", getBytesAsString(message));\n+        }\n \n-            this.m_outputStream.write(message, 0, message.length);\n-            this.m_outputStream.flush();\n-        } else {\n-            throw new NullPointerException(\"Serial message is null\");\n+        if (this.outputStream == null) {\n+            openOutputStream();\n         }\n+\n+        this.outputStream.write(message, 0, message.length);\n+        this.outputStream.flush();\n     }\n \n     @Override\n     public synchronized byte[] sendCommand(byte[] command, int timeout) throws KuraException, IOException {\n-        if (command != null) {\n-            s_logger.debug(\"sendMessage() - {}\", getBytesAsString(command));\n+        if (command == null) {\n+            throw new NullPointerException(\"Serial command must not be null\");\n+        }\n \n-            if (this.m_outputStream == null) {\n-                openOutputStream();\n-            }\n-            if (this.m_inputStream == null) {\n-                openInputStream();\n-            }\n+        if (logger.isDebugEnabled()) {\n+            logger.debug(\"sendMessage() - {}\", getBytesAsString(command));\n+        }\n \n-            byte[] dataInBuffer = flushSerialBuffer();\n-            if (dataInBuffer != null && dataInBuffer.length > 0) {\n-                s_logger.warn(\"eating bytes in the serial buffer input stream before sending command: \"\n-                        + getBytesAsString(dataInBuffer));\n-            }\n-            this.m_outputStream.write(command, 0, command.length);\n-            this.m_outputStream.flush();\n-\n-            ByteBuffer buffer = getResponse(timeout);\n-            if (buffer != null) {\n-                byte[] response = new byte[buffer.limit()];\n-                buffer.get(response, 0, response.length);\n-                return response;\n-            } else {\n-                return null;\n-            }\n+        if (this.outputStream == null) {\n+            openOutputStream();\n+        }\n+        if (this.inputStream == null) {\n+            openInputStream();\n+        }\n+\n+        byte[] dataInBuffer = flushSerialBuffer();\n+        if (dataInBuffer != null && dataInBuffer.length > 0) {\n+            logger.warn(\"eating bytes in the serial buffer input stream before sending command: {}\",\n+                    getBytesAsString(dataInBuffer));\n+        }\n+        this.outputStream.write(command, 0, command.length);\n+        this.outputStream.flush();\n+\n+        ByteBuffer buffer = getResponse(timeout);\n+        if (buffer != null) {\n+            byte[] response = new byte[buffer.limit()];\n+            buffer.get(response, 0, response.length);\n+            return response;\n         } else {\n-            throw new NullPointerException(\"Serial command is null\");\n+            return null;\n         }\n     }\n \n     @Override\n     public synchronized byte[] sendCommand(byte[] command, int timeout, int demark) throws KuraException, IOException {\n-        if (command != null) {\n-            s_logger.debug(\"sendMessage() - {}\", getBytesAsString(command));\n \n-            if (this.m_outputStream == null) {\n-                openOutputStream();\n-            }\n-            if (this.m_inputStream == null) {\n-                openInputStream();\n-            }\n+        if (command == null) {\n+            throw new NullPointerException(\"Serial command must not be null\");","path":"kura/org.eclipse.kura.core.comm/src/main/java/org/eclipse/kura/core/comm/CommConnectionImpl.java","position":245,"original_position":277,"commit_id":"6ebc06e5273e399e6dd8804579567ee14f4f3231","original_commit_id":"e7cdbd14600f3f8cebcd73a1a0b0188331dd4931","user":{"login":"amitjoy","id":13380182,"avatar_url":"https://avatars.githubusercontent.com/u/13380182?v=3","gravatar_id":"","url":"https://api.github.com/users/amitjoy","html_url":"https://github.com/amitjoy","followers_url":"https://api.github.com/users/amitjoy/followers","following_url":"https://api.github.com/users/amitjoy/following{/other_user}","gists_url":"https://api.github.com/users/amitjoy/gists{/gist_id}","starred_url":"https://api.github.com/users/amitjoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitjoy/subscriptions","organizations_url":"https://api.github.com/users/amitjoy/orgs","repos_url":"https://api.github.com/users/amitjoy/repos","events_url":"https://api.github.com/users/amitjoy/events{/privacy}","received_events_url":"https://api.github.com/users/amitjoy/received_events","type":"User","site_admin":false},"body":"This was old comment about using NPE. I have commented it before we started using exceptions in a different way. Just ignore it 😄.","created_at":"2016-11-24T17:12:55Z","updated_at":"2016-11-24T17:12:55Z","html_url":"https://github.com/eclipse/kura/pull/711#discussion_r89530889","pull_request_url":"https://api.github.com/repos/eclipse/kura/pulls/711","_links":{"self":{"href":"https://api.github.com/repos/eclipse/kura/pulls/comments/89530889"},"html":{"href":"https://github.com/eclipse/kura/pull/711#discussion_r89530889"},"pull_request":{"href":"https://api.github.com/repos/eclipse/kura/pulls/711"}}},"pull_request":{"url":"https://api.github.com/repos/eclipse/kura/pulls/711","id":92020058,"html_url":"https://github.com/eclipse/kura/pull/711","diff_url":"https://github.com/eclipse/kura/pull/711.diff","patch_url":"https://github.com/eclipse/kura/pull/711.patch","issue_url":"https://api.github.com/repos/eclipse/kura/issues/711","number":711,"state":"open","locked":false,"title":"Cleanup and bug fixes on org.eclipse.kura.core.comm","user":{"login":"ctron","id":202474,"avatar_url":"https://avatars.githubusercontent.com/u/202474?v=3","gravatar_id":"","url":"https://api.github.com/users/ctron","html_url":"https://github.com/ctron","followers_url":"https://api.github.com/users/ctron/followers","following_url":"https://api.github.com/users/ctron/following{/other_user}","gists_url":"https://api.github.com/users/ctron/gists{/gist_id}","starred_url":"https://api.github.com/users/ctron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctron/subscriptions","organizations_url":"https://api.github.com/users/ctron/orgs","repos_url":"https://api.github.com/users/ctron/repos","events_url":"https://api.github.com/users/ctron/events{/privacy}","received_events_url":"https://api.github.com/users/ctron/received_events","type":"User","site_admin":false},"body":"This change cleans up a bunch of dead code and oddities. It also fixes\r\na bug on Windows, therefore the version uptick.\r\n\r\nChanges are:\r\n\r\n* Remove unnecessary code\r\n* Fix path separator (Windows bug)\r\n* Fix hex output\r\n* Only generate hex output when necessary\r\n* Let the connection implement Closable\r\n* Cleanup code style\r\n* Use same timeout calculation (long instead of Date) for both methods\r\n\r\nSigned-off-by: Jens Reimann <jreimann@redhat.com>","created_at":"2016-11-02T17:40:19Z","updated_at":"2016-11-24T17:12:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"280fe132916b63ff12eceee77685d8f98bd7be3d","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/eclipse/kura/milestones/4","html_url":"https://github.com/eclipse/kura/milestones/KURA-3.0.0","labels_url":"https://api.github.com/repos/eclipse/kura/milestones/4/labels","id":1992871,"number":4,"title":"KURA-3.0.0","description":"","creator":{"login":"cdealti","id":1225835,"avatar_url":"https://avatars.githubusercontent.com/u/1225835?v=3","gravatar_id":"","url":"https://api.github.com/users/cdealti","html_url":"https://github.com/cdealti","followers_url":"https://api.github.com/users/cdealti/followers","following_url":"https://api.github.com/users/cdealti/following{/other_user}","gists_url":"https://api.github.com/users/cdealti/gists{/gist_id}","starred_url":"https://api.github.com/users/cdealti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdealti/subscriptions","organizations_url":"https://api.github.com/users/cdealti/orgs","repos_url":"https://api.github.com/users/cdealti/repos","events_url":"https://api.github.com/users/cdealti/events{/privacy}","received_events_url":"https://api.github.com/users/cdealti/received_events","type":"User","site_admin":false},"open_issues":86,"closed_issues":36,"state":"open","created_at":"2016-09-09T08:31:39Z","updated_at":"2016-11-24T17:03:21Z","due_on":"2016-12-31T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/eclipse/kura/pulls/711/commits","review_comments_url":"https://api.github.com/repos/eclipse/kura/pulls/711/comments","review_comment_url":"https://api.github.com/repos/eclipse/kura/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/kura/issues/711/comments","statuses_url":"https://api.github.com/repos/eclipse/kura/statuses/6ebc06e5273e399e6dd8804579567ee14f4f3231","head":{"label":"ctron:feature/cleanup_comm_1","ref":"feature/cleanup_comm_1","sha":"6ebc06e5273e399e6dd8804579567ee14f4f3231","user":{"login":"ctron","id":202474,"avatar_url":"https://avatars.githubusercontent.com/u/202474?v=3","gravatar_id":"","url":"https://api.github.com/users/ctron","html_url":"https://github.com/ctron","followers_url":"https://api.github.com/users/ctron/followers","following_url":"https://api.github.com/users/ctron/following{/other_user}","gists_url":"https://api.github.com/users/ctron/gists{/gist_id}","starred_url":"https://api.github.com/users/ctron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctron/subscriptions","organizations_url":"https://api.github.com/users/ctron/orgs","repos_url":"https://api.github.com/users/ctron/repos","events_url":"https://api.github.com/users/ctron/events{/privacy}","received_events_url":"https://api.github.com/users/ctron/received_events","type":"User","site_admin":false},"repo":{"id":63234215,"name":"kura","full_name":"ctron/kura","owner":{"login":"ctron","id":202474,"avatar_url":"https://avatars.githubusercontent.com/u/202474?v=3","gravatar_id":"","url":"https://api.github.com/users/ctron","html_url":"https://github.com/ctron","followers_url":"https://api.github.com/users/ctron/followers","following_url":"https://api.github.com/users/ctron/following{/other_user}","gists_url":"https://api.github.com/users/ctron/gists{/gist_id}","starred_url":"https://api.github.com/users/ctron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctron/subscriptions","organizations_url":"https://api.github.com/users/ctron/orgs","repos_url":"https://api.github.com/users/ctron/repos","events_url":"https://api.github.com/users/ctron/events{/privacy}","received_events_url":"https://api.github.com/users/ctron/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ctron/kura","description":"Eclipse Kura™ project - Forked","fork":true,"url":"https://api.github.com/repos/ctron/kura","forks_url":"https://api.github.com/repos/ctron/kura/forks","keys_url":"https://api.github.com/repos/ctron/kura/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctron/kura/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctron/kura/teams","hooks_url":"https://api.github.com/repos/ctron/kura/hooks","issue_events_url":"https://api.github.com/repos/ctron/kura/issues/events{/number}","events_url":"https://api.github.com/repos/ctron/kura/events","assignees_url":"https://api.github.com/repos/ctron/kura/assignees{/user}","branches_url":"https://api.github.com/repos/ctron/kura/branches{/branch}","tags_url":"https://api.github.com/repos/ctron/kura/tags","blobs_url":"https://api.github.com/repos/ctron/kura/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctron/kura/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctron/kura/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctron/kura/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctron/kura/statuses/{sha}","languages_url":"https://api.github.com/repos/ctron/kura/languages","stargazers_url":"https://api.github.com/repos/ctron/kura/stargazers","contributors_url":"https://api.github.com/repos/ctron/kura/contributors","subscribers_url":"https://api.github.com/repos/ctron/kura/subscribers","subscription_url":"https://api.github.com/repos/ctron/kura/subscription","commits_url":"https://api.github.com/repos/ctron/kura/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctron/kura/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctron/kura/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctron/kura/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctron/kura/contents/{+path}","compare_url":"https://api.github.com/repos/ctron/kura/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctron/kura/merges","archive_url":"https://api.github.com/repos/ctron/kura/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctron/kura/downloads","issues_url":"https://api.github.com/repos/ctron/kura/issues{/number}","pulls_url":"https://api.github.com/repos/ctron/kura/pulls{/number}","milestones_url":"https://api.github.com/repos/ctron/kura/milestones{/number}","notifications_url":"https://api.github.com/repos/ctron/kura/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctron/kura/labels{/name}","releases_url":"https://api.github.com/repos/ctron/kura/releases{/id}","deployments_url":"https://api.github.com/repos/ctron/kura/deployments","created_at":"2016-07-13T09:42:42Z","updated_at":"2016-10-31T11:03:16Z","pushed_at":"2016-11-24T15:11:20Z","git_url":"git://github.com/ctron/kura.git","ssh_url":"git@github.com:ctron/kura.git","clone_url":"https://github.com/ctron/kura.git","svn_url":"https://github.com/ctron/kura","homepage":"https://eclipse.org/kura","size":92851,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"eclipse:develop","ref":"develop","sha":"28068db6c7a1f5d504691258e48c4730e6cb2b1c","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","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":15237269,"name":"kura","full_name":"eclipse/kura","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","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/kura","description":"Eclipse Kura™ project - http://eclipse.org/kura","fork":false,"url":"https://api.github.com/repos/eclipse/kura","forks_url":"https://api.github.com/repos/eclipse/kura/forks","keys_url":"https://api.github.com/repos/eclipse/kura/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/kura/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/kura/teams","hooks_url":"https://api.github.com/repos/eclipse/kura/hooks","issue_events_url":"https://api.github.com/repos/eclipse/kura/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/kura/events","assignees_url":"https://api.github.com/repos/eclipse/kura/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/kura/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/kura/tags","blobs_url":"https://api.github.com/repos/eclipse/kura/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/kura/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/kura/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/kura/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/kura/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/kura/languages","stargazers_url":"https://api.github.com/repos/eclipse/kura/stargazers","contributors_url":"https://api.github.com/repos/eclipse/kura/contributors","subscribers_url":"https://api.github.com/repos/eclipse/kura/subscribers","subscription_url":"https://api.github.com/repos/eclipse/kura/subscription","commits_url":"https://api.github.com/repos/eclipse/kura/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/kura/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/kura/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/kura/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/kura/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/kura/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/kura/merges","archive_url":"https://api.github.com/repos/eclipse/kura/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/kura/downloads","issues_url":"https://api.github.com/repos/eclipse/kura/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/kura/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/kura/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/kura/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/kura/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/kura/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/kura/deployments","created_at":"2013-12-16T21:07:20Z","updated_at":"2016-11-22T10:06:04Z","pushed_at":"2016-11-24T15:57:06Z","git_url":"git://github.com/eclipse/kura.git","ssh_url":"git@github.com:eclipse/kura.git","clone_url":"https://github.com/eclipse/kura.git","svn_url":"https://github.com/eclipse/kura","homepage":"","size":106078,"stargazers_count":120,"watchers_count":120,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":104,"mirror_url":null,"open_issues_count":190,"forks":104,"open_issues":190,"watchers":120,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/kura/pulls/711"},"html":{"href":"https://github.com/eclipse/kura/pull/711"},"issue":{"href":"https://api.github.com/repos/eclipse/kura/issues/711"},"comments":{"href":"https://api.github.com/repos/eclipse/kura/issues/711/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/kura/pulls/711/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/kura/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/kura/pulls/711/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/kura/statuses/6ebc06e5273e399e6dd8804579567ee14f4f3231"}}}}
{"actor":{"display_login":"amitjoy"}}