Skip to content

ReplicateConsumer classes break since DSpace 10 — Event.getDetail() no longer returns String #93

Description

@Micheleboychuk

Starting with DSpace 10, the Replication Task Suite event consumers fail at runtime with a NoSuchMethodError whenever a Community/Collection/Item event is dispatched (e.g. installing or modifying an item). This makes the automatic replication consumer unusable on DSpace 10.

Root cause
DSpace 10 changed the org.dspace.event.Event API (PR DSpace/DSpace#11072 – "REST: Audit Trail feature", milestone 10.0). The event "detail" is now modelled by a new org.dspace.event.EventDetail type:

  • public EventDetail getDetail() now returns an EventDetail (see Event.java, and getDetailList()).
  • The previous public String getDetail() no longer exists.

The consumers in this add-on still call Event.getDetail() expecting a String (the object handle). Since that method signature was removed, the JVM
throws NoSuchMethodError.

Affected classes:

  • org.dspace.ctask.replicate.BagItReplicateConsumer (e.g. String id = event.getDetail(); in consume(...))
  • org.dspace.ctask.replicate.METSReplicateConsumer (several usages: CREATE/INSTALL, REMOVE/DELETE, ADD, and event.getDetail().equals(id))

To Reproduce:

  1. Deploy the Replication Task Suite on a DSpace 10 instance.

  2. Enable the replicate consumer in dspace.cfg:
    event.consumer.replicate.class = org.dspace.ctask.replicate.BagItReplicateConsumer
    event.consumer.replicate.filters = Community|Collection|Item+Install|Modify|Modify_Metadata|Delete
    event.dispatcher.default.consumers = ..., replicate

  3. Create or modify an item (e.g. a metadata PATCH via REST).

  4. The commit fails with the NoSuchMethodError above.

Expected behavior
The consumers should obtain the object identifier via the new EventDetail API and work on DSpace 10.

Proposed fix
Replace the event.getDetail() (String) usages with the new API, e.g. extract the underlying value from the EventDetail:

  EventDetail detail = event.getDetail();
  String id = (detail != null && detail.getDetailObject() != null)
          ? detail.getDetailObject().toString() : null;

This needs to be applied to both BagItReplicateConsumer and METSReplicateConsumer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions