Skip to content

Commit d377216

Browse files
authored
Merge pull request jxmorris12#13 from jie-mei/master
Fix JDK 14 could not be parsed issue
2 parents 8cd33c3 + 90fd79d commit d377216

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎language_tool_python/download_lt.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
LATEST_VERSION = '4.9'
3232

3333
JAVA_VERSION_REGEX = re.compile(
34-
r'^(?:java|openjdk) version "(?P<major1>\d+)\.(?P<major2>\d+)\.[^"]+"',
34+
r'^(?:java|openjdk) version "(?P<major1>\d+)(|\.(?P<major2>\d+)\.[^"]+)"',
3535
re.MULTILINE)
3636

3737
# Updated for later versions of java
@@ -61,7 +61,9 @@ def parse_java_version(version_text):
6161
if not match:
6262
raise SystemExit(
6363
'Could not parse Java version from """{}""".'.format(version_text))
64-
return (int(match.group('major1')), int(match.group('major2')))
64+
major1 = int(match.group('major1'))
65+
major2 = int(match.group('major2')) if match.group('major2') else 0
66+
return (major1, major2)
6567

6668
def confirm_java_compatibility():
6769
""" Confirms Java major version >= 8. """

0 commit comments

Comments
 (0)