summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Skousen <seth.skousen@mx.com>2020-05-27 17:07:06 -0600
committerSeth Skousen <seth.skousen@mx.com>2020-05-27 17:07:06 -0600
commitbe1708c5fef78886319e8d10d201aece53bc1b0f (patch)
tree70d84f11b4f9999cca42e75746190ec5ff088937
parent3768f1f1a81504909df7b9ee95fdd16f6610096d (diff)
downloadnet-ssh-be1708c5fef78886319e8d10d201aece53bc1b0f.tar.gz
Tweak max constant value to work with JRuby 9.1
-rw-r--r--lib/net/ssh/authentication/certificate.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/net/ssh/authentication/certificate.rb b/lib/net/ssh/authentication/certificate.rb
index 82e37e9..006b45e 100644
--- a/lib/net/ssh/authentication/certificate.rb
+++ b/lib/net/ssh/authentication/certificate.rb
@@ -35,8 +35,9 @@ module Net
cert.valid_before = if RUBY_PLATFORM == "java"
# 0x20c49ba5e353f7 = 0x7fffffffffffffff/1000, the largest value possible for JRuby
# JRuby Time.at multiplies the arg by 1000, and then stores it in a signed long.
- # 0x20c49ba5e353f7 = 292278994-08-17 01:12:55 -0600
- Time.at([0x20c49ba5e353f7, buffer.read_int64].min)
+ # 0x20c49ba2d52500 = 292278993-01-01 00:00:00 +0000
+ # JRuby 9.1 does not accept the year 292278994 because of edge cases (https://github.com/JodaOrg/joda-time/issues/190)
+ Time.at([0x20c49ba2d52500, buffer.read_int64].min)
else
Time.at(buffer.read_int64)
end