Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,25 @@ public UrlConnectionHttpClient(String username, String password, String userAgen
IMediaType requestMediaType, String acceptedMediaType, String version, String authKey, String authIV) {
this.username = username;
this.password = password;
this.userAgent = userAgent;
this.userAgent = setupUserAgent(authKey, authIV, userAgent);
this.sslChecks = sslChecks;
this.requestMediaType = requestMediaType;
this.acceptedMediaType = acceptedMediaType;
this.authKey = authKey;
this.authIV = authIV;
}

private String setupUserAgent(String authKey, String authIV, String userAgent) {
if (!StringUtils.isEmpty(authKey)) {
if (userAgent == null) {
userAgent = "OpenShift";
} else if (!userAgent.startsWith("OpenShift")) {
userAgent = "OpenShift-" + userAgent;
}
}
return userAgent;
}

public void setAcceptedMediaType(String acceptedMediaType) {
this.acceptedMediaType = acceptedMediaType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ public UrlConnectionHttpClientBuilder setVersion(String version) {
}

public IHttpClient client() {
if (authKey != null && authKey.trim().length() > 0) {
if (userAgent == null) {
userAgent = "OpenShift";
} else if (!userAgent.startsWith("OpenShift")) {
userAgent = "OpenShift-" + userAgent;
}
}
return new UrlConnectionHttpClient(username, password, userAgent,
sslChecks, requestMediaType, acceptedMediaType, version,
authKey, authIV);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static String toLowerCase(Enum<?> aEnum) {

public static boolean isEmpty(String string) {
return string == null
|| string.isEmpty();
|| string.trim().isEmpty();
}

}