Uploaded image for project: 'Fedora Repository Project'
  1. Fedora Repository Project
  2. FCREPO-1172

API-M purgeRelationship null object not working as expected

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Fedora 3.6.1
    • Fix Version/s: Fedora 3.7
    • Component/s: legacy - Fedora
    • Labels:
      None
    • Environment:
      RHEL

      Description

      According to the documentation, supplying purgeRelationship with an "object" of null should result in purging all relations which match

      http://www.fedora-commons.org/documentation/3.0/userdocs/server/webservices/apim/index.html#methods.purgeRelationship

      However, when I supply it with null, I get the following:

      INFO 2012-11-30 11:11:59.763 [ajp-bio-8009-exec-2] (DefaultManagement) Completed purgeRelationship(pid: uuid:4ecc25e9-cc02-4191-8589-ffbaecac258f, relationship: http://cdr.unc.edu/definitions/1.0/bas
      e-model.xml#isPublished, object: null, isLiteral: true, datatype: null)
      ERROR 2012-11-30 11:11:59.764 [ajp-bio-8009-exec-2] (FedoraAPIMBindingSOAPHTTPImpl) Error purging relationships
      java.lang.IllegalArgumentException: Null "newLexicalForm" parameter
      at org.jrdf.graph.AbstractLiteral.<init>(AbstractLiteral.java:109) [mulgara-core-2.1.11.jar:na]
      at org.fcrepo.common.rdf.SimpleLiteral.<init>(SimpleLiteral.java:22) [fcrepo-common-3.5.jar:na]
      at org.fcrepo.server.storage.SimpleDOWriter.createTriple(SimpleDOWriter.java:484) [fcrepo-server-3.5.jar:na]
      ...

      Setting object to not be a literal also fails, although slightly differently:

      INFO 2012-11-30 11:07:46.931 [ajp-bio-8009-exec-6] (DefaultManagement) Completed purgeRelationship(pid: uuid:4ecc25e9-cc02-4191-8589-ffbaecac258f, relationship: http://cdr.unc.edu/definitions/1.0/base-model.xml#isPublished, object: null, isLiteral: false, datatype: null)
      ERROR 2012-11-30 11:07:46.933 [ajp-bio-8009-exec-6] (FedoraAPIMBindingSOAPHTTPImpl) Error purging relationships
      java.lang.NullPointerException: null
      at java.net.URI$Parser.parse(URI.java:3004) [na:1.6.0_37]
      at java.net.URI.<init>(URI.java:577) [na:1.6.0_37]
      at org.fcrepo.server.storage.SimpleDOWriter.createTriple(SimpleDOWriter.java:489) [fcrepo-server-3.5.jar:na]
      at org.fcrepo.server.storage.SimpleDOWriter.purgeRelationship(SimpleDOWriter.java:406) [fcrepo-server-3.5.jar:na]
      at org.fcrepo.server.storage.SimpleDOWriter.purgeRelationship(SimpleDOWriter.java:391) [fcrepo-server-3.5.jar:na]
      at org.fcrepo.server.management.DefaultManagement.purgeRelationship(DefaultManagement.java:1755) [fcrepo-server-3.5.jar:na]
      ...

      Looking at the source for SimpleDOWriter, there does not seem to be any case to check for the "object" being set to null, and AbstractLiteral doesn't seem to care for that:

      https://github.com/fcrepo/fcrepo/blob/master/fcrepo-server/src/main/java/org/fcrepo/server/storage/SimpleDOWriter.java#L474

      The matching method, FilteredTripleIterator.matches(), also doesn't allow for a positive match when the searching for a null from what I can tell, so if it weren't excepting out earlier it would probably still not purge any relations:

      https://github.com/fcrepo/fcrepo/blob/master/fcrepo-server/src/main/java/org/fcrepo/server/utilities/FilteredTripleIterator.java#L99

      Our setup is with an external mulgara triple store, running 3.6.1 at the moment

        Attachments

          Activity

            People

            • Assignee:
              barmintor Benjamin Armintor
              Reporter:
              bbpennel Ben Pennell [X] (Inactive)
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: