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

format string with no format token errors when a nil parameter is passed. #3712

Closed
NullVoxPopuli opened this issue Mar 6, 2016 · 2 comments

Comments

@NullVoxPopuli
Copy link

Environment

https://travis-ci.org/rails-api/active_model_serializers/jobs/111938627
https://github.com/rails-api/active_model_serializers/blob/master/.travis.yml#L35

Expected Behavior

format('string with no format token', nil)
# => 'string with no format token'

It's a little awkward, but it's how regular ruby works.

Actual Behavior

Exception and stack trace:
https://travis-ci.org/rails-api/active_model_serializers/jobs/111938627

Work Around

https://github.com/bf4/active_model_serializers/pull/3/files

@enebo
Copy link
Member

enebo commented Mar 7, 2016

Looks like we gratuitously capture exceptions and when -d (cli.debug) is enabled we can see that we have a bug in format:

jruby -Xcli.debug=true -e 'p format("aaa", nil)'

A workaround for now would also be to disable cli.debug but this should not be too difficult to fix.

@enebo enebo added this to the JRuby 9.1.0.0 milestone Mar 7, 2016
@enebo
Copy link
Member

enebo commented Mar 7, 2016

Resolving as not a bug. MRI also does this:

ruby -d -e 'p format("aaa", nil)'

I think the confusing part of this is -Xcli.debug looks like a JRuby specific option when it is just a property longhand for -d. So if you enabled -d in the C Ruby runs you should see the same problem in your CI runs.

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

No branches or pull requests

2 participants