NotesXSPDocument.getDocument(true) gives error

Hi

I have an Xpage with fileupload and filedownload controls. I tried to submit/save a document with a couple attachments. It works fine. After saving the document, i have tried to delete all attachments and saved the document but it has given me the following error.

Error while executing JavaScript action expression

Script interpreter error, line=3, col=49: [TypeError] Exception occurred calling method NotesXspDocument.getDocument(boolean) null

my code:(server side javascript calls java method(


1: print(1);

2: print(typeof testDoc.getDocument());

3: var doc:NotesDocument = testDoc.getDocument(true);

4: print(2);

5:

6: var objDoc= new com.test.DocDocument(doc); //java class

7: doc.computeWithForm(false, false);

8:

9: objDoc.testSave(); //java method

10: if (!testDoc.isNewNote()){

11: context.redirectToPage(“./test.xsp?documentId=”+doc.getUniversalID()+“&action=editDocument”);

12: }

I would appreciate if anyone helps me on this.

Regards,

Karthik KS