-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Report the correct error position in some malformed constructs. #1253
Conversation
If the consumed character is unexpected, we need to unconsume it first, then report the error, so the correct character is reported. In rare cases, the extra buffering up caused by reporting the invalid character could cause unconsume() to fail entirely. Fixes jhy#1251.
@@ -1,209 +1,252 @@ | |||
package org.jsoup.parser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why the diff shows the entire file is replaced. I've only added new tests, starting from line 210.
The build failure doesn't seem to have anything to do with my changes: |
@csaboka I've tested your fix and it seems to work. Only question I have is that one comment I added to the diff. |
The Travis build is still failing for reasons unrelated to the Java source, but as far as I can tell the code is actually working. |
@csaboka I investigated why that whole test file shows up as replaced in the diff. Apparently you inadvertently replaced all the newlines with carriage return + line feed (the default on windows). Maybe edit that file to use |
@HansBrende I don't get it. I am on Windows, and looks like my IDE didn't pick up the intended core.autocrlf setting, but now I've fixed it and the diff still reports all lines changed. When I force core.autocrlf to false and get the file again from my index, it has \n line endings everywhere, so the pushed version should have \n endings as well. I'm out of ideas. |
Nope, it still shows |
@csaboka This question might help you https://stackoverflow.com/questions/27810758/how-to-replace-crlf-with-lf-in-a-single-file |
@HansBrende : I appreciate that you're trying to help, but please believe me that I already know how to use a hexeditor and verify which kind of line endings I have. When I check out the error-reporting-fix branch on my local repo, I'm getting Unix-style endings (\n, 0x0A) even when I have the "core.autocrlf" setting turned on in Git, which is strange. In any case, I can't convert the file to LF endings when it already has all LF endings. |
Thanks @csaboka and @HansBrende! Have merged this in c2b1fe7 I couldn't figure what was going on with that diff either, so I ended up just C&Ping in the new tests. @csaboka if you don't mind, could you please double check that I pulled everything in fully? |
@jhy : The commit looks good to me, it contains all my intended changes and all the new tests. |
If the consumed character is unexpected, we need to unconsume it first,
then report the error, so the correct character is reported. In rare
cases, the extra buffering up caused by reporting the invalid character
could cause unconsume() to fail entirely.
Fixes #1251.