Polish
This commit is contained in:
@@ -89,8 +89,9 @@ class PropertiesMigrationReport {
|
||||
return deprecation.getShortReason();
|
||||
}
|
||||
if (StringUtils.hasText(deprecation.getReplacement())) {
|
||||
return String.format("Reason: Replacement key '%s' uses an incompatible "
|
||||
+ "target type", deprecation.getReplacement());
|
||||
return String.format(
|
||||
"Reason: Replacement key '%s' uses an incompatible " + "target type",
|
||||
deprecation.getReplacement());
|
||||
}
|
||||
return "none";
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class PropertiesMigrationReporter {
|
||||
}
|
||||
|
||||
private boolean isCompatibleType(String currentType, String replacementType) {
|
||||
if (replacementType == null || currentType == null) {
|
||||
if (replacementType == null || currentType == null) {
|
||||
return false;
|
||||
}
|
||||
if (replacementType.equals(currentType)) {
|
||||
@@ -126,20 +126,19 @@ class PropertiesMigrationReporter {
|
||||
}
|
||||
if (replacementType.equals(Duration.class.getName())
|
||||
&& (currentType.equals(Long.class.getName())
|
||||
|| currentType.equals(Integer.class.getName()))) {
|
||||
|| currentType.equals(Integer.class.getName()))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String detectMapValueReplacementType(String fullId) {
|
||||
int i = fullId.lastIndexOf('.');
|
||||
if (i != -1) {
|
||||
ConfigurationMetadataProperty property = this.allProperties.get(
|
||||
fullId.substring(0, i));
|
||||
int lastDot = fullId.lastIndexOf('.');
|
||||
if (lastDot != -1) {
|
||||
ConfigurationMetadataProperty property = this.allProperties
|
||||
.get(fullId.substring(0, lastDot));
|
||||
String type = property.getType();
|
||||
if (type != null
|
||||
&& type.startsWith(Map.class.getName())) {
|
||||
if (type != null && type.startsWith(Map.class.getName())) {
|
||||
int lastComma = type.lastIndexOf(',');
|
||||
if (lastComma != -1) {
|
||||
return type.substring(lastComma + 1, type.length() - 1).trim();
|
||||
|
||||
@@ -125,8 +125,7 @@ public class PropertiesMigrationReporterTests {
|
||||
content.put("test.cache-seconds", 50);
|
||||
content.put("test.time-to-live-ms", 1234L);
|
||||
content.put("test.ttl", 5678L);
|
||||
propertySources.addFirst(
|
||||
new MapPropertySource("test", content));
|
||||
propertySources.addFirst(new MapPropertySource("test", content));
|
||||
assertThat(propertySources).hasSize(2);
|
||||
String report = createWarningReport(
|
||||
loadRepository("metadata/type-conversion-metadata.json"));
|
||||
|
||||
Reference in New Issue
Block a user