• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ben-manes / caffeine / #5798

21 Sep 2026 05:02AM UTC coverage: 99.989% (-0.01%) from 100.0%
#5798

push

github

ben-manes
fix jcache audit triage

- jcache.294: LoadingCacheProxy.get/getAll now catch Error and drain the
  pending synchronous listener-failure list before rethrowing. Previously,
  a copier Error thrown after a read-through load's endComputation had run
  left the pending list undrained, so an unrelated subsequent same-thread
  operation could inherit the prior operation's listener failure.

- jcache.115: CacheProxy.processorFailure and
  GuardedCacheEntryEventFilter.evaluate now restore the thread's interrupt
  status on InterruptedException, extending the existing loader/writer/
  expiry-policy convention to the processor and filter boundaries.
  Documented in jcache-adapter.md.

- jcache.229: Documented in jsr107-conformance.md that a listener Error
  skips the statistics-recording leg (accounting-only consequence of the
  existing 'do not broaden to Throwable' rule); no code change.

- jcache.171: TypesafeConfigurator.addMaximum now rejects policy.maximum.size
  and policy.maximum.weight set together with an IllegalArgumentException
  naming the cache, instead of deferring to Caffeine's builder ISE at
  getCache time with no cache-name context.

- jcache.172: resolveConfig's file: branch now catches IllegalArgumentException
  from new File(uri) and rethrows ConfigException.BadPath, mirroring the
  jar: branch's existing MalformedURLException handling. getDurationFor now
  checks for a negative Duration and throws ConfigException.BadValue.
  Both are wrapped into CacheException by TypesafeConfigurator.from, as
  configuration failures already are.

4771 of 4782 branches covered (99.77%)

50 of 51 new or added lines in 8 files covered. (98.04%)

9241 of 9242 relevant lines covered (99.99%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/GuardedCacheEntryEventFilter.java
1
/*
2
 * Copyright 2015 Ben Manes. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.github.benmanes.caffeine.jcache.event;
17

18
import static java.util.Objects.requireNonNull;
19

20
import java.lang.System.Logger;
21
import java.lang.System.Logger.Level;
22
import java.util.Objects;
23

24
import javax.cache.event.CacheEntryEvent;
25
import javax.cache.event.CacheEntryEventFilter;
26

27
import org.jspecify.annotations.Nullable;
28

29
/**
30
 * A {@link CacheEntryEventFilter} implementation that suppresses and logs any exception thrown by
31
 * the delegate <code>filter</code>.
32
 *
33
 * @author ben.manes@gmail.com (Ben Manes)
34
 */
35
final class GuardedCacheEntryEventFilter<K, V> implements CacheEntryEventFilter<K, V> {
36
  static final Logger logger = System.getLogger(GuardedCacheEntryEventFilter.class.getName());
1✔
37

38
  private final CacheEntryEventFilter<? super K, ? super V> delegate;
39

40
  public GuardedCacheEntryEventFilter(CacheEntryEventFilter<? super K, ? super V> delegate) {
1✔
41
    this.delegate = requireNonNull(delegate);
1✔
42
  }
1✔
43

44
  @Override
45
  @SuppressWarnings("PMD.AvoidInstanceofChecksInCatchClause")
46
  public boolean evaluate(CacheEntryEvent<? extends K, ? extends V> event) {
47
    try {
48
      return delegate.evaluate(event);
1✔
49
    } catch (RuntimeException e) {
1✔
50
      logger.log(Level.WARNING, "", e);
1✔
51
      return false;
1✔
52
    } catch (Throwable t) {
1✔
53
      if (t instanceof InterruptedException) {
1!
NEW
54
        Thread.currentThread().interrupt();
×
55
      }
56
      logger.log(Level.ERROR, "", t);
1✔
57
      return false;
1✔
58
    }
59
  }
60

61
  @Override
62
  public boolean equals(@Nullable Object o) {
63
    if (o == this) {
1✔
64
      return true;
1✔
65
    } else if (!(o instanceof GuardedCacheEntryEventFilter<?, ?>)) {
1✔
66
      return false;
1✔
67
    }
68
    var other = (GuardedCacheEntryEventFilter<?, ?>) o;
1✔
69
    return Objects.equals(delegate, other.delegate);
1✔
70
  }
71

72
  @Override
73
  public int hashCode() {
74
    return delegate.hashCode();
1✔
75
  }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc