From f72c04286b40b53cd155b72ee65f1ae5e135a64f Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Sun, 1 Oct 2017 17:48:48 +0200 Subject: [PATCH] Remove redundant toString() calls Closes gh-10467 --- .../context/properties/bind/validation/ValidationErrors.java | 2 +- .../context/properties/source/ConfigurationPropertyName.java | 4 ++-- .../properties/source/SystemEnvironmentPropertyMapper.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationErrors.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationErrors.java index ba0e921327..bd71752caf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationErrors.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationErrors.java @@ -96,7 +96,7 @@ public class ValidationErrors implements Iterable { private boolean isForError(ConfigurationPropertyName name, ConfigurationPropertyName boundPropertyName, FieldError error) { return name.isParentOf(boundPropertyName) - && boundPropertyName.getLastElement(Form.UNIFORM).toString() + && boundPropertyName.getLastElement(Form.UNIFORM) .equalsIgnoreCase(error.getField()); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index f621665692..7b8ac56812 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -283,8 +283,8 @@ public final class ConfigurationPropertyName } if (indexed1 && indexed2) { try { - long v1 = Long.parseLong(e1.toString()); - long v2 = Long.parseLong(e2.toString()); + long v1 = Long.parseLong(e1); + long v2 = Long.parseLong(e2); return Long.compare(v1, v2); } catch (NumberFormatException ex) { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java index 1dfe8fbbe0..0873c2e3d3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java @@ -110,7 +110,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { StringBuilder result = new StringBuilder(); for (int i = 0; i < numberOfElements; i++) { result.append(result.length() == 0 ? "" : "_"); - result.append(name.getElement(i, Form.UNIFORM).toString().toUpperCase()); + result.append(name.getElement(i, Form.UNIFORM).toUpperCase()); } return result.toString(); }