{"action":"closed","issue":{"url":"https://api.github.com/repos/chef/ohai/issues/726","repository_url":"https://api.github.com/repos/chef/ohai","labels_url":"https://api.github.com/repos/chef/ohai/issues/726/labels{/name}","comments_url":"https://api.github.com/repos/chef/ohai/issues/726/comments","events_url":"https://api.github.com/repos/chef/ohai/issues/726/events","html_url":"https://github.com/chef/ohai/issues/726","id":131394469,"number":726,"title":"Not detecting java openjdk 1.8","user":{"login":"davidnewman","id":205516,"avatar_url":"https://avatars.githubusercontent.com/u/205516?v=3","gravatar_id":"","url":"https://api.github.com/users/davidnewman","html_url":"https://github.com/davidnewman","followers_url":"https://api.github.com/users/davidnewman/followers","following_url":"https://api.github.com/users/davidnewman/following{/other_user}","gists_url":"https://api.github.com/users/davidnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/davidnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidnewman/subscriptions","organizations_url":"https://api.github.com/users/davidnewman/orgs","repos_url":"https://api.github.com/users/davidnewman/repos","events_url":"https://api.github.com/users/davidnewman/events{/privacy}","received_events_url":"https://api.github.com/users/davidnewman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-04T16:07:10Z","updated_at":"2016-02-10T17:52:37Z","closed_at":"2016-02-10T17:52:37Z","body":"It looks like there is a bug in the java.rb plugin where the version string is not correctly parsed for openjdk version 1.8.\r\nI have tested against ohai version 8.10.0 on a CentOS 6.7 system and observered the following:\r\n```\r\n$ sudo yum install -y java-1.7.0-openjdk\r\n$ java -mx64m -version\r\njava version \"1.7.0_95\"\r\nOpenJDK Runtime Environment (rhel-2.6.4.0.el6_7-x86_64 u95-b00)\r\nOpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)\r\n```\r\nNote the first line of output for openjdk 1.7.\r\nThis is what you see for openjdk 1.8:\r\n```\r\n$ sudo yum install -y java-1.8.0-openjdk\r\n$ java -mx64m -version\r\nopenjdk version \"1.8.0_71\"\r\nOpenJDK Runtime Environment (build 1.8.0_71-b15)\r\nOpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)\r\n````\r\nAgain, note the first line of output.\r\nThe issue is with the following regex in java.rb:\r\n`/java version \\\"([0-9\\.\\_]+)\\\"/`\r\nBecause the version string output for openjdk 1.8 has changed, the regex fails to capture the version number and the java information is not detected even though java is installed.\r\nThe fix is:\r\n`/(?:java|openjdk) version \\\"([0-9\\.\\_]+)\\\"/`\r\nI am going to pull request against this issue, but I am not a ruby dev, so you may want to figure out a better fix if appropriate."}}