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:43:20 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 23ad731c4 -> 829b3dfa6


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/829b3dfa
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/829b3dfa
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/829b3dfa

Branch: refs/heads/GROOVY_2_4_X
Commit: 829b3dfa6651f86e48f917de0419b946043cd69d
Parents: 23ad731
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Wed Jan 6 19:41:53 2016 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Wed Jan 6 19:43:08 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/829b3dfa/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 10991fd..1ab804e 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
@@ -171,7 +171,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/829b3dfa/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