-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
Added writeString(Reader, int) method to JsonGenerator as requested i… #309
Conversation
I don't think it works... which is also why unit test(s) would absolutely be required here. :) |
*/ | ||
public void writeString(Reader reader, int charLength) throws IOException { | ||
if (reader == null) { | ||
return; |
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.
This should be an error probably ,not just bailing out.
} | ||
|
||
if (charLength == -1) { | ||
while (reader.read() != -1) ; |
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.
Uh, what? If not known, quietly swallow content?!?!? And do that as inefficiently as possible, char by char, instead of skipping?
} else { | ||
int readChars = reader.read(new char[charLength]); | ||
|
||
if (readChars < charLength) { |
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.
,... and readers are entirely within their rights to return less.
Uh no. This makes no sense as implementation, no unit test. What the hell. |
Resolve #17 issue.
Well, at least I think so. :)