jsr107 / jsr107spec

JSR107 Cache Specification
Apache License 2.0
413 stars 164 forks source link

ExpiryPolicy exception handling should not mandate error hiding #354

Closed cruftex closed 7 years ago

cruftex commented 8 years ago

The JavaDoc on ExpiryPolicy.getExpiryForCreation() says:

Should an exception occur while determining the Duration, an implementation specific default {@link Duration} will be used.

There is no TCK test for it.

What the Spec demands is, that exceptions are swallowed. That is not a good idea. https://en.wikipedia.org/wiki/Error_hiding

Suggestion:

Remove the sentence. Each implementation should be able to handle this in the best way.

gregrluck commented 7 years ago

All implementations have default durations. e.g. Ehcache was 30 minutes. So it should be a simple thing for an implementation to return a default if something goes wrong. We are essentially saying that each implementation has a constant which is used if nothing else gets calculated.

I agree with you about not swallowing exceptions. But this is a simple default configuration issue.

Note this could happen if an implementation has an invalid config. It should fail fast and be reporting the issue.

So not fixing this one.