Browse Source

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
pull/1/head
Arjen Poutsma 16 years ago
parent
commit
7a6fb39dd4
  1. 3
      org.springframework.context/src/main/java/org/springframework/format/datetime/joda/DateTimeFormatAnnotationFormatterFactory.java
  2. 3
      org.springframework.context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java

3
org.springframework.context/src/main/java/org/springframework/format/datetime/joda/DateTimeFormatAnnotationFormatterFactory.java

@ -36,6 +36,7 @@ import org.springframework.format.Parser; @@ -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 @@ -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) {

3
org.springframework.context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java

@ -28,6 +28,7 @@ import org.springframework.format.Parser; @@ -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 @@ -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…
Cancel
Save