سؤال

I have an XPage which has just broken due to (what should have been) a small change.

If I run (where document1 is NotesXSPDocument datasource) :

document1.replaceItem("ItemName", false); //or true, or any variable/formula that results in a boolean

followed by:

document1.getDocument(true); 

I end up with an error

[TypeError] Exception occurred calling method NotesXspDocument.getDocument(boolean) null

This is on a new document (so not saved yet, which I've not tested, but might make a difference), hence I can't just set the field on the underlying doc.

It doesn't seem to be an artifact of anything else in the page, as a basic test page confirms it. It doesn't happen with anything (I've found) other than a boolean.

Any advice, other than just change the data type? I guess that's what I'll end up doing (along with a bug report) but I'd like to know I'm not missing something first.

Thanks

------------Test XSP code------------

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"><xp:this.data>
   <xp:dominoDocument var="document1" formName="Test" />
   </xp:this.data><xp:span style="font-weight:bold">
        Button 1 code:</xp:span><xp:br></xp:br>document1.replaceItemValue(&quot;Test&quot;,false);
<xp:br></xp:br>var doc:NotesDocument = document1.getDocument(true);
<xp:br></xp:br>print(doc.toString());<xp:br></xp:br>
    <xp:button value="Test 1" id="button1">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:document1.replaceItemValue("Test",false);
var doc:NotesDocument = document1.getDocument(true);
print(doc.toString());}]]></xp:this.action>
        </xp:eventHandler></xp:button>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:br></xp:br><xp:span style="font-weight:bold">
    Button</xp:span><xp:span style="font-weight:bold"> 2</xp:span><xp:span style="font-weight:bold"> Code:</xp:span><xp:span style="font-weight:bold"></xp:span>&#160;<xp:br></xp:br>document1.replaceItemValue(&quot;Test&quot;,&quot;Test);<xp:br></xp:br>var doc:NotesDocument = document1.getDocument(true);
<xp:br></xp:br>print(doc.toString());<xp:br></xp:br><xp:button value="Test 2" id="button2">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:document1.replaceItemValue("Test","Test");
var doc:NotesDocument = document1.getDocument(true);
print(doc.toString());}]]></xp:this.action>
        </xp:eventHandler></xp:button></xp:view>
هل كانت مفيدة؟

المحلول

If you have a look in the stack trace you will see the following:

....
NotesException: Unknown or unsupported object type in Vector
    lotus.domino.local.Document.NreplaceItemValue(Native Method)
    lotus.domino.local.Document.replaceItemValue(Unknown Source)
    com.ibm.xsp.model.domino.wrapped.DominoDocument.applyChangesToDoc(DominoDocument.java:1698)
    com.ibm.xsp.model.domino.wrapped.DominoDocument.applyChanges(DominoDocument.java:1649)
    com.ibm.xsp.model.domino.wrapped.DominoDocument.getDocument(DominoDocument.java:544)
    com.ibm.xsp.script.WrapperDominoEx$fct_DominoDocument.call(WrapperDominoEx.java:254)
....

The problem is that you use the replaceItemValue method with an unsupported data type.

Here is a list of all allowed data types:

  • String Text
  • Integer Number
  • Double Number
  • DateTime Date-time item
  • java.util.Vector with String, Integer, Double, or DateTime elements Multi-value text, number, or date-time item
  • Item Same data type as the Item

The error is raised in the moment the backend document is synchronized with the datasource document. That's why it fails while calling document1.getDocument(true).

Hope this helps

Sven

EDIT: Why are you setting the value to false?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top