Avoid defensive checks against java.time API

Issue: SPR-13188
This commit is contained in:
Juergen Hoeller
2016-11-22 14:55:03 +01:00
parent a0fee4657d
commit 85b0ce1ef7
5 changed files with 22 additions and 72 deletions

View File

@@ -26,6 +26,7 @@ import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.time.ZoneId;
import java.util.Collection;
import java.util.Currency;
import java.util.HashMap;
@@ -89,19 +90,6 @@ import org.springframework.util.ClassUtils;
*/
public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
private static Class<?> zoneIdClass;
static {
try {
zoneIdClass = ClassUtils.forName("java.time.ZoneId", PropertyEditorRegistrySupport.class.getClassLoader());
}
catch (ClassNotFoundException ex) {
// Java 8 ZoneId class not available
zoneIdClass = null;
}
}
private ConversionService conversionService;
private boolean defaultEditorsActive = false;
@@ -222,9 +210,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
this.defaultEditors.put(URI.class, new URIEditor());
this.defaultEditors.put(URL.class, new URLEditor());
this.defaultEditors.put(UUID.class, new UUIDEditor());
if (zoneIdClass != null) {
this.defaultEditors.put(zoneIdClass, new ZoneIdEditor());
}
this.defaultEditors.put(ZoneId.class, new ZoneIdEditor());
// Default instances of collection editors.
// Can be overridden by registering custom instances of those as custom editors.