* fail as expected when using undefined {age}

This commit is contained in:
Reinhard Pointner 2014-10-25 09:44:33 +00:00
parent 6abb001249
commit 4ea21cd47f
1 changed files with 5 additions and 1 deletions

View File

@ -181,7 +181,11 @@ public class MediaBindingBean {
@Define("age")
public Number getAgeInDays() {
return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - getReleaseDate().getTimeStamp());
SimpleDate releaseDate = getReleaseDate();
if (releaseDate != null) {
return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - releaseDate.getTimeStamp());
}
return null;
}
@Define("startdate")