Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-788

Error when creating and then destroying a newly created node all within one Session.save()

    XMLWordPrintable

Details

    • Workaround Exists
    • Hide

      Simply save the session before the newly-created nodes are deleted. This may not always be practical, but it does work.

      Show
      Simply save the session before the newly-created nodes are deleted. This may not always be practical, but it does work.
    • Low

    Description

      Destroying a node that was just created within a Session (without calling save() in between method calls) will throw a NullPointerException when using any map-based connector. For example, here is some pseudo code:

      Session session = ...
      Node existing = session.getNode(...);
      Node node1 = existing.addNode("newChild");
      node1.remove();
      session.save();

      This will produce a NPE in the connector, similar to:

      java.lang.NullPointerException
      at org.modeshape.graph.connector.base.MapTransaction.destroyNode(MapTransaction.java:199)
      at org.modeshape.graph.connector.base.MapTransaction.destroyNode(MapTransaction.java:202)
      at org.modeshape.graph.connector.base.MapTransaction.removeNode(MapTransaction.java:493)
      at org.modeshape.graph.connector.base.MapTransaction.removeNode(MapTransaction.java:1)
      at org.modeshape.graph.connector.base.Processor.process(Processor.java:361)
      at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:246)
      at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:350)
      at org.modeshape.graph.request.processor.RequestProcessor.process(RequestProcessor.java:228)
      at org.modeshape.graph.connector.base.Connection.execute(Connection.java:115)
      at org.modeshape.graph.Graph.execute(Graph.java:267)
      at org.modeshape.graph.Graph$Batch.execute(Graph.java:4599)
      ...

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            rhauch Randall Hauch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: