Skip to content

Add explicit null checking for charset in SimpleHttpResponse #1403 - #1590

Closed
JiangZian wants to merge 2 commits into
alibaba:masterfrom
JiangZian:issues#1403_5
Closed

JiangZian wants to merge 2 commits into
alibaba:masterfrom
JiangZian:issues#1403_5

Conversation

@JiangZian

Copy link
Copy Markdown
Contributor

Add explicit null checking for charset in SimpleHttpResponse #1403

@JiangZian

Copy link
Copy Markdown
Contributor Author

@sczyh30 I only submitted part of this issue before (there are altogether five parts), and now this issue is submitted by other parts.Do you still need to deal with #1403?

@JiangZian

Copy link
Copy Markdown
Contributor Author

@zhaoyuguang Could you please check it for me

@JiangZian

Copy link
Copy Markdown
Contributor Author

@yunfeiyanggzq Trouble review

}
}
if (charset == null) {
throw new IllegalArgumentException("charset is not allowed to be null");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could use the default charset if not set, instead of panicking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review. The question you raised is indeed something that I did not fully consider, and it has been revised

@sczyh30

sczyh30 commented Aug 23, 2020

Copy link
Copy Markdown
Member

public String getBodyAsString() {
parseCharset();
return new String(body, charset);
}

What if body is null or empty?

@JiangZian

Copy link
Copy Markdown
Contributor Author

public String getBodyAsString() {
parseCharset();
return new String(body, charset);
}

What if body is null or empty?

谢谢您的审阅。这个确实是一个优化点

@JiangZian
JiangZian requested a review from sczyh30 October 13, 2020 02:59
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@LearningGp

Copy link
Copy Markdown
Collaborator

Due to this PR's inactivity and the unsigned CLA, we are temporarily closing it. Feel free to create a new PR if you still intend to contribute after addressing the CLA requirement.

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

Successfully merging this pull request may close these issues.

4 participants