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
Trim whitespace from hostname #55
Conversation
I don't know why the 3rd commit still says pending, it failed due to a compilation error. |
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.
An util method should be used. Before it it also makes sense to ensure that null
host is being correctly handled by all methods invoked from this class. I suggest annotating methods fields with @CheckForNull
and @Nonnull
during the manual check. It will enforce FindBugs in the future
@@ -435,7 +435,11 @@ public SSHLauncher(String host, int port, String username, String password, Stri | |||
@Deprecated | |||
public SSHLauncher(String host, int port, String username, String password, String privatekey, String jvmOptions, | |||
String javaPath, JDKInstaller jdkInstaller, String prefixStartSlaveCmd, String suffixStartSlaveCmd) { | |||
this.host = host; | |||
if (host != null) { |
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.
Use hudson.Util.fixEmptyAndTrim()
. It will also convert blank lines to null, which is maybe required here
this.host = host; | ||
if (host != null) { | ||
this.host = host.trim(); | ||
} else { |
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.
same
Also I have a plan to annotate constructors, but first I have to make a clean up #91 |
Thank you for finishing this. I apologize for being so inactive, I wanted to make these changes but I never found the time. |
Launching an agent failed because we had an IP with a leading space. This should fix it. Add a test as well.