Polishing

This commit is contained in:
Juergen Hoeller
2015-12-02 15:35:42 +01:00
parent 747863d503
commit a9e5e9ecc8
4 changed files with 21 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,11 +100,12 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
@Override
public String addVersion(String path, String version) {
if(path.startsWith(".")) {
if (path.startsWith(".")) {
return path;
}
else {
return (this.prefix.endsWith("/") || path.startsWith("/") ? this.prefix + path : this.prefix + "/" + path);
return (this.prefix.endsWith("/") || path.startsWith("/") ?
this.prefix + path : this.prefix + "/" + path);
}
}
}
@@ -123,7 +124,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
Matcher matcher = pattern.matcher(requestPath);
if (matcher.find()) {
String match = matcher.group(1);
return match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match;
return (match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match);
}
else {
return null;
@@ -139,7 +140,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
public String addVersion(String requestPath, String version) {
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
String extension = StringUtils.getFilenameExtension(requestPath);
return baseFilename + "-" + version + "." + extension;
return (baseFilename + "-" + version + "." + extension);
}
}