SPR-6529 - DateTimeFormatAnnotationFormatterFactory calls String.isEmpty(), which exists only in JDK1.6+
This commit is contained in:
parent
93abbd0ef7
commit
231c8337d2
|
|
@ -36,6 +36,7 @@ import org.springframework.format.Parser;
|
|||
import org.springframework.format.Printer;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Formats fields annotated with the {@link DateTimeFormat} annotation.
|
||||
|
|
@ -98,7 +99,7 @@ public final class DateTimeFormatAnnotationFormatterFactory implements Annotatio
|
|||
}
|
||||
|
||||
private DateTimeFormatter configureDateTimeFormatterFrom(DateTimeFormat annotation) {
|
||||
if (!annotation.pattern().isEmpty()) {
|
||||
if (StringUtils.hasLength(annotation.pattern())) {
|
||||
return forPattern(annotation.pattern());
|
||||
}
|
||||
else if (annotation.iso() != ISO.NONE) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.springframework.format.Parser;
|
|||
import org.springframework.format.Printer;
|
||||
import org.springframework.format.annotation.NumberFormat;
|
||||
import org.springframework.format.annotation.NumberFormat.Style;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Formats fields annotated with the {@link NumberFormat} annotation.
|
||||
|
|
@ -74,7 +75,7 @@ public final class NumberFormatAnnotationFormatterFactory implements AnnotationF
|
|||
}
|
||||
|
||||
private Formatter<Number> configureFormatterFrom(NumberFormat annotation, Class<?> fieldType) {
|
||||
if (!annotation.pattern().isEmpty()) {
|
||||
if (StringUtils.hasLength(annotation.pattern())) {
|
||||
return new NumberFormatter(annotation.pattern());
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue