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

Nil tag with implicit: false raises error on SnakeYAML #500

Open
headius opened this issue May 25, 2021 · 1 comment
Open

Nil tag with implicit: false raises error on SnakeYAML #500

headius opened this issue May 25, 2021 · 1 comment

Comments

@headius
Copy link
Contributor

headius commented May 25, 2021

The following line, when reached by the tests from #475, triggers SnakeYAML to raise an error:

register o, @emitter.start_mapping(nil, c.tag, c.implicit, c.style)

The error:

RuntimeError: org.yaml.snakeyaml.emitter.EmitterException: tag is not specified
                      scalar at org/jruby/ext/psych/PsychEmitter.java:206
    visit_Psych_Nodes_Scalar at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:32
                       visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
                      accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
   visit_Psych_Nodes_Mapping at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:43
                        each at org/jruby/RubyArray.java:1864
   visit_Psych_Nodes_Mapping at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:43
                       visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
                      accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
  visit_Psych_Nodes_Document at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:27
                        each at org/jruby/RubyArray.java:1864
  visit_Psych_Nodes_Document at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:27
                       visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
                      accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
    visit_Psych_Nodes_Stream at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:21
                        each at org/jruby/RubyArray.java:1864
    visit_Psych_Nodes_Stream at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:21
                       visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
                      accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
                        yaml at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/nodes/node.rb:61
                        dump at /Users/headius/projects/jruby/lib/ruby/stdlib/psych.rb:515
                      <main> at blah.rb:13

As far as I can tell, the issue is that the tag is nil and implicit is false, which is prohibited in SnakeYAML for a mapping.

This is somewhat outside my understanding of YAML and I am not sure whether this constitutes an improper behavioral difference in SnakeYAML or not.

The implicit value comes from the default @implicit of Coder, and is never set to true in the logic hit by the tests mentioned above. As it stands I do not know how to reconcile the values being passed in with the SnakeYAML hard error.

This leads to the remaining failures in jruby/jruby#6680, which I will exclude to proceed with the Psych update.

headius added a commit to headius/jruby that referenced this issue May 25, 2021
@asomov
Copy link

asomov commented Jan 12, 2023

@headius do you need any support here or the issue is closed ?

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

No branches or pull requests

2 participants