DATACOUCH-328 - Fix document expiry when using expressions

When using an expiry expression with TimeUnit.DAYS larger than 30 days
the document expiry is not correctly set.

Original pull request: #150.
This commit is contained in:
Ben Benoit
2017-07-31 14:16:12 +02:00
committed by Subhashni Balakrishnan
parent b687ff8217
commit 4908749bcd
2 changed files with 32 additions and 1 deletions

View File

@@ -109,7 +109,7 @@ public class BasicCouchbasePersistentEntity<T> extends BasicPersistentEntity<T,
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
if (annotation.expiryUnit() == TimeUnit.DAYS) {
//makes sure we won't lose resolution
cal.add(Calendar.DAY_OF_MONTH, annotation.expiry());
cal.add(Calendar.DAY_OF_MONTH, expiryValue);
} else {
//use the shift in seconds since resolution should be smaller
cal.add(Calendar.SECOND, (int) secondsShift);