When the result of a calculatePreciseDuration() is passed on to a format() a NullPointerException will be thrown.
This happens due to not being able to find the corresponding TimeUnit (eg.: Month) in the map named "units" resulting in a null from getFormat(TimeUnit unit).
This specifically happens in this line:
return units.get(unit);
If the unit is a Month (as TimeUnit), this will not find Month (as TimeUnit) in units. Eventually because they're not exactly the same and have different properties.
The function for context:
public TimeFormat getFormat(TimeUnit unit)
{
if (unit != null && units.get(unit) != null) {
return units.get(unit);
}
return null;
}
When the result of a calculatePreciseDuration() is passed on to a format() a NullPointerException will be thrown. This happens due to not being able to find the corresponding TimeUnit (eg.: Month) in the map named "units" resulting in a null from getFormat(TimeUnit unit).
This specifically happens in this line:
If the unit is a Month (as TimeUnit), this will not find Month (as TimeUnit) in units. Eventually because they're not exactly the same and have different properties.
The function for context: