Fix non-unique module handler identifiers (#3592)
Signed-off-by: Jan N. Klug <github@klug.nrw>pull/3595/head
parent
d7ba8ad636
commit
28ec419afd
|
@ -60,7 +60,7 @@ public abstract class BaseModuleHandlerFactory implements ModuleHandlerFactory {
|
|||
@Override
|
||||
@SuppressWarnings("null")
|
||||
public @Nullable ModuleHandler getHandler(Module module, String ruleUID) {
|
||||
String id = ruleUID + module.getId();
|
||||
String id = getModuleIdentifier(ruleUID, module.getId());
|
||||
ModuleHandler handler = handlers.get(id);
|
||||
handler = handler == null ? internalCreate(module, ruleUID) : handler;
|
||||
if (handler != null) {
|
||||
|
@ -80,8 +80,12 @@ public abstract class BaseModuleHandlerFactory implements ModuleHandlerFactory {
|
|||
|
||||
@Override
|
||||
public void ungetHandler(Module module, String ruleUID, ModuleHandler handler) {
|
||||
if (handlers.remove(ruleUID + module.getId(), handler)) {
|
||||
if (handlers.remove(getModuleIdentifier(ruleUID, module.getId()), handler)) {
|
||||
handler.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getModuleIdentifier(String ruleUid, String moduleId) {
|
||||
return ruleUid + "$" + moduleId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class CompositeModuleHandlerFactory extends BaseModuleHandlerFactory impl
|
|||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public void ungetHandler(Module module, String childModulePrefix, ModuleHandler handler) {
|
||||
ModuleHandler handlerOfModule = getHandlers().get(childModulePrefix + module.getId());
|
||||
ModuleHandler handlerOfModule = getHandlers().get(getModuleIdentifier(childModulePrefix, module.getId()));
|
||||
if (handlerOfModule instanceof AbstractCompositeModuleHandler) {
|
||||
AbstractCompositeModuleHandler<ModuleImpl, ?, ?> h = (AbstractCompositeModuleHandler<ModuleImpl, ?, ?>) handlerOfModule;
|
||||
Set<ModuleImpl> modules = h.moduleHandlerMap.keySet();
|
||||
|
|
Loading…
Reference in New Issue