Viewing old revision of objects with registered PI and modified derivates fails
Description
If a persistent identifier, e.g. a URN, has been registered for an object and the composition of the derivatives of this object has been changed, viewing old revisions, in which the now non-existing derivatives are mentioned in the object's metadata, will result in an error.
The error message is:
Exception while XSL transformation:java.lang.NullPointerException; SystemID: jar:file:/bitnami/tomcat/webapps/ROOT/WEB-INF/lib/mir-module-2020.06.2.jar!/xsl/metadata/mir-rights.xsl; Line#: 64; Column#: 54
The relevant excerpt from mir-rights.xsl is in this template:
Konkret geht die Prüfung acl:checkPermission($id,$read) problemlos durch und der Fehler tritt bei acl:checkPermission($id,$write) auf. Das Prüfen der Schreibrechte scheitert also.
Specifically, the acl:checkPermission($id,$read) check goes through without any problems and the error occurs with acl:checkPermission($id,$write). The checking of the write permissions fails.
The trigger here is probably the MIRStrategy, which, when checking derivative rights, first checks whether there are registered identifiers for the associated object and has a hasRegisteredPI(MCRObjectID) method for this purpose. For this purpose, the MCRObjectID of the associated object is determined using MCRMetadataManager#getObjectId(MCRObjectID, long, TimeUnit). This method apparently returns null if it is called with the MCRObjectID of a derivative that no longer exists (but is still mentioned in the historical metadata).
MCRPIManager.getCreatedIdentifiers(MCRObjectID, String, String) is called from MIRStrategy#hasRegisteredPI(MCRObjectID), in which the passed MCRObjectID is converted into a string, which now leads to a NullPointerException and thus to the error mentioned.
The error pattern affects the overall architecture quite deeply and I am unable to judge where the error should be corrected. All the components involved actually make understandable assumptions, but the interaction fails.
The core of the problem is probably that in old revisions of object metadata, derivatives that no longer exist may be mentioned and that other components are understandably not made to work for non-existent content. Even if you don't allow a NullPointerException to occur and abort in MCRMetadataManager#getObjectId(MCRObjectID, long, TimeUnit), the actual problem would not be solved.
If a persistent identifier, e.g. a URN, has been registered for an object and the composition of the derivatives of this object has been changed, viewing old revisions, in which the now non-existing derivatives are mentioned in the object's metadata, will result in an error.
The error message is:
Exception while XSL transformation:java.lang.NullPointerException; SystemID: jar:file:/bitnami/tomcat/webapps/ROOT/WEB-INF/lib/mir-module-2020.06.2.jar!/xsl/metadata/mir-rights.xsl; Line#: 64; Column#: 54
The relevant excerpt from
mir-rights.xsl
is in this template:<xsl:template name="check-default-rights"> <xsl:param name="id" /> <xsl:if test="acl:checkPermission($id,$read)"> <xsl:attribute name="read" /> <xsl:if test="acl:checkPermission($id,$write)"> <xsl:attribute name="write" /> <xsl:if test="acl:checkPermission($id,$delete)"> <xsl:attribute name="delete" /> </xsl:if> </xsl:if> </xsl:if> </xsl:template>
Konkret geht die Prüfung acl:checkPermission($id,$read) problemlos durch und der Fehler tritt bei acl:checkPermission($id,$write) auf. Das Prüfen der Schreibrechte scheitert also.
Specifically, the
acl:checkPermission($id,$read)
check goes through without any problems and the error occurs withacl:checkPermission($id,$write)
. The checking of the write permissions fails.The trigger here is probably the
MIRStrategy
, which, when checking derivative rights, first checks whether there are registered identifiers for the associated object and has ahasRegisteredPI(MCRObjectID)
method for this purpose. For this purpose, theMCRObjectID
of the associated object is determined usingMCRMetadataManager#getObjectId(MCRObjectID, long, TimeUnit)
. This method apparently returnsnull
if it is called with theMCRObjectID
of a derivative that no longer exists (but is still mentioned in the historical metadata).MCRPIManager.getCreatedIdentifiers(MCRObjectID, String, String)
is called fromMIRStrategy#hasRegisteredPI(MCRObjectID)
, in which the passedMCRObjectID
is converted into a string, which now leads to aNullPointerException
and thus to the error mentioned.The error pattern affects the overall architecture quite deeply and I am unable to judge where the error should be corrected. All the components involved actually make understandable assumptions, but the interaction fails.
The core of the problem is probably that in old revisions of object metadata, derivatives that no longer exist may be mentioned and that other components are understandably not made to work for non-existent content. Even if you don't allow a
NullPointerException
to occur and abort inMCRMetadataManager#getObjectId(MCRObjectID, long, TimeUnit)
, the actual problem would not be solved.