{"action":"created","comment":{"url":"https://api.github.com/repos/zdtorok/inetsense/pulls/comments/61746320","id":61746320,"diff_hunk":"@@ -15,87 +8,117 @@\n import com.github.fge.jsonschema.core.report.ProcessingReport;\n import com.github.fge.jsonschema.main.JsonSchema;\n import com.github.fge.jsonschema.main.JsonSchemaFactory;\n-\n import hu.elte.inetsense.common.dtos.ProbeDataDTO;\n+import hu.elte.inetsense.server.collector.util.JsonValidationException;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.stereotype.Component;\n+\n+import java.io.File;\n+import java.io.IOException;\n+import java.nio.charset.StandardCharsets;\n+import java.nio.file.Files;\n+import java.nio.file.Paths;\n \n /**\n- * Service for the Standardized Interface: validation of incoming JSON data against existing JSON schema\n- *\n+ * Service for the Standardized Interface: validation of incoming JSON data against existing JSON schema.\n+ * <p>\n  * Created by balintkiss on 3/22/16.\n  */\n @Component\n public class JsonValidator {\n \n-    private final Logger log           = LoggerFactory.getLogger(this.getClass());\n-    private final String schemaFileStr = \"/probe-validation.schema.json\";\n+    private final Logger log = LoggerFactory.getLogger(JsonValidator.class);\n+    private final String schemaFileStr = \"src/main/resources/probe-validation.schema.json\";\n \n-    private String       schemaStr     = \"\";\n+    private String schemaStr = \"\";\n     private ObjectMapper mapper;\n-    private JsonSchema   jsonSchema;\n+    private JsonSchema jsonSchema;\n \n     /**\n-     * TODO: Ugly, undocumented, but works\n-     * Also, I don't like returning null object, but I was in a hurry.\n+     * Initialize validator service.\n      */\n-    public JsonValidator() {\n-        try (Scanner sc = new Scanner(getClass().getResourceAsStream(schemaFileStr), \"UTF-8\").useDelimiter(\"\\\\A\")) {","path":"inetsense/inetsense-server/inetsense-server-collector/src/main/java/hu/elte/inetsense/server/collector/service/JsonValidator.java","position":57,"original_position":57,"commit_id":"05f6a704faa96c75f556798abc1e1ff2b7494474","original_commit_id":"05f6a704faa96c75f556798abc1e1ff2b7494474","user":{"login":"hungariandude","id":1880793,"avatar_url":"https://avatars.githubusercontent.com/u/1880793?v=3","gravatar_id":"","url":"https://api.github.com/users/hungariandude","html_url":"https://github.com/hungariandude","followers_url":"https://api.github.com/users/hungariandude/followers","following_url":"https://api.github.com/users/hungariandude/following{/other_user}","gists_url":"https://api.github.com/users/hungariandude/gists{/gist_id}","starred_url":"https://api.github.com/users/hungariandude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hungariandude/subscriptions","organizations_url":"https://api.github.com/users/hungariandude/orgs","repos_url":"https://api.github.com/users/hungariandude/repos","events_url":"https://api.github.com/users/hungariandude/events{/privacy}","received_events_url":"https://api.github.com/users/hungariandude/received_events","type":"User","site_admin":false},"body":"Please use this method for accessing the JSON validation schema resource.","created_at":"2016-05-02T14:35:28Z","updated_at":"2016-05-02T14:35:28Z","html_url":"https://github.com/zdtorok/inetsense/pull/32#discussion_r61746320","pull_request_url":"https://api.github.com/repos/zdtorok/inetsense/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/zdtorok/inetsense/pulls/comments/61746320"},"html":{"href":"https://github.com/zdtorok/inetsense/pull/32#discussion_r61746320"},"pull_request":{"href":"https://api.github.com/repos/zdtorok/inetsense/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/zdtorok/inetsense/pulls/32","id":68567384,"html_url":"https://github.com/zdtorok/inetsense/pull/32","diff_url":"https://github.com/zdtorok/inetsense/pull/32.diff","patch_url":"https://github.com/zdtorok/inetsense/pull/32.patch","issue_url":"https://api.github.com/repos/zdtorok/inetsense/issues/32","number":32,"state":"open","locked":false,"title":"Ins 06","user":{"login":"balintkiss501","id":11887307,"avatar_url":"https://avatars.githubusercontent.com/u/11887307?v=3","gravatar_id":"","url":"https://api.github.com/users/balintkiss501","html_url":"https://github.com/balintkiss501","followers_url":"https://api.github.com/users/balintkiss501/followers","following_url":"https://api.github.com/users/balintkiss501/following{/other_user}","gists_url":"https://api.github.com/users/balintkiss501/gists{/gist_id}","starred_url":"https://api.github.com/users/balintkiss501/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balintkiss501/subscriptions","organizations_url":"https://api.github.com/users/balintkiss501/orgs","repos_url":"https://api.github.com/users/balintkiss501/repos","events_url":"https://api.github.com/users/balintkiss501/events{/privacy}","received_events_url":"https://api.github.com/users/balintkiss501/received_events","type":"User","site_admin":false},"body":"Refactored for new directory structure, fixed error/success logging, added exception handling instead of null return.","created_at":"2016-05-02T14:29:09Z","updated_at":"2016-05-02T14:35:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6704eb75e6da7ab4a6a8db50051a1af752d44bde","assignee":{"login":"hungariandude","id":1880793,"avatar_url":"https://avatars.githubusercontent.com/u/1880793?v=3","gravatar_id":"","url":"https://api.github.com/users/hungariandude","html_url":"https://github.com/hungariandude","followers_url":"https://api.github.com/users/hungariandude/followers","following_url":"https://api.github.com/users/hungariandude/following{/other_user}","gists_url":"https://api.github.com/users/hungariandude/gists{/gist_id}","starred_url":"https://api.github.com/users/hungariandude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hungariandude/subscriptions","organizations_url":"https://api.github.com/users/hungariandude/orgs","repos_url":"https://api.github.com/users/hungariandude/repos","events_url":"https://api.github.com/users/hungariandude/events{/privacy}","received_events_url":"https://api.github.com/users/hungariandude/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/zdtorok/inetsense/pulls/32/commits","review_comments_url":"https://api.github.com/repos/zdtorok/inetsense/pulls/32/comments","review_comment_url":"https://api.github.com/repos/zdtorok/inetsense/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zdtorok/inetsense/issues/32/comments","statuses_url":"https://api.github.com/repos/zdtorok/inetsense/statuses/05f6a704faa96c75f556798abc1e1ff2b7494474","head":{"label":"zdtorok:INS-06","ref":"INS-06","sha":"05f6a704faa96c75f556798abc1e1ff2b7494474","user":{"login":"zdtorok","id":6683644,"avatar_url":"https://avatars.githubusercontent.com/u/6683644?v=3","gravatar_id":"","url":"https://api.github.com/users/zdtorok","html_url":"https://github.com/zdtorok","followers_url":"https://api.github.com/users/zdtorok/followers","following_url":"https://api.github.com/users/zdtorok/following{/other_user}","gists_url":"https://api.github.com/users/zdtorok/gists{/gist_id}","starred_url":"https://api.github.com/users/zdtorok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdtorok/subscriptions","organizations_url":"https://api.github.com/users/zdtorok/orgs","repos_url":"https://api.github.com/users/zdtorok/repos","events_url":"https://api.github.com/users/zdtorok/events{/privacy}","received_events_url":"https://api.github.com/users/zdtorok/received_events","type":"User","site_admin":false},"repo":{"id":52457506,"name":"inetsense","full_name":"zdtorok/inetsense","owner":{"login":"zdtorok","id":6683644,"avatar_url":"https://avatars.githubusercontent.com/u/6683644?v=3","gravatar_id":"","url":"https://api.github.com/users/zdtorok","html_url":"https://github.com/zdtorok","followers_url":"https://api.github.com/users/zdtorok/followers","following_url":"https://api.github.com/users/zdtorok/following{/other_user}","gists_url":"https://api.github.com/users/zdtorok/gists{/gist_id}","starred_url":"https://api.github.com/users/zdtorok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdtorok/subscriptions","organizations_url":"https://api.github.com/users/zdtorok/orgs","repos_url":"https://api.github.com/users/zdtorok/repos","events_url":"https://api.github.com/users/zdtorok/events{/privacy}","received_events_url":"https://api.github.com/users/zdtorok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zdtorok/inetsense","description":"iNETSense","fork":false,"url":"https://api.github.com/repos/zdtorok/inetsense","forks_url":"https://api.github.com/repos/zdtorok/inetsense/forks","keys_url":"https://api.github.com/repos/zdtorok/inetsense/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zdtorok/inetsense/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zdtorok/inetsense/teams","hooks_url":"https://api.github.com/repos/zdtorok/inetsense/hooks","issue_events_url":"https://api.github.com/repos/zdtorok/inetsense/issues/events{/number}","events_url":"https://api.github.com/repos/zdtorok/inetsense/events","assignees_url":"https://api.github.com/repos/zdtorok/inetsense/assignees{/user}","branches_url":"https://api.github.com/repos/zdtorok/inetsense/branches{/branch}","tags_url":"https://api.github.com/repos/zdtorok/inetsense/tags","blobs_url":"https://api.github.com/repos/zdtorok/inetsense/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zdtorok/inetsense/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zdtorok/inetsense/git/refs{/sha}","trees_url":"https://api.github.com/repos/zdtorok/inetsense/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zdtorok/inetsense/statuses/{sha}","languages_url":"https://api.github.com/repos/zdtorok/inetsense/languages","stargazers_url":"https://api.github.com/repos/zdtorok/inetsense/stargazers","contributors_url":"https://api.github.com/repos/zdtorok/inetsense/contributors","subscribers_url":"https://api.github.com/repos/zdtorok/inetsense/subscribers","subscription_url":"https://api.github.com/repos/zdtorok/inetsense/subscription","commits_url":"https://api.github.com/repos/zdtorok/inetsense/commits{/sha}","git_commits_url":"https://api.github.com/repos/zdtorok/inetsense/git/commits{/sha}","comments_url":"https://api.github.com/repos/zdtorok/inetsense/comments{/number}","issue_comment_url":"https://api.github.com/repos/zdtorok/inetsense/issues/comments{/number}","contents_url":"https://api.github.com/repos/zdtorok/inetsense/contents/{+path}","compare_url":"https://api.github.com/repos/zdtorok/inetsense/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zdtorok/inetsense/merges","archive_url":"https://api.github.com/repos/zdtorok/inetsense/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zdtorok/inetsense/downloads","issues_url":"https://api.github.com/repos/zdtorok/inetsense/issues{/number}","pulls_url":"https://api.github.com/repos/zdtorok/inetsense/pulls{/number}","milestones_url":"https://api.github.com/repos/zdtorok/inetsense/milestones{/number}","notifications_url":"https://api.github.com/repos/zdtorok/inetsense/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zdtorok/inetsense/labels{/name}","releases_url":"https://api.github.com/repos/zdtorok/inetsense/releases{/id}","deployments_url":"https://api.github.com/repos/zdtorok/inetsense/deployments","created_at":"2016-02-24T16:35:53Z","updated_at":"2016-03-02T16:15:06Z","pushed_at":"2016-05-02T14:29:09Z","git_url":"git://github.com/zdtorok/inetsense.git","ssh_url":"git@github.com:zdtorok/inetsense.git","clone_url":"https://github.com/zdtorok/inetsense.git","svn_url":"https://github.com/zdtorok/inetsense","homepage":null,"size":2687,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"zdtorok:develop","ref":"develop","sha":"36c54613e0837976da958ecd89923e9cc9d29a36","user":{"login":"zdtorok","id":6683644,"avatar_url":"https://avatars.githubusercontent.com/u/6683644?v=3","gravatar_id":"","url":"https://api.github.com/users/zdtorok","html_url":"https://github.com/zdtorok","followers_url":"https://api.github.com/users/zdtorok/followers","following_url":"https://api.github.com/users/zdtorok/following{/other_user}","gists_url":"https://api.github.com/users/zdtorok/gists{/gist_id}","starred_url":"https://api.github.com/users/zdtorok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdtorok/subscriptions","organizations_url":"https://api.github.com/users/zdtorok/orgs","repos_url":"https://api.github.com/users/zdtorok/repos","events_url":"https://api.github.com/users/zdtorok/events{/privacy}","received_events_url":"https://api.github.com/users/zdtorok/received_events","type":"User","site_admin":false},"repo":{"id":52457506,"name":"inetsense","full_name":"zdtorok/inetsense","owner":{"login":"zdtorok","id":6683644,"avatar_url":"https://avatars.githubusercontent.com/u/6683644?v=3","gravatar_id":"","url":"https://api.github.com/users/zdtorok","html_url":"https://github.com/zdtorok","followers_url":"https://api.github.com/users/zdtorok/followers","following_url":"https://api.github.com/users/zdtorok/following{/other_user}","gists_url":"https://api.github.com/users/zdtorok/gists{/gist_id}","starred_url":"https://api.github.com/users/zdtorok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdtorok/subscriptions","organizations_url":"https://api.github.com/users/zdtorok/orgs","repos_url":"https://api.github.com/users/zdtorok/repos","events_url":"https://api.github.com/users/zdtorok/events{/privacy}","received_events_url":"https://api.github.com/users/zdtorok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zdtorok/inetsense","description":"iNETSense","fork":false,"url":"https://api.github.com/repos/zdtorok/inetsense","forks_url":"https://api.github.com/repos/zdtorok/inetsense/forks","keys_url":"https://api.github.com/repos/zdtorok/inetsense/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zdtorok/inetsense/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zdtorok/inetsense/teams","hooks_url":"https://api.github.com/repos/zdtorok/inetsense/hooks","issue_events_url":"https://api.github.com/repos/zdtorok/inetsense/issues/events{/number}","events_url":"https://api.github.com/repos/zdtorok/inetsense/events","assignees_url":"https://api.github.com/repos/zdtorok/inetsense/assignees{/user}","branches_url":"https://api.github.com/repos/zdtorok/inetsense/branches{/branch}","tags_url":"https://api.github.com/repos/zdtorok/inetsense/tags","blobs_url":"https://api.github.com/repos/zdtorok/inetsense/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zdtorok/inetsense/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zdtorok/inetsense/git/refs{/sha}","trees_url":"https://api.github.com/repos/zdtorok/inetsense/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zdtorok/inetsense/statuses/{sha}","languages_url":"https://api.github.com/repos/zdtorok/inetsense/languages","stargazers_url":"https://api.github.com/repos/zdtorok/inetsense/stargazers","contributors_url":"https://api.github.com/repos/zdtorok/inetsense/contributors","subscribers_url":"https://api.github.com/repos/zdtorok/inetsense/subscribers","subscription_url":"https://api.github.com/repos/zdtorok/inetsense/subscription","commits_url":"https://api.github.com/repos/zdtorok/inetsense/commits{/sha}","git_commits_url":"https://api.github.com/repos/zdtorok/inetsense/git/commits{/sha}","comments_url":"https://api.github.com/repos/zdtorok/inetsense/comments{/number}","issue_comment_url":"https://api.github.com/repos/zdtorok/inetsense/issues/comments{/number}","contents_url":"https://api.github.com/repos/zdtorok/inetsense/contents/{+path}","compare_url":"https://api.github.com/repos/zdtorok/inetsense/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zdtorok/inetsense/merges","archive_url":"https://api.github.com/repos/zdtorok/inetsense/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zdtorok/inetsense/downloads","issues_url":"https://api.github.com/repos/zdtorok/inetsense/issues{/number}","pulls_url":"https://api.github.com/repos/zdtorok/inetsense/pulls{/number}","milestones_url":"https://api.github.com/repos/zdtorok/inetsense/milestones{/number}","notifications_url":"https://api.github.com/repos/zdtorok/inetsense/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zdtorok/inetsense/labels{/name}","releases_url":"https://api.github.com/repos/zdtorok/inetsense/releases{/id}","deployments_url":"https://api.github.com/repos/zdtorok/inetsense/deployments","created_at":"2016-02-24T16:35:53Z","updated_at":"2016-03-02T16:15:06Z","pushed_at":"2016-05-02T14:29:09Z","git_url":"git://github.com/zdtorok/inetsense.git","ssh_url":"git@github.com:zdtorok/inetsense.git","clone_url":"https://github.com/zdtorok/inetsense.git","svn_url":"https://github.com/zdtorok/inetsense","homepage":null,"size":2687,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zdtorok/inetsense/pulls/32"},"html":{"href":"https://github.com/zdtorok/inetsense/pull/32"},"issue":{"href":"https://api.github.com/repos/zdtorok/inetsense/issues/32"},"comments":{"href":"https://api.github.com/repos/zdtorok/inetsense/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/zdtorok/inetsense/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/zdtorok/inetsense/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zdtorok/inetsense/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/zdtorok/inetsense/statuses/05f6a704faa96c75f556798abc1e1ff2b7494474"}}}}