0

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

Sheldon R.
  • 432
  • 1
  • 6
  • 25
  • This isn't a generic NullPointerException question, ochi; it's a specific query about a Documentum DFC operation. Neither object reference in that code snippet is a null pointer, so this isn't the run-of-the-mill null-pointer problem... – Sheldon R. May 18 '16 at 20:29
  • There is no evidence in the question that this is not a generic NPE question. Add more code to show this is not the case and I will remove my comment/vote to close. *Hint:* look at the object throwing the exception (i.e. `.add(...)` ) - Is the `DfOperation` not null? is there more info on the stacktrace? – blurfus May 18 '16 at 20:34
  • As I said, the objects being referenced are not null. This is a Documentum-specific question, not a generic Java question – Sheldon R. May 18 '16 at 20:47
  • DFC Operations in Documentum do a lot of things under the covers, so clearly something that was expected to have a value by one of the other methods called by 'add' did not. I realize this may look like it's a simplistic Java question not worthy of being posted, but, trust me, a Documentum DFC developer will recognize this issue... – Sheldon R. May 18 '16 at 20:57
  • I recognize this is a complex environment (I know what Documentum is) are you able to put logging statements (or debug breakpoints) and see if all the objects referenced in the stacktrace are not null? – blurfus May 18 '16 at 21:02
  • Perhaps relevant: http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors – blurfus May 18 '16 at 21:30
  • Currently, logging is at the INFO level, and I've gotten log messages from Documentum at previous points in the code. I might bump it up to DEBUG to see if that shows something more. I know that the object being added is not null, because I was able to call a method on it (getObjectName()) and receive the expected result. I'd like to think that the DfCheckoutOperation object is not null because I just constructed it and the stacktrace indicates that the null error occurs in a method being called by add(). I have a couple things I can try in the morning, so I'll post my results here – Sheldon R. May 18 '16 at 21:32
  • can you add full stacktrace? – Miki May 19 '16 at 07:46
  • Hey, ochi, I figured out the answer to my question and it wasn't due to me using null object references. Can you go ahead and reverse your down-vote now? :) – Sheldon R. May 19 '16 at 19:42

2 Answers2

1

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.

Sheldon R.
  • 432
  • 1
  • 6
  • 25
0

You need to check some things before executing checkout operation:

  • perform objToCheckOut.isCheckedOut() if true you can't continue with checkout operation
  • perform

if( objToCheckOut.getACL().getPermit(String accessorName) >= IDfACL.DF_PERMIT_WRITE) //continue with checkout operation.

Additionally, you can checkout with permission level IDfACL.DF_PERMIT_VERSION.

Something probably is preventing you to perform execute on operation. Read this whitepaper for further information - according to it, code was written the way it throws NullPointerException in case something of above isn't satisfied.

Miki
  • 2,438
  • 2
  • 26
  • 35
  • Just prior to the code I show above, I did do a call of the 'isCheckedOut()' method and it did return false. As for permission, I'll check that, but I did use the userid 'dmadmin' to establish the session, so I would have thought that permissions wouldn't have been an issue for the docbase superuser. I'll check the whitepaper; hopefully it's not the one I've already looked at :) – Sheldon R. May 19 '16 at 13:39
  • then please write more details when writing question, things you wrote are pretty relevant to the question :) – Miki May 19 '16 at 13:49
  • Miki, I was trying to isolate the relevant code segment in order to make the question more readable. But while the specific things you mentioned were not the cause of the problem, your including a link to Umair's whitepaper was useful, since the sample code it contains is correct for Documentum 6.x releases. – Sheldon R. May 19 '16 at 19:47