Skip to content

fix for exec command encoding issue#258

Merged
brendandburns merged 3 commits into
kubernetes-client:masterfrom
karthikkondapally:execfix
May 5, 2018
Merged

fix for exec command encoding issue#258
brendandburns merged 3 commits into
kubernetes-client:masterfrom
karthikkondapally:execfix

Conversation

@karthikkondapally
Copy link
Copy Markdown
Contributor

fixes issue #257 by performing URLEncoder.encode on list of commands

boolean stdin,
boolean tty) {
String namespace, String name, String[] command, String container, boolean stdin, boolean tty)
throws UnsupportedEncodingException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hrm, I feel like populating this forward is probably not right. The encoder is extremely unlikely to throw this since UTF-8 is supported everywhere (and it better be, or HTTP won't work right...)

So I would just try/catch and then throw RuntimeException or some other sort of exception that doesn't have to be caught.

for (int i = 0; i < command.length; i++) {
try {
command[i] = URLEncoder.encode(command[i], "UTF-8");
} catch (Exception ex) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't catch Exception catch UnknownFormatException

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oops I meant UnsupportedEncodingException

for (int i = 0; i < command.length; i++) {
try {
command[i] = URLEncoder.encode(command[i], "UTF-8");
} catch (Exception ex) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oops I meant UnsupportedEncodingException

@brendandburns
Copy link
Copy Markdown
Contributor

LGTM, thanks!

@brendandburns brendandburns merged commit e18f141 into kubernetes-client:master May 5, 2018
@karthikkondapally karthikkondapally deleted the execfix branch June 7, 2018 02:56
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.

2 participants