File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
exist-core/src/main/java/org/exist/util Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,14 @@ public S get(final K key) {
229
229
private @ Nullable WeakValueReference <K , S > getOptimistic (final K key , final Holder <Boolean > written ) {
230
230
// optimistic read
231
231
final long stamp = stripesLock .tryOptimisticRead ();
232
- WeakValueReference <K , S > stripeRef = stripes .get (key );
232
+ WeakValueReference <K , S > stripeRef ;
233
+ try {
234
+ stripeRef = stripes .get (key );
235
+ } catch (final ArrayIndexOutOfBoundsException e ) {
236
+ // this can occur as we don't hold a lock, we just have a stamp for an optimistic read,
237
+ // so `stripes` might be concurrently modified
238
+ return null ;
239
+ }
233
240
if (stripeRef == null || stripeRef .get () == null ) {
234
241
final long writeStamp = stripesLock .tryConvertToWriteLock (stamp );
235
242
if (writeStamp != 0l ) {
You can’t perform that action at this time.
0 commit comments