I'm trying to write a Documentum DFC executable that will check out an object from a given docbase. I've been able to establish a session with the docbase, retrieve the object to be checked out and verify that it is not already checked out. But when I try to add the object to the DfCheckoutOperation in the following code
IDfCheckoutOperation checkoutOperation = new DfCheckoutOperation();
checkoutOperation.add(objToCheckOut);
I get a NullPointerException; here's the stacktrace:
Exception in thread "main" java.lang.NullPointerException
at com.documentum.operations.impl.OperationNodeTreeBuilder.populate(OperationNodeTreeBuilder.java:549)
at com.documentum.operations.impl.OperationNodeTreeBuilder.add(OperationNodeTreeBuilder.java:65)
at com.documentum.operations.DfOperation.add(DfOperation.java:324)
What am I doing wrong? Note: Neither object reference is null, so this is not the typical NullPointerException scenario, i.e., this is not a duplicate question
The problem I ran into stemmed from me utilizing old sample code that is now obsolete. The example I found online was apparently pre-Documentum-6.x, so where I was instantiating the DfCheckoutOperation via a new()
method call, I should have been using the following code instead:
IDfClientX clientX = new DfClientX();
IDfCheckoutOperation checkoutOperation = clientX.getCheckoutOperation();
(The version of Documentum I'm using is 6.7) I figured out my problem by looking around the EMC Community forum and finding a post with a similar operations issue.
Note that the way I was instantiating my DfCheckoutOperation object was not generating a null reference; the NPE I experienced stemmed from some other object within the implementation of the add()
method for the 6.x release. Also note that the example of the checkout operation in the whitepaper cited in the comments is up-to-date, so use that to avoid the situation I found myself in.