mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-21 05:09:13 +00:00
SPR-6529 - DateTimeFormatAnnotationFormatterFactory calls String.isEmpty(), which exists only in JDK1.6+
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2592 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+2
-1
@@ -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) {
|
||||
|
||||
+2
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user