Skip to content

Added index check for the "default" IP #64

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexanderrtaylor
Copy link

@alexanderrtaylor alexanderrtaylor commented Mar 23, 2017

Added a check to make sure that the default IP exists in the container
to make sure that the return is non-null

@reviewbybees

Added a check to make sure that the default IP exists in the container
to make sure that the return is non-null
@@ -294,6 +294,11 @@ private String getDocker0Ip(Launcher launcher, String image) throws IOException,

String route = out.toString("UTF-8").trim();

// ensures that the the default IP exists so that the return is not null
if (route.indexOf("default") == -1){
Copy link
Member

Choose a reason for hiding this comment

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

Would be better to do:

if (!route.contains("default")) {
.....

Copy link
Author

Choose a reason for hiding this comment

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

You are right here, it is more precise and will probably work faster(maybe?).

Change is done

@ghost
Copy link

ghost commented Mar 28, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

I would prefer a non-Runtime exception, but there is already a runtime one above in the code => the code does not get worse.

🐝

@oleg-nenashev
Copy link
Member

@reviewbybees done

@jonhermansen jonhermansen self-assigned this Feb 18, 2018
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.

5 participants