diff --git a/changelog.html b/changelog.html
index 816c119..197495e 100644
--- a/changelog.html
+++ b/changelog.html
@@ -44,6 +44,7 @@
HTTP File Upload Plugin Changelog
1.4.1 -- (tbd)
- Updated Ukrainian (uk_UA) translation, by Vladislav Savchuk (Bruhmozavr)
+ - Issue #43: ClassCastExceptions after reloading plugin in a cluster.
1.4.0 -- (January 19, 2024)
diff --git a/src/java/org/igniterealtime/openfire/plugins/httpfileupload/OpenfireSlotProvider.java b/src/java/org/igniterealtime/openfire/plugins/httpfileupload/OpenfireSlotProvider.java
index dff935b..abbb767 100644
--- a/src/java/org/igniterealtime/openfire/plugins/httpfileupload/OpenfireSlotProvider.java
+++ b/src/java/org/igniterealtime/openfire/plugins/httpfileupload/OpenfireSlotProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2022 Ignite Realtime Foundation. All rights reserved.
+ * Copyright (c) 2017-2024 Ignite Realtime Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,10 +29,11 @@
public class OpenfireSlotProvider implements SlotProvider
{
- private final Cache slotsCache;
+ // Use string-representation of SecureUniqueId as cache key, as the interface cannot be processed by JAXB.
+ private final Cache slotsCache;
public OpenfireSlotProvider() {
- slotsCache = CacheFactory.createCache("HTTP File Upload Slots");
+ slotsCache = CacheFactory.createSerializingCache("HTTP File Upload Slots", String.class, Slot.class);
// Unless there is specific configuration for this cache, default the max lifetime of entries in this cache to something that's fairly short.
if (null == JiveGlobals.getProperty("cache." + slotsCache.getName().replaceAll(" ", "") + ".maxLifetime")) {
@@ -43,10 +44,10 @@ public OpenfireSlotProvider() {
@Override
public void create(@Nonnull final Slot slot)
{
- final Lock lock = slotsCache.getLock(slot.getUuid());
+ final Lock lock = slotsCache.getLock(slot.getUuid().toString());
lock.lock();
try {
- slotsCache.put( slot.getUuid(), slot );
+ slotsCache.put( slot.getUuid().toString(), slot );
} finally {
lock.unlock();
}
@@ -56,10 +57,10 @@ public void create(@Nonnull final Slot slot)
@Override
public Slot consume(@Nonnull final SecureUniqueId slotId)
{
- final Lock lock = slotsCache.getLock(slotId);
+ final Lock lock = slotsCache.getLock(slotId.toString());
lock.lock();
try {
- return slotsCache.remove(slotId);
+ return slotsCache.remove(slotId.toString());
} finally {
lock.unlock();
}