{"action":"created","comment":{"url":"https://api.github.com/repos/iotaledger/iri/pulls/comments/208664143","pull_request_review_id":144521008,"id":208664143,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODY2NDE0Mw==","diff_hunk":"@@ -361,9 +118,49 @@ private static void shutdownHook() {\n                 }\n             }, \"Shutdown Hook\"));\n         }\n-    }\n \n-    public static boolean validateParams(Configuration configuration, String[] args) throws IOException {\n-        return IRILauncher.isValidated(configuration, args);\n+        private static IotaConfig createConfiguration(String[] args) {\n+            IotaConfig iotaConfig = null;\n+            boolean testnet = ArrayUtils.contains(args, Config.TESTNET_FLAG);\n+            File configFile = chooseConfigFile(args);\n+            String message = \"Configuration is created using \";\n+\n+            try {\n+                if (configFile.exists()) {\n+                    iotaConfig = ConfigFactory.createFromFile(configFile, testnet);\n+                    message+= configFile.getName() + \" and command line args\";\n+                }\n+                else {\n+                    iotaConfig = ConfigFactory.createIotaConfig(testnet);\n+                    message+= \"command line args only\";\n+                }\n+                JCommander jCommander = iotaConfig.parseConfigFromArgs(args);\n+                if (iotaConfig.isHelp()) {\n+                    jCommander.usage();\n+                    System.exit(0);\n+                }\n+            }\n+            catch (IOException | IllegalArgumentException e) {\n+                log.error(\"There was a problem reading configuration from file\" , e.getMessage());\n+                log.debug(\"\" ,e);\n+                System.exit(-1);","path":"src/main/java/com/iota/iri/IRI.java","position":344,"original_position":344,"commit_id":"dfacb6ded6d4a86365742e1b8e1a52ba6680f3af","original_commit_id":"dfacb6ded6d4a86365742e1b8e1a52ba6680f3af","user":{"login":"codacy-bot","id":19940114,"node_id":"MDQ6VXNlcjE5OTQwMTE0","avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [System.exit() should not be used in J2EE/JEE apps](https://app.codacy.com/app/iotaledger/iri/pullRequest?prid=2002628)","created_at":"2018-08-08T17:16:45Z","updated_at":"2018-08-08T17:16:45Z","html_url":"https://github.com/iotaledger/iri/pull/910#discussion_r208664143","pull_request_url":"https://api.github.com/repos/iotaledger/iri/pulls/910","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/iotaledger/iri/pulls/comments/208664143"},"html":{"href":"https://github.com/iotaledger/iri/pull/910#discussion_r208664143"},"pull_request":{"href":"https://api.github.com/repos/iotaledger/iri/pulls/910"}}},"pull_request":{"url":"https://api.github.com/repos/iotaledger/iri/pulls/910","id":206378530,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2Mzc4NTMw","html_url":"https://github.com/iotaledger/iri/pull/910","diff_url":"https://github.com/iotaledger/iri/pull/910.diff","patch_url":"https://github.com/iotaledger/iri/pull/910.patch","issue_url":"https://api.github.com/repos/iotaledger/iri/issues/910","number":910,"state":"open","locked":false,"title":"Refactor Configuration","user":{"login":"GalRogozinski","id":7954839,"node_id":"MDQ6VXNlcjc5NTQ4Mzk=","avatar_url":"https://avatars3.githubusercontent.com/u/7954839?v=4","gravatar_id":"","url":"https://api.github.com/users/GalRogozinski","html_url":"https://github.com/GalRogozinski","followers_url":"https://api.github.com/users/GalRogozinski/followers","following_url":"https://api.github.com/users/GalRogozinski/following{/other_user}","gists_url":"https://api.github.com/users/GalRogozinski/gists{/gist_id}","starred_url":"https://api.github.com/users/GalRogozinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalRogozinski/subscriptions","organizations_url":"https://api.github.com/users/GalRogozinski/orgs","repos_url":"https://api.github.com/users/GalRogozinski/repos","events_url":"https://api.github.com/users/GalRogozinski/events{/privacy}","received_events_url":"https://api.github.com/users/GalRogozinski/received_events","type":"User","site_admin":false},"body":"<!---\r\nHints for a successful PR:\r\n1. It is recommended that before you submit a PR to IOTA, to open an issue first and assign yourself.\r\nThis way you may get inputs and discover parallel PRs to the one you want to submit.\r\n2. In case of a big PR, consider breaking it up into smaller PRs. This will help to get it merged in an incremental process.\r\n3. Note that a PR should have a *single* area of responsibility. If your PR does more than one thing than it should be split into several PRs!!!!!\r\n4. It will be helpful if you make additional comments on the code via GitHub PR review to explain the choices you made\r\n-->\r\n\r\n# Description\r\n - This changes the way IRI loads configurations internally.\r\n - Testnet and Mainnet Configs are now separated to different classes that implement the same interfaces.\r\n - Interface segregation is used so that different \"modules\" won't have access to configurations they don't need.\r\n- Now with the `--help` flag one can print instructions to what the different configurations do.\r\n- Note that when one adds the `--testnet` flag new configs are available. One can see them by entering `--testnet --help`.\r\n- Jcommander  is used to parse CLI args.\r\n- Jackson is used to parse the ini file.\r\n\r\nFixes #724 \r\n\r\n## Type of change\r\n- Enhancement (a non-breaking change which adds functionality)\r\n\r\n# How Has This Been Tested?\r\n\r\nRan sanity tests on the following configs:\r\n - port (API)\r\n - neighbors\r\n - tcp port\r\n - udp port\r\n\r\n# Checklist:\r\n- [x] My code follows the style guidelines for this project\r\n- [x] I have performed a self-review of my own code\r\n- [x] I have commented my code, particularly in hard-to-understand areas\r\n- [ ] I have made corresponding changes to the documentation\r\n- [ ] I have added tests that prove my fix is effective or that my feature works\r\n- [x] New and existing unit tests pass locally with my changes\r\n","created_at":"2018-08-06T12:10:44Z","updated_at":"2018-08-08T17:16:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3a9220c12e8e4fb922e555565a07994464769bb","assignee":null,"assignees":[],"requested_reviewers":[{"login":"alon-e","id":25587995,"node_id":"MDQ6VXNlcjI1NTg3OTk1","avatar_url":"https://avatars3.githubusercontent.com/u/25587995?v=4","gravatar_id":"","url":"https://api.github.com/users/alon-e","html_url":"https://github.com/alon-e","followers_url":"https://api.github.com/users/alon-e/followers","following_url":"https://api.github.com/users/alon-e/following{/other_user}","gists_url":"https://api.github.com/users/alon-e/gists{/gist_id}","starred_url":"https://api.github.com/users/alon-e/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alon-e/subscriptions","organizations_url":"https://api.github.com/users/alon-e/orgs","repos_url":"https://api.github.com/users/alon-e/repos","events_url":"https://api.github.com/users/alon-e/events{/privacy}","received_events_url":"https://api.github.com/users/alon-e/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/iotaledger/iri/pulls/910/commits","review_comments_url":"https://api.github.com/repos/iotaledger/iri/pulls/910/comments","review_comment_url":"https://api.github.com/repos/iotaledger/iri/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iotaledger/iri/issues/910/comments","statuses_url":"https://api.github.com/repos/iotaledger/iri/statuses/dfacb6ded6d4a86365742e1b8e1a52ba6680f3af","head":{"label":"GalRogozinski:configuration-refactor3","ref":"configuration-refactor3","sha":"dfacb6ded6d4a86365742e1b8e1a52ba6680f3af","user":{"login":"GalRogozinski","id":7954839,"node_id":"MDQ6VXNlcjc5NTQ4Mzk=","avatar_url":"https://avatars3.githubusercontent.com/u/7954839?v=4","gravatar_id":"","url":"https://api.github.com/users/GalRogozinski","html_url":"https://github.com/GalRogozinski","followers_url":"https://api.github.com/users/GalRogozinski/followers","following_url":"https://api.github.com/users/GalRogozinski/following{/other_user}","gists_url":"https://api.github.com/users/GalRogozinski/gists{/gist_id}","starred_url":"https://api.github.com/users/GalRogozinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalRogozinski/subscriptions","organizations_url":"https://api.github.com/users/GalRogozinski/orgs","repos_url":"https://api.github.com/users/GalRogozinski/repos","events_url":"https://api.github.com/users/GalRogozinski/events{/privacy}","received_events_url":"https://api.github.com/users/GalRogozinski/received_events","type":"User","site_admin":false},"repo":{"id":111612948,"node_id":"MDEwOlJlcG9zaXRvcnkxMTE2MTI5NDg=","name":"iri","full_name":"GalRogozinski/iri","owner":{"login":"GalRogozinski","id":7954839,"node_id":"MDQ6VXNlcjc5NTQ4Mzk=","avatar_url":"https://avatars3.githubusercontent.com/u/7954839?v=4","gravatar_id":"","url":"https://api.github.com/users/GalRogozinski","html_url":"https://github.com/GalRogozinski","followers_url":"https://api.github.com/users/GalRogozinski/followers","following_url":"https://api.github.com/users/GalRogozinski/following{/other_user}","gists_url":"https://api.github.com/users/GalRogozinski/gists{/gist_id}","starred_url":"https://api.github.com/users/GalRogozinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GalRogozinski/subscriptions","organizations_url":"https://api.github.com/users/GalRogozinski/orgs","repos_url":"https://api.github.com/users/GalRogozinski/repos","events_url":"https://api.github.com/users/GalRogozinski/events{/privacy}","received_events_url":"https://api.github.com/users/GalRogozinski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GalRogozinski/iri","description":"IOTA Reference Implementation","fork":true,"url":"https://api.github.com/repos/GalRogozinski/iri","forks_url":"https://api.github.com/repos/GalRogozinski/iri/forks","keys_url":"https://api.github.com/repos/GalRogozinski/iri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GalRogozinski/iri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GalRogozinski/iri/teams","hooks_url":"https://api.github.com/repos/GalRogozinski/iri/hooks","issue_events_url":"https://api.github.com/repos/GalRogozinski/iri/issues/events{/number}","events_url":"https://api.github.com/repos/GalRogozinski/iri/events","assignees_url":"https://api.github.com/repos/GalRogozinski/iri/assignees{/user}","branches_url":"https://api.github.com/repos/GalRogozinski/iri/branches{/branch}","tags_url":"https://api.github.com/repos/GalRogozinski/iri/tags","blobs_url":"https://api.github.com/repos/GalRogozinski/iri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GalRogozinski/iri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GalRogozinski/iri/git/refs{/sha}","trees_url":"https://api.github.com/repos/GalRogozinski/iri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GalRogozinski/iri/statuses/{sha}","languages_url":"https://api.github.com/repos/GalRogozinski/iri/languages","stargazers_url":"https://api.github.com/repos/GalRogozinski/iri/stargazers","contributors_url":"https://api.github.com/repos/GalRogozinski/iri/contributors","subscribers_url":"https://api.github.com/repos/GalRogozinski/iri/subscribers","subscription_url":"https://api.github.com/repos/GalRogozinski/iri/subscription","commits_url":"https://api.github.com/repos/GalRogozinski/iri/commits{/sha}","git_commits_url":"https://api.github.com/repos/GalRogozinski/iri/git/commits{/sha}","comments_url":"https://api.github.com/repos/GalRogozinski/iri/comments{/number}","issue_comment_url":"https://api.github.com/repos/GalRogozinski/iri/issues/comments{/number}","contents_url":"https://api.github.com/repos/GalRogozinski/iri/contents/{+path}","compare_url":"https://api.github.com/repos/GalRogozinski/iri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GalRogozinski/iri/merges","archive_url":"https://api.github.com/repos/GalRogozinski/iri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GalRogozinski/iri/downloads","issues_url":"https://api.github.com/repos/GalRogozinski/iri/issues{/number}","pulls_url":"https://api.github.com/repos/GalRogozinski/iri/pulls{/number}","milestones_url":"https://api.github.com/repos/GalRogozinski/iri/milestones{/number}","notifications_url":"https://api.github.com/repos/GalRogozinski/iri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GalRogozinski/iri/labels{/name}","releases_url":"https://api.github.com/repos/GalRogozinski/iri/releases{/id}","deployments_url":"https://api.github.com/repos/GalRogozinski/iri/deployments","created_at":"2017-11-21T23:27:08Z","updated_at":"2018-07-17T10:05:33Z","pushed_at":"2018-08-08T15:33:52Z","git_url":"git://github.com/GalRogozinski/iri.git","ssh_url":"git@github.com:GalRogozinski/iri.git","clone_url":"https://github.com/GalRogozinski/iri.git","svn_url":"https://github.com/GalRogozinski/iri","homepage":null,"size":100974,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":4,"watchers":0,"default_branch":"dev"}},"base":{"label":"iotaledger:dev","ref":"dev","sha":"5566cbcc322a18a0d12a1ae425b4510de6bc8be8","user":{"login":"iotaledger","id":20126597,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwMTI2NTk3","avatar_url":"https://avatars3.githubusercontent.com/u/20126597?v=4","gravatar_id":"","url":"https://api.github.com/users/iotaledger","html_url":"https://github.com/iotaledger","followers_url":"https://api.github.com/users/iotaledger/followers","following_url":"https://api.github.com/users/iotaledger/following{/other_user}","gists_url":"https://api.github.com/users/iotaledger/gists{/gist_id}","starred_url":"https://api.github.com/users/iotaledger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iotaledger/subscriptions","organizations_url":"https://api.github.com/users/iotaledger/orgs","repos_url":"https://api.github.com/users/iotaledger/repos","events_url":"https://api.github.com/users/iotaledger/events{/privacy}","received_events_url":"https://api.github.com/users/iotaledger/received_events","type":"Organization","site_admin":false},"repo":{"id":71836159,"node_id":"MDEwOlJlcG9zaXRvcnk3MTgzNjE1OQ==","name":"iri","full_name":"iotaledger/iri","owner":{"login":"iotaledger","id":20126597,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwMTI2NTk3","avatar_url":"https://avatars3.githubusercontent.com/u/20126597?v=4","gravatar_id":"","url":"https://api.github.com/users/iotaledger","html_url":"https://github.com/iotaledger","followers_url":"https://api.github.com/users/iotaledger/followers","following_url":"https://api.github.com/users/iotaledger/following{/other_user}","gists_url":"https://api.github.com/users/iotaledger/gists{/gist_id}","starred_url":"https://api.github.com/users/iotaledger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iotaledger/subscriptions","organizations_url":"https://api.github.com/users/iotaledger/orgs","repos_url":"https://api.github.com/users/iotaledger/repos","events_url":"https://api.github.com/users/iotaledger/events{/privacy}","received_events_url":"https://api.github.com/users/iotaledger/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iotaledger/iri","description":"IOTA Reference Implementation","fork":false,"url":"https://api.github.com/repos/iotaledger/iri","forks_url":"https://api.github.com/repos/iotaledger/iri/forks","keys_url":"https://api.github.com/repos/iotaledger/iri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iotaledger/iri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iotaledger/iri/teams","hooks_url":"https://api.github.com/repos/iotaledger/iri/hooks","issue_events_url":"https://api.github.com/repos/iotaledger/iri/issues/events{/number}","events_url":"https://api.github.com/repos/iotaledger/iri/events","assignees_url":"https://api.github.com/repos/iotaledger/iri/assignees{/user}","branches_url":"https://api.github.com/repos/iotaledger/iri/branches{/branch}","tags_url":"https://api.github.com/repos/iotaledger/iri/tags","blobs_url":"https://api.github.com/repos/iotaledger/iri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iotaledger/iri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iotaledger/iri/git/refs{/sha}","trees_url":"https://api.github.com/repos/iotaledger/iri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iotaledger/iri/statuses/{sha}","languages_url":"https://api.github.com/repos/iotaledger/iri/languages","stargazers_url":"https://api.github.com/repos/iotaledger/iri/stargazers","contributors_url":"https://api.github.com/repos/iotaledger/iri/contributors","subscribers_url":"https://api.github.com/repos/iotaledger/iri/subscribers","subscription_url":"https://api.github.com/repos/iotaledger/iri/subscription","commits_url":"https://api.github.com/repos/iotaledger/iri/commits{/sha}","git_commits_url":"https://api.github.com/repos/iotaledger/iri/git/commits{/sha}","comments_url":"https://api.github.com/repos/iotaledger/iri/comments{/number}","issue_comment_url":"https://api.github.com/repos/iotaledger/iri/issues/comments{/number}","contents_url":"https://api.github.com/repos/iotaledger/iri/contents/{+path}","compare_url":"https://api.github.com/repos/iotaledger/iri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iotaledger/iri/merges","archive_url":"https://api.github.com/repos/iotaledger/iri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iotaledger/iri/downloads","issues_url":"https://api.github.com/repos/iotaledger/iri/issues{/number}","pulls_url":"https://api.github.com/repos/iotaledger/iri/pulls{/number}","milestones_url":"https://api.github.com/repos/iotaledger/iri/milestones{/number}","notifications_url":"https://api.github.com/repos/iotaledger/iri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iotaledger/iri/labels{/name}","releases_url":"https://api.github.com/repos/iotaledger/iri/releases{/id}","deployments_url":"https://api.github.com/repos/iotaledger/iri/deployments","created_at":"2016-10-24T22:06:06Z","updated_at":"2018-08-08T14:39:49Z","pushed_at":"2018-08-08T15:33:54Z","git_url":"git://github.com/iotaledger/iri.git","ssh_url":"git@github.com:iotaledger/iri.git","clone_url":"https://github.com/iotaledger/iri.git","svn_url":"https://github.com/iotaledger/iri","homepage":null,"size":100672,"stargazers_count":1004,"watchers_count":1004,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":348,"mirror_url":null,"archived":false,"open_issues_count":202,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":348,"open_issues":202,"watchers":1004,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/iotaledger/iri/pulls/910"},"html":{"href":"https://github.com/iotaledger/iri/pull/910"},"issue":{"href":"https://api.github.com/repos/iotaledger/iri/issues/910"},"comments":{"href":"https://api.github.com/repos/iotaledger/iri/issues/910/comments"},"review_comments":{"href":"https://api.github.com/repos/iotaledger/iri/pulls/910/comments"},"review_comment":{"href":"https://api.github.com/repos/iotaledger/iri/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iotaledger/iri/pulls/910/commits"},"statuses":{"href":"https://api.github.com/repos/iotaledger/iri/statuses/dfacb6ded6d4a86365742e1b8e1a52ba6680f3af"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"codacy-bot"}}