Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,9 +30,9 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class StringToBooleanConverter implements Converter<String, Boolean> {
|
||||
|
||||
private static final Set<String> trueValues = new HashSet<String>(4);
|
||||
private static final Set<String> trueValues = new HashSet<String>(8);
|
||||
|
||||
private static final Set<String> falseValues = new HashSet<String>(4);
|
||||
private static final Set<String> falseValues = new HashSet<String>(8);
|
||||
|
||||
static {
|
||||
trueValues.add("true");
|
||||
@@ -46,10 +46,11 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
|
||||
falseValues.add("0");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean convert(String source) {
|
||||
String value = source.trim();
|
||||
if ("".equals(value)) {
|
||||
if (value.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
value = value.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user