Browse Source

Remove the second parameter of substring() if possible

Closes gh-5720
pull/5745/head
Johnny Lim 10 years ago committed by Stephane Nicoll
parent
commit
b914b4aa52
  1. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java
  2. 3
      spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java
  3. 2
      spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java
  4. 2
      spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java
  5. 2
      spring-boot-tools/spring-boot-maven-plugin/src/it/run-profiles-fork/src/main/java/org/test/SampleApplication.java
  6. 2
      spring-boot-tools/spring-boot-maven-plugin/src/it/run-profiles/src/main/java/org/test/SampleApplication.java
  7. 2
      spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java

2
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java

@ -76,7 +76,7 @@ public class ProjectInfoAutoConfiguration { @@ -76,7 +76,7 @@ public class ProjectInfoAutoConfiguration {
Properties target = new Properties();
for (String key : source.stringPropertyNames()) {
if (key.startsWith(p)) {
target.put(key.substring(p.length(), key.length()), source.get(key));
target.put(key.substring(p.length()), source.get(key));
}
}
return target;

3
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java

@ -250,8 +250,7 @@ class InitializrService { @@ -250,8 +250,7 @@ class InitializrService {
String value = header.getValue();
int start = value.indexOf(FILENAME_HEADER_PREFIX);
if (start != -1) {
value = value.substring(start + FILENAME_HEADER_PREFIX.length(),
value.length());
value = value.substring(start + FILENAME_HEADER_PREFIX.length());
int end = value.indexOf("\"");
if (end != -1) {
return value.substring(0, end);

2
spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java

@ -81,7 +81,7 @@ class RawConfigurationMetadata { @@ -81,7 +81,7 @@ class RawConfigurationMetadata {
String dottedPrefix = groupId + ".";
String id = item.getId();
if (hasLength(groupId) && id.startsWith(dottedPrefix)) {
String name = id.substring(dottedPrefix.length(), id.length());
String name = id.substring(dottedPrefix.length());
item.setName(name);
}
}

2
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java

@ -54,7 +54,7 @@ public class ItemHint implements Comparable<ItemHint> { @@ -54,7 +54,7 @@ public class ItemHint implements Comparable<ItemHint> {
int dot = name.lastIndexOf('.');
if (dot != -1) {
String prefix = name.substring(0, dot);
String originalName = name.substring(dot, name.length());
String originalName = name.substring(dot);
return prefix + ConfigurationMetadata.toDashedCase(originalName);
}
return ConfigurationMetadata.toDashedCase(name);

2
spring-boot-tools/spring-boot-maven-plugin/src/it/run-profiles-fork/src/main/java/org/test/SampleApplication.java

@ -29,7 +29,7 @@ public class SampleApplication { @@ -29,7 +29,7 @@ public class SampleApplication {
throw new IllegalArgumentException("Invalid argument " + argument);
}
int index = args[0].indexOf("=");
String profile = argument.substring(index + 1, argument.length());
String profile = argument.substring(index + 1);
System.out.println("I haz been run with profile(s) '" + profile + "'");
}

2
spring-boot-tools/spring-boot-maven-plugin/src/it/run-profiles/src/main/java/org/test/SampleApplication.java

@ -29,7 +29,7 @@ public class SampleApplication { @@ -29,7 +29,7 @@ public class SampleApplication {
throw new IllegalArgumentException("Invalid argument " + argument);
}
int index = args[0].indexOf("=");
String profile = argument.substring(index + 1, argument.length());
String profile = argument.substring(index + 1);
System.out.println("I haz been run with profile(s) '" + profile + "'");
}

2
spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java

@ -464,7 +464,7 @@ public class ConfigFileApplicationListenerTests { @@ -464,7 +464,7 @@ public class ConfigFileApplicationListenerTests {
assertThat(index)
.as("Loading profile '" + profile + "' not found in '" + log + "'")
.isNotEqualTo(-1);
log = log.substring(index + line.length(), log.length());
log = log.substring(index + line.length());
}
}

Loading…
Cancel
Save