[Fix] Fixed NPE in DateRange.toString()

This commit is contained in:
Robert von Burg 2017-05-02 11:16:59 +02:00
parent ae0fba00ca
commit b2bbfad26e
1 changed files with 7 additions and 2 deletions

View File

@ -127,7 +127,12 @@ public class DateRange {
@Override
public String toString() {
ISO8601FormatFactory df = ISO8601FormatFactory.getInstance();
return df.formatDate(this.fromDate) + (this.fromInclusive ? " (inc)" : " (exc)") + " - "
+ df.formatDate(this.toDate) + (this.toInclusive ? " (inc)" : " (exc)");
StringBuilder sb = new StringBuilder();
sb.append(this.fromDate == null ? "-" : df.formatDate(this.fromDate));
sb.append((this.fromInclusive ? " (inc)" : " (exc)"));
sb.append(" - ");
sb.append(this.toDate == null ? "-" : df.formatDate(this.toDate));
sb.append((this.toInclusive ? " (inc)" : " (exc)"));
return sb.toString();
}
}