Skip to content

Commit

Permalink
Merge pull request #249 from pidoubleyou/master
Browse files Browse the repository at this point in the history
Fix encoding of DB2 credentials
  • Loading branch information
scottfrederick authored Dec 14, 2018
2 parents a0bf3f1 + a8eef2b commit fa18756
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.cloud.service.common.DB2ServiceInfo;
import org.springframework.cloud.service.common.MysqlServiceInfo;
import org.springframework.cloud.service.common.RelationalServiceInfo;
import org.springframework.cloud.util.UriInfo;

import java.util.List;

Expand Down Expand Up @@ -85,11 +84,11 @@ protected String getDB2ServicePayloadWithJdbcurl(String serviceName, String host

protected String getJdbcUrl(String scheme, String name) {
return String.format("%s%s://%s:%d/%s:user=%s;password=%s;", JDBC_PREFIX, scheme, hostname, port, name,
UriInfo.urlEncode(username), UriInfo.urlEncode(password));
username, password);
}

private String getJdbcUrl(String scheme, String hostname, int port, String name, String user, String password) {
return String.format("%s%s://%s:%d/%s:user=%s;password=%s;", JDBC_PREFIX, scheme, hostname, port, name,
UriInfo.urlEncode(user), UriInfo.urlEncode(password));
user, password);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.springframework.cloud.service.common;

import org.springframework.cloud.service.ServiceInfo;
import org.springframework.cloud.util.UriInfo;

@ServiceInfo.ServiceLabel("db2")
public class DB2ServiceInfo extends RelationalServiceInfo {
Expand All @@ -19,6 +18,6 @@ public DB2ServiceInfo(String id, String url, String jdbcUrl) {
protected String buildJdbcUrl() {
return String.format("jdbc:%s://%s:%d/%s:user=%s;password=%s;",
jdbcUrlDatabaseType,
getHost(), getPort(), getPath(), UriInfo.urlEncode(getUserName()), UriInfo.urlEncode(getPassword()));
getHost(), getPort(), getPath(), getUserName(), getPassword());
}
}

0 comments on commit fa18756

Please sign in to comment.