diff --git a/spring-cloud-config-sample/pom.xml b/spring-cloud-config-sample/pom.xml
index 3cdaa2ca..a818f9cf 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.RELEASE
+ 2.1.2.BUILD-SNAPSHOT
..
diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml
index 5de20aab..a2a053f1 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.RELEASE
+ 2.1.2.BUILD-SNAPSHOT
..
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 47c035ad..e354554b 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,8 +116,7 @@ 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;
@@ -136,13 +135,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
*/
@@ -152,6 +151,7 @@ public class GenericResourceRepository
return cleanLeadingSlash(path);
}
+
private String cleanDuplicateSlashes(String path) {
StringBuilder sb = null;
char prev = 0;
@@ -175,6 +175,7 @@ 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++) {
@@ -191,6 +192,7 @@ public class GenericResourceRepository
return (slash ? "/" : "");
}
+
/**
* Identifies invalid resource paths. By default rejects:
*
@@ -200,10 +202,9 @@ 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
@@ -219,20 +220,17 @@ 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 a5594882..51c4b0f8 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,11 +98,9 @@ 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 dd0ff43b..d9667ae1 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.RELEASE
+ 2.1.2.BUILD-SNAPSHOT
spring-cloud-starter-config
- 2.1.2.RELEASE
+ 2.1.2.BUILD-SNAPSHOT
spring-cloud-starter-config
Spring Cloud Starter
https://projects.spring.io/spring-cloud