Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date._strptime raises Java exception on invalid argument #6428

Closed
kares opened this issue Oct 7, 2020 · 0 comments · Fixed by #6429
Closed

Date._strptime raises Java exception on invalid argument #6428

kares opened this issue Oct 7, 2020 · 0 comments · Fixed by #6429

Comments

@kares
Copy link
Member

kares commented Oct 7, 2020

... while it should properly raise a Ruby TypeError, such as with MRI:

ruby -rtime -e "Time.strptime(0, '%Y-%m-%d')"

time.rb:432:in `_strptime': no implicit conversion of Integer into String (TypeError)

ruby -rtime -e "Time.strptime(nil, '%Y-%m-%d')"

time.rb:432:in `_strptime': no implicit conversion of nil into String (TypeError)

JRuby (9.2.13.0) ends up with:

        4: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:203)
        3: from org.jruby.ext.date.RubyDate$INVOKER$s$_strptime.call(RubyDate$INVOKER$s$_strptime.gen)
        2: from org.jruby.ext.date.RubyDate._strptime(RubyDate.java:1685)
        1: from org.jruby.ext.date.RubyDate.parse(RubyDate.java:1691)
Java::JavaLang::ClassCastException (org.jruby.RubyNil cannot be cast to org.jruby.RubyString)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant