diff --git a/spring-cloud-config-sample/pom.xml b/spring-cloud-config-sample/pom.xml
index a818f9cf..3cdaa2ca 100644
--- a/spring-cloud-config-sample/pom.xml
+++ b/spring-cloud-config-sample/pom.xml
@@ -13,7 +13,7 @@
org.springframework.cloud
spring-cloud-config
- 2.1.2.BUILD-SNAPSHOT
+ 2.1.2.RELEASE
..
diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml
index a2a053f1..5de20aab 100644
--- a/spring-cloud-config-server/pom.xml
+++ b/spring-cloud-config-server/pom.xml
@@ -13,7 +13,7 @@
org.springframework.cloud
spring-cloud-config
- 2.1.2.BUILD-SNAPSHOT
+ 2.1.2.RELEASE
..
diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java
index e354554b..47c035ad 100644
--- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java
+++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/GenericResourceRepository.java
@@ -64,7 +64,7 @@ public class GenericResourceRepository
String[] locations = this.service.getLocations(application, profile, label)
.getLocations();
try {
- for (int i = locations.length; i-- > 0; ) {
+ for (int i = locations.length; i-- > 0;) {
String location = locations[i];
for (String local : getProfilePaths(profile, path)) {
if (!isInvalidPath(local) && !isInvalidEncodedPath(local)) {
@@ -116,7 +116,8 @@ public class GenericResourceRepository
private boolean isInvalidEncodedPath(String path) {
if (path.contains("%")) {
try {
- // Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars
+ // Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8
+ // chars
String decodedPath = URLDecoder.decode(path, "UTF-8");
if (isInvalidPath(decodedPath)) {
return true;
@@ -135,13 +136,13 @@ public class GenericResourceRepository
/**
* Process the given resource path.
- * The default implementation replaces:
+ *
+ * The default implementation replaces:
*
* - Backslash with forward slash.
*
- Duplicate occurrences of slash with a single slash.
- *
- Any combination of leading slash and control characters (00-1F and 7F)
- * with a single "/" or "". For example {@code " / // foo/bar"}
- * becomes {@code "/foo/bar"}.
+ *
- Any combination of leading slash and control characters (00-1F and 7F) with a
+ * single "/" or "". For example {@code " / // foo/bar"} becomes {@code "/foo/bar"}.
*
* @since 3.2.12
*/
@@ -151,7 +152,6 @@ public class GenericResourceRepository
return cleanLeadingSlash(path);
}
-
private String cleanDuplicateSlashes(String path) {
StringBuilder sb = null;
char prev = 0;
@@ -175,7 +175,6 @@ public class GenericResourceRepository
return sb != null ? sb.toString() : path;
}
-
private String cleanLeadingSlash(String path) {
boolean slash = false;
for (int i = 0; i < path.length(); i++) {
@@ -192,7 +191,6 @@ public class GenericResourceRepository
return (slash ? "/" : "");
}
-
/**
* Identifies invalid resource paths. By default rejects:
*
@@ -202,9 +200,10 @@ public class GenericResourceRepository
* - Paths that represent a {@link org.springframework.util.ResourceUtils#isUrl
* valid URL} or would represent one after the leading slash is removed.
*
- * Note: this method assumes that leading, duplicate '/'
- * or control characters (e.g. white space) have been trimmed so that the
- * path starts predictably with a single '/' or does not have one.
+ *
+ * Note: this method assumes that leading, duplicate '/' or control
+ * characters (e.g. white space) have been trimmed so that the path starts predictably
+ * with a single '/' or does not have one.
* @param path the path to validate
* @return {@code true} if the path is invalid, {@code false} otherwise
* @since 3.0.6
@@ -220,17 +219,20 @@ public class GenericResourceRepository
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
if (logger.isWarnEnabled()) {
- logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
+ logger.warn(
+ "Path represents URL or has \"url:\" prefix: [" + path + "]");
}
return true;
}
}
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
if (logger.isWarnEnabled()) {
- logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
+ logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: ["
+ + path + "]");
}
return true;
}
return false;
}
+
}
diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java
index 51c4b0f8..a5594882 100644
--- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java
+++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/GenericResourceRepositoryTests.java
@@ -98,9 +98,11 @@ public class GenericResourceRepositoryTests {
@Test
public void invalidPath() {
this.exception.expect(NoSuchResourceException.class);
- this.nativeRepository.setSearchLocations("file:./src/test/resources/test/{profile}");
+ this.nativeRepository
+ .setSearchLocations("file:./src/test/resources/test/{profile}");
this.repository.findOne("blah", "local", "master", "..%2F..%2Fdata-jdbc.sql");
- this.output.expect(containsString("Path contains \"../\" after call to StringUtils#cleanPath"));
+ this.output.expect(containsString(
+ "Path contains \"../\" after call to StringUtils#cleanPath"));
}
}
diff --git a/spring-cloud-starter-config/pom.xml b/spring-cloud-starter-config/pom.xml
index d9667ae1..dd0ff43b 100644
--- a/spring-cloud-starter-config/pom.xml
+++ b/spring-cloud-starter-config/pom.xml
@@ -6,10 +6,10 @@
org.springframework.cloud
spring-cloud-config
- 2.1.2.BUILD-SNAPSHOT
+ 2.1.2.RELEASE
spring-cloud-starter-config
- 2.1.2.BUILD-SNAPSHOT
+ 2.1.2.RELEASE
spring-cloud-starter-config
Spring Cloud Starter
https://projects.spring.io/spring-cloud