-
Notifications
You must be signed in to change notification settings - Fork 85
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
base: master
Are you sure you want to change the base?
Conversation
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){ |
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.
Would be better to do:
if (!route.contains("default")) {
.....
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.
You are right here, it is more precise and will probably work faster(maybe?).
Change is done
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. |
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 would prefer a non-Runtime exception, but there is already a runtime one above in the code => the code does not get worse.
🐝
@reviewbybees done |
Added a check to make sure that the default IP exists in the container
to make sure that the return is non-null
@reviewbybees