-
-
Notifications
You must be signed in to change notification settings - Fork 898
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
JRuby-Nokogiri errors with “can't modify frozen string” #1077
Comments
Added example that fails, and clarified that this error only occurs for |
The problem here is that DocumentFragment.new tries to "trim" the incoming string by using chomp! rather than dup'ing the string or using the non-mutative form of chomp. I removed the call to "trim" in XmlDocumentFragment::rbNew and no tests failed, so I'm not sure if this is needed. Either way, it should be a simple fix: don't chomp!, dup and then chomp!, or chomp. |
👍 |
@headius: rubinius has the exact same issue (tested on 2.2.6) |
Hi I just fixed this bug, also I added a test for issue#444. My apologies. I didn't add any test for issue#444, so just skipping trim method caused a regression. Now, both fixed. |
I'll take a look later today and merge if it looks good. Thank you!
|
hmmm, it looks libxml version adds "\n" now. The parse result of |
Merged the |
LGTM, thanks! |
The change in this pr caused the build to be red. it looks like the two implementations has changed their behavior regarding #444, jruby doesn't include the newline but MRI (as of master) includes a newline character. I'm not sure how to fix this issue other than removing the new |
My vote was originally, and is still today, to remove the trim/chomp from On Wed, Feb 17, 2016 at 6:27 PM, John Shahid notifications@github.com
|
Nokogiri::XML.fragment
cannot be used on frozen strings. (Nokogiri::XML.parse
is not affected).Steps to reproduce
Execute the following on JRuby and MRI:
Expected output
No exception raised.
Actual output
Notes
In XmlDocumentFragment.java lines 115-119, the
#chomp!
method is used on the input argument, which fails for frozen strings:The text was updated successfully, but these errors were encountered: