Skip to content
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

Merged
merged 6 commits into from Jul 24, 2018
Merged

Trim whitespace from hostname #55

merged 6 commits into from Jul 24, 2018

Conversation

adamkasztenny
Copy link
Contributor

Launching an agent failed because we had an IP with a leading space. This should fix it. Add a test as well.

@adamkasztenny
Copy link
Contributor Author

adamkasztenny commented Jun 2, 2017

I don't know why the 3rd commit still says pending, it failed due to a compilation error.

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.

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) {
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

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

same

@kuisathaverat
Copy link
Contributor

Also I have a plan to annotate constructors, but first I have to make a clean up #91

@kuisathaverat kuisathaverat merged commit 04c816b into jenkinsci:master Jul 24, 2018
@adamkasztenny
Copy link
Contributor Author

Thank you for finishing this. I apologize for being so inactive, I wanted to make these changes but I never found the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants