{"action":"created","comment":{"url":"https://api.github.com/repos/wildfly/wildfly-core/pulls/comments/49452933","id":49452933,"diff_hunk":"@@ -59,40 +57,20 @@ public static int compareVersion(final String version1, final String version2) {\n \n     @Override\n     public int compare(final String o1, final String o2) {\n-        final String[] vs1 = o1.split(\"\\\\.\");\n-        final String[] vs2 = o2.split(\"\\\\.\");\n-        final int len = (vs1.length > vs2.length ? vs1.length : vs2.length);\n-        final List<Integer> v1 = convert(vs1, len);\n-        final List<Integer> v2 = convert(vs2, len);\n-        int result = 0;\n-        for (int i = 0; i < len; i++) {\n-            final Integer vi1 = v1.get(i);\n-            final Integer vi2 = v2.get(i);\n-            result = vi1.compareTo(vi2);\n-            if (result != 0) {\n-                break;\n-            }\n-        }\n-        return result;\n+        int version1 = getMajorVersion(o1);\n+        int version2 = getMajorVersion(o2);\n+        return Integer.compare(version1, version2);\n     }\n \n-    private static List<Integer> convert(final String[] version, final int len) {\n-        final List<Integer> result = new ArrayList<>(len);\n-        for (int i = 0; i < len; i++) {\n-            if (i < version.length) {\n-                final String s = version[i];\n-                if (\"x\".equalsIgnoreCase(s)) {\n-                    result.add(0);\n-                } else {\n-                    try {\n-                        result.add(Integer.valueOf(s));\n-                    } catch (NumberFormatException e) {\n-                        throw new IllegalArgumentException(String.format(\"Version part %s is not a valid integer\", s), e);\n-                    }\n-                }\n-            } else {\n-                result.add(0);\n-            }\n+    private int getMajorVersion(String versionString) {\n+        final String[] vs = versionString.split(\"\\\\.\");","path":"launcher/src/main/java/org/wildfly/core/launcher/JavaVersionComparator.java","position":85,"original_position":85,"commit_id":"22c5004feda38e152b80174324d87e53ab6b5514","original_commit_id":"22c5004feda38e152b80174324d87e53ab6b5514","user":{"login":"ctomc","id":824084,"avatar_url":"https://avatars.githubusercontent.com/u/824084?v=3","gravatar_id":"","url":"https://api.github.com/users/ctomc","html_url":"https://github.com/ctomc","followers_url":"https://api.github.com/users/ctomc/followers","following_url":"https://api.github.com/users/ctomc/following{/other_user}","gists_url":"https://api.github.com/users/ctomc/gists{/gist_id}","starred_url":"https://api.github.com/users/ctomc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctomc/subscriptions","organizations_url":"https://api.github.com/users/ctomc/orgs","repos_url":"https://api.github.com/users/ctomc/repos","events_url":"https://api.github.com/users/ctomc/events{/privacy}","received_events_url":"https://api.github.com/users/ctomc/received_events","type":"User","site_admin":false},"body":"I just kept it as it was in previous version of code. \r\nMakes sense to simplify it as much as possible.","created_at":"2016-01-12T13:24:38Z","updated_at":"2016-01-12T13:24:38Z","html_url":"https://github.com/wildfly/wildfly-core/pull/1355#discussion_r49452933","pull_request_url":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355","_links":{"self":{"href":"https://api.github.com/repos/wildfly/wildfly-core/pulls/comments/49452933"},"html":{"href":"https://github.com/wildfly/wildfly-core/pull/1355#discussion_r49452933"},"pull_request":{"href":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355"}}},"pull_request":{"url":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355","id":55752843,"html_url":"https://github.com/wildfly/wildfly-core/pull/1355","diff_url":"https://github.com/wildfly/wildfly-core/pull/1355.diff","patch_url":"https://github.com/wildfly/wildfly-core/pull/1355.patch","issue_url":"https://api.github.com/repos/wildfly/wildfly-core/issues/1355","number":1355,"state":"open","locked":false,"title":"EAP7-431 Propertly handle java 9 version string","user":{"login":"ctomc","id":824084,"avatar_url":"https://avatars.githubusercontent.com/u/824084?v=3","gravatar_id":"","url":"https://api.github.com/users/ctomc","html_url":"https://github.com/ctomc","followers_url":"https://api.github.com/users/ctomc/followers","following_url":"https://api.github.com/users/ctomc/following{/other_user}","gists_url":"https://api.github.com/users/ctomc/gists{/gist_id}","starred_url":"https://api.github.com/users/ctomc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctomc/subscriptions","organizations_url":"https://api.github.com/users/ctomc/orgs","repos_url":"https://api.github.com/users/ctomc/repos","events_url":"https://api.github.com/users/ctomc/events{/privacy}","received_events_url":"https://api.github.com/users/ctomc/received_events","type":"User","site_admin":false},"body":"Fix the code to properly address new JDK 9 versioning as defined in http://openjdk.java.net/jeps/223","created_at":"2016-01-12T12:44:15Z","updated_at":"2016-01-12T13:24:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e58b80e59250590b3ccbe432e8b2c7923bb9f034","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355/commits","review_comments_url":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355/comments","review_comment_url":"https://api.github.com/repos/wildfly/wildfly-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wildfly/wildfly-core/issues/1355/comments","statuses_url":"https://api.github.com/repos/wildfly/wildfly-core/statuses/22c5004feda38e152b80174324d87e53ab6b5514","head":{"label":"ctomc:jdk-9-version","ref":"jdk-9-version","sha":"22c5004feda38e152b80174324d87e53ab6b5514","user":{"login":"ctomc","id":824084,"avatar_url":"https://avatars.githubusercontent.com/u/824084?v=3","gravatar_id":"","url":"https://api.github.com/users/ctomc","html_url":"https://github.com/ctomc","followers_url":"https://api.github.com/users/ctomc/followers","following_url":"https://api.github.com/users/ctomc/following{/other_user}","gists_url":"https://api.github.com/users/ctomc/gists{/gist_id}","starred_url":"https://api.github.com/users/ctomc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctomc/subscriptions","organizations_url":"https://api.github.com/users/ctomc/orgs","repos_url":"https://api.github.com/users/ctomc/repos","events_url":"https://api.github.com/users/ctomc/events{/privacy}","received_events_url":"https://api.github.com/users/ctomc/received_events","type":"User","site_admin":false},"repo":{"id":21428688,"name":"wildfly-core","full_name":"ctomc/wildfly-core","owner":{"login":"ctomc","id":824084,"avatar_url":"https://avatars.githubusercontent.com/u/824084?v=3","gravatar_id":"","url":"https://api.github.com/users/ctomc","html_url":"https://github.com/ctomc","followers_url":"https://api.github.com/users/ctomc/followers","following_url":"https://api.github.com/users/ctomc/following{/other_user}","gists_url":"https://api.github.com/users/ctomc/gists{/gist_id}","starred_url":"https://api.github.com/users/ctomc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctomc/subscriptions","organizations_url":"https://api.github.com/users/ctomc/orgs","repos_url":"https://api.github.com/users/ctomc/repos","events_url":"https://api.github.com/users/ctomc/events{/privacy}","received_events_url":"https://api.github.com/users/ctomc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ctomc/wildfly-core","description":"The core runtime that is used by the Wildfly application server","fork":true,"url":"https://api.github.com/repos/ctomc/wildfly-core","forks_url":"https://api.github.com/repos/ctomc/wildfly-core/forks","keys_url":"https://api.github.com/repos/ctomc/wildfly-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctomc/wildfly-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctomc/wildfly-core/teams","hooks_url":"https://api.github.com/repos/ctomc/wildfly-core/hooks","issue_events_url":"https://api.github.com/repos/ctomc/wildfly-core/issues/events{/number}","events_url":"https://api.github.com/repos/ctomc/wildfly-core/events","assignees_url":"https://api.github.com/repos/ctomc/wildfly-core/assignees{/user}","branches_url":"https://api.github.com/repos/ctomc/wildfly-core/branches{/branch}","tags_url":"https://api.github.com/repos/ctomc/wildfly-core/tags","blobs_url":"https://api.github.com/repos/ctomc/wildfly-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctomc/wildfly-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctomc/wildfly-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctomc/wildfly-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctomc/wildfly-core/statuses/{sha}","languages_url":"https://api.github.com/repos/ctomc/wildfly-core/languages","stargazers_url":"https://api.github.com/repos/ctomc/wildfly-core/stargazers","contributors_url":"https://api.github.com/repos/ctomc/wildfly-core/contributors","subscribers_url":"https://api.github.com/repos/ctomc/wildfly-core/subscribers","subscription_url":"https://api.github.com/repos/ctomc/wildfly-core/subscription","commits_url":"https://api.github.com/repos/ctomc/wildfly-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctomc/wildfly-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctomc/wildfly-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctomc/wildfly-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctomc/wildfly-core/contents/{+path}","compare_url":"https://api.github.com/repos/ctomc/wildfly-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctomc/wildfly-core/merges","archive_url":"https://api.github.com/repos/ctomc/wildfly-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctomc/wildfly-core/downloads","issues_url":"https://api.github.com/repos/ctomc/wildfly-core/issues{/number}","pulls_url":"https://api.github.com/repos/ctomc/wildfly-core/pulls{/number}","milestones_url":"https://api.github.com/repos/ctomc/wildfly-core/milestones{/number}","notifications_url":"https://api.github.com/repos/ctomc/wildfly-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctomc/wildfly-core/labels{/name}","releases_url":"https://api.github.com/repos/ctomc/wildfly-core/releases{/id}","created_at":"2014-07-02T15:06:51Z","updated_at":"2015-04-01T14:12:16Z","pushed_at":"2016-01-12T12:43:01Z","git_url":"git://github.com/ctomc/wildfly-core.git","ssh_url":"git@github.com:ctomc/wildfly-core.git","clone_url":"https://github.com/ctomc/wildfly-core.git","svn_url":"https://github.com/ctomc/wildfly-core","homepage":null,"size":46256,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wildfly:master","ref":"master","sha":"18393273a1c9e464fb0cc959795118fd5a453904","user":{"login":"wildfly","id":3066274,"avatar_url":"https://avatars.githubusercontent.com/u/3066274?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfly","html_url":"https://github.com/wildfly","followers_url":"https://api.github.com/users/wildfly/followers","following_url":"https://api.github.com/users/wildfly/following{/other_user}","gists_url":"https://api.github.com/users/wildfly/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfly/subscriptions","organizations_url":"https://api.github.com/users/wildfly/orgs","repos_url":"https://api.github.com/users/wildfly/repos","events_url":"https://api.github.com/users/wildfly/events{/privacy}","received_events_url":"https://api.github.com/users/wildfly/received_events","type":"Organization","site_admin":false},"repo":{"id":21394954,"name":"wildfly-core","full_name":"wildfly/wildfly-core","owner":{"login":"wildfly","id":3066274,"avatar_url":"https://avatars.githubusercontent.com/u/3066274?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfly","html_url":"https://github.com/wildfly","followers_url":"https://api.github.com/users/wildfly/followers","following_url":"https://api.github.com/users/wildfly/following{/other_user}","gists_url":"https://api.github.com/users/wildfly/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfly/subscriptions","organizations_url":"https://api.github.com/users/wildfly/orgs","repos_url":"https://api.github.com/users/wildfly/repos","events_url":"https://api.github.com/users/wildfly/events{/privacy}","received_events_url":"https://api.github.com/users/wildfly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wildfly/wildfly-core","description":"The core runtime that is used by the Wildfly application server","fork":false,"url":"https://api.github.com/repos/wildfly/wildfly-core","forks_url":"https://api.github.com/repos/wildfly/wildfly-core/forks","keys_url":"https://api.github.com/repos/wildfly/wildfly-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wildfly/wildfly-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wildfly/wildfly-core/teams","hooks_url":"https://api.github.com/repos/wildfly/wildfly-core/hooks","issue_events_url":"https://api.github.com/repos/wildfly/wildfly-core/issues/events{/number}","events_url":"https://api.github.com/repos/wildfly/wildfly-core/events","assignees_url":"https://api.github.com/repos/wildfly/wildfly-core/assignees{/user}","branches_url":"https://api.github.com/repos/wildfly/wildfly-core/branches{/branch}","tags_url":"https://api.github.com/repos/wildfly/wildfly-core/tags","blobs_url":"https://api.github.com/repos/wildfly/wildfly-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wildfly/wildfly-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wildfly/wildfly-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/wildfly/wildfly-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wildfly/wildfly-core/statuses/{sha}","languages_url":"https://api.github.com/repos/wildfly/wildfly-core/languages","stargazers_url":"https://api.github.com/repos/wildfly/wildfly-core/stargazers","contributors_url":"https://api.github.com/repos/wildfly/wildfly-core/contributors","subscribers_url":"https://api.github.com/repos/wildfly/wildfly-core/subscribers","subscription_url":"https://api.github.com/repos/wildfly/wildfly-core/subscription","commits_url":"https://api.github.com/repos/wildfly/wildfly-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/wildfly/wildfly-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/wildfly/wildfly-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/wildfly/wildfly-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/wildfly/wildfly-core/contents/{+path}","compare_url":"https://api.github.com/repos/wildfly/wildfly-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wildfly/wildfly-core/merges","archive_url":"https://api.github.com/repos/wildfly/wildfly-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wildfly/wildfly-core/downloads","issues_url":"https://api.github.com/repos/wildfly/wildfly-core/issues{/number}","pulls_url":"https://api.github.com/repos/wildfly/wildfly-core/pulls{/number}","milestones_url":"https://api.github.com/repos/wildfly/wildfly-core/milestones{/number}","notifications_url":"https://api.github.com/repos/wildfly/wildfly-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wildfly/wildfly-core/labels{/name}","releases_url":"https://api.github.com/repos/wildfly/wildfly-core/releases{/id}","created_at":"2014-07-01T16:33:34Z","updated_at":"2015-12-11T00:13:48Z","pushed_at":"2016-01-12T12:44:16Z","git_url":"git://github.com/wildfly/wildfly-core.git","ssh_url":"git@github.com:wildfly/wildfly-core.git","clone_url":"https://github.com/wildfly/wildfly-core.git","svn_url":"https://github.com/wildfly/wildfly-core","homepage":null,"size":48566,"stargazers_count":38,"watchers_count":38,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":168,"mirror_url":null,"open_issues_count":56,"forks":168,"open_issues":56,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355"},"html":{"href":"https://github.com/wildfly/wildfly-core/pull/1355"},"issue":{"href":"https://api.github.com/repos/wildfly/wildfly-core/issues/1355"},"comments":{"href":"https://api.github.com/repos/wildfly/wildfly-core/issues/1355/comments"},"review_comments":{"href":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355/comments"},"review_comment":{"href":"https://api.github.com/repos/wildfly/wildfly-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wildfly/wildfly-core/pulls/1355/commits"},"statuses":{"href":"https://api.github.com/repos/wildfly/wildfly-core/statuses/22c5004feda38e152b80174324d87e53ab6b5514"}}}}