Browse Source

Polish

See gh-20192
pull/20206/head
zhangt2333 6 years ago committed by Stephane Nicoll
parent
commit
e2d87a89d0
  1. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ApiVersion.java
  2. 5
      spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java
  3. 10
      spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java
  4. 5
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java
  5. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/ClassPathIndexFile.java

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ApiVersion.java

@ -70,7 +70,7 @@ public enum ApiVersion { @@ -70,7 +70,7 @@ public enum ApiVersion {
private static ApiVersion forType(String type) {
if (type.startsWith(MEDIA_TYPE_PREFIX)) {
type = type.substring(MEDIA_TYPE_PREFIX.length());
int suffixIndex = type.indexOf("+");
int suffixIndex = type.indexOf('+');
type = (suffixIndex != -1) ? type.substring(0, suffixIndex) : type;
try {
return valueOf(type.toUpperCase());

5
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java

@ -74,10 +74,7 @@ class ProjectGenerator { @@ -74,10 +74,7 @@ class ProjectGenerator {
return true;
}
// explicit name hasn't been provided for an archive and there is no extension
if (isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".")) {
return true;
}
return false;
return isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".");
}
private boolean isZipArchive(ProjectGenerationResponse entity) {

10
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java

@ -140,10 +140,7 @@ public class DependencyCustomizer { @@ -140,10 +140,7 @@ public class DependencyCustomizer {
protected boolean canAdd() {
for (String path : paths) {
try {
if (DependencyCustomizer.this.loader.getResource(path) == null) {
return false;
}
return true;
return DependencyCustomizer.this.loader.getResource(path) != null;
}
catch (Exception ex) {
// swallow exception and continue
@ -166,10 +163,7 @@ public class DependencyCustomizer { @@ -166,10 +163,7 @@ public class DependencyCustomizer {
protected boolean canAdd() {
for (String path : paths) {
try {
if (DependencyCustomizer.this.loader.getResource(path) != null) {
return true;
}
return false;
return DependencyCustomizer.this.loader.getResource(path) != null;
}
catch (Exception ex) {
// swallow exception and continue

5
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java

@ -381,10 +381,7 @@ public abstract class MainClassFinder { @@ -381,10 +381,7 @@ public abstract class MainClassFinder {
return false;
}
MainClass other = (MainClass) obj;
if (!this.name.equals(other.name)) {
return false;
}
return true;
return this.name.equals(other.name);
}
@Override

2
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/ClassPathIndexFile.java

@ -54,7 +54,7 @@ final class ClassPathIndexFile { @@ -54,7 +54,7 @@ final class ClassPathIndexFile {
}
private String getFolder(String name) {
int lastSlash = name.lastIndexOf("/");
int lastSlash = name.lastIndexOf('/');
return (lastSlash != -1) ? name.substring(0, lastSlash) : null;
}

Loading…
Cancel
Save