将超过17000个文档复制到文件夹时出现以下错误:
Exception occurred calling method NotesDocumentCollection.putAllInFolder(string)
这是我的代码:
docColl = database.search(formula);
getComponent("TempName").setValue(docColl.getCount());
docColl.putAllInFolder("f_Statistics");
如果我移动少于17000个文档,它就可以了。视图中没有任何文档。
我该如何解决这个问题?
答案 0 :(得分:1)
我该如何解决这个问题?
复制较少的文件?如果您在文件数量超过一定数量时出现问题,是不是将其分成多个动作?
答案 1 :(得分:1)
也许您可以使用循环和try ... catch来处理错误。我不确定xpages所需的确切语法,但可能是这样的:
docColl = database.search(formula);
exceptionCaught = true; // little white lie
while(exceptionCaught = true);
{
getComponent("TempName").setValue(docColl.getCount());
exceptionCaught = false;
try
{
docColl.putAllInFolder("f_Statistics");
}
catch (Exception e)
{ // It blew up; assume that this means there were too many docs
View folder = db.getView("f_Statistics");
docColl.Subtract(folder.getAllEntries();
exceptionCaught = true;
}
}
是的,这是一个黑客攻击。
并且没有...上面没有经过测试,甚至语法检查。我只是抛弃了这个主意。
如果你试试这个,我强烈建议你做一些额外的检查,以确保异常的原因确实是docs的数量,因为如果发生任何其他异常,上面的代码很可能是一个无限循环!