From b66b97aa7ba597e9a671399075b981162214c6ff Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Mon, 10 Sep 2018 12:36:35 -0500 Subject: [PATCH] Don't URL encode username and password fields for Oracle database. --- .../CloudFoundryConnectorOracleServiceTest.java | 15 --------------- .../cloud/service/common/OracleServiceInfo.java | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/spring-cloud-cloudfoundry-connector/src/test/java/org/springframework/cloud/cloudfoundry/CloudFoundryConnectorOracleServiceTest.java b/spring-cloud-cloudfoundry-connector/src/test/java/org/springframework/cloud/cloudfoundry/CloudFoundryConnectorOracleServiceTest.java index e96881ea..6d555095 100644 --- a/spring-cloud-cloudfoundry-connector/src/test/java/org/springframework/cloud/cloudfoundry/CloudFoundryConnectorOracleServiceTest.java +++ b/spring-cloud-cloudfoundry-connector/src/test/java/org/springframework/cloud/cloudfoundry/CloudFoundryConnectorOracleServiceTest.java @@ -33,21 +33,6 @@ public void oracleServiceCreation() { assertUriBasedServiceInfoFields(info, ORACLE_SCHEME, hostname, port, username, password, INSTANCE_NAME); } - @Test - public void oracleServiceCreationWithSpecialChars() { - String userWithSpecialChars = "u%u:u+"; - String passwordWithSpecialChars = "p%p:p+"; - when(mockEnvironment.getEnvValue("VCAP_SERVICES")) - .thenReturn(getServicesPayload( - getUserProvidedServicePayload(SERVICE_NAME, hostname, port, userWithSpecialChars, passwordWithSpecialChars, INSTANCE_NAME, ORACLE_SCHEME + ":"))); - List serviceInfos = testCloudConnector.getServiceInfos(); - - ServiceInfo info = getServiceInfo(serviceInfos, SERVICE_NAME); - assertServiceFoundOfType(info, OracleServiceInfo.class); - assertEquals(getJdbcUrl(hostname, port, INSTANCE_NAME, userWithSpecialChars, passwordWithSpecialChars), ((RelationalServiceInfo)info).getJdbcUrl()); - assertUriBasedServiceInfoFields(info, ORACLE_SCHEME, hostname, port, userWithSpecialChars, passwordWithSpecialChars, INSTANCE_NAME); - } - @Test public void oracleServiceCreationWithNoUri() { when(mockEnvironment.getEnvValue("VCAP_SERVICES")) diff --git a/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/OracleServiceInfo.java b/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/OracleServiceInfo.java index be5782f2..71827b16 100644 --- a/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/OracleServiceInfo.java +++ b/spring-cloud-core/src/main/java/org/springframework/cloud/service/common/OracleServiceInfo.java @@ -18,7 +18,7 @@ public OracleServiceInfo(String id, String url, String jdbcUrl) { @Override protected String buildJdbcUrl() { return String.format("jdbc:%s:thin:%s/%s@%s:%d/%s", - jdbcUrlDatabaseType, UriInfo.urlEncode(getUserName()), UriInfo.urlEncode(getPassword()), + jdbcUrlDatabaseType, getUserName(), getPassword(), getHost(), getPort(), getPath()); } }