groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject groovy git commit: GROOVY-7726: Groovysh doc command fails when using Java 9
Date Wed, 06 Jan 2016 18:42:12 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 3115cfdef -> e1eb2f3db


GROOVY-7726: Groovysh doc command fails when using Java 9


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e1eb2f3d
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e1eb2f3d
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e1eb2f3d

Branch: refs/heads/master
Commit: e1eb2f3dba464a404614ce6e6f057127f60f5d54
Parents: 3115cfd
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Wed Jan 6 19:41:53 2016 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Wed Jan 6 19:41:53 2016 +0100

----------------------------------------------------------------------
 .../codehaus/groovy/tools/shell/commands/DocCommand.groovy   | 8 +++++++-
 .../groovy/tools/shell/commands/DocCommandTest.groovy        | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e1eb2f3d/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
index ec35299..a18c847 100644
--- a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
+++ b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
@@ -166,7 +166,13 @@ class DocCommand extends CommandSupport {
     }
 
     private static simpleVersion() {
-        System.getProperty('java.version').split(/\./)[1]
+        String javaVersion = System.getProperty('java.version')
+        if (javaVersion.startsWith('1.')) {
+            javaVersion.split(/\./)[1]
+        } else {
+            // java 9 and above
+            javaVersion.replaceAll(/-.*/, '').split(/\./)[0]
+        }
     }
 
     protected boolean sendHEADRequest(URL url) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/e1eb2f3d/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/commands/DocCommandTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/commands/DocCommandTest.groovy
b/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/commands/DocCommandTest.groovy
index 779a180..8cbc08e 100644
--- a/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/commands/DocCommandTest.groovy
+++ b/subprojects/groovy-groovysh/src/test/groovy/org/codehaus/groovy/tools/shell/commands/DocCommandTest.groovy
@@ -151,6 +151,12 @@ class DocCommandTest extends CommandTestSupport
     }
 
     private simpleJavaVersion() {
-        System.getProperty('java.version').split(/\./)[1]
+        String javaVersion = System.getProperty('java.version')
+        if (javaVersion.startsWith('1.')) {
+            javaVersion.split(/\./)[1]
+        } else {
+            // java 9 and above
+            javaVersion.replaceAll(/-.*/, '').split(/\./)[0]
+        }
     }
 }


Mime
View raw message