如何克隆 NotesDocument java 对象

发布于 2025-01-20 15:41:09 字数 392 浏览 1 评论 0原文

我有以下Java代码,稍后尝试访问MISCDOC对象时,它似乎是无效的。我在NotesDocument上找不到.clone()方法。

if语句仅一次访问

Document MiscDoc = null;
wdoc = dcAll.getFirstDocument();
while (wdoc != null){       
            if(...){
                MiscDoc = wdoc;
            }
            Document tmpdoc = dcAll.getNextDocument();
            wdoc.recycle();
            wdoc = tmpdoc;
}

一次

I have the following java code and when I try to access the MiscDoc object later it seem to be null. I could not find a .clone() method on NotesDocument.

the if statement is only accessed once

Document MiscDoc = null;
wdoc = dcAll.getFirstDocument();
while (wdoc != null){       
            if(...){
                MiscDoc = wdoc;
            }
            Document tmpdoc = dcAll.getNextDocument();
            wdoc.recycle();
            wdoc = tmpdoc;
}

how can I resolve this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍景流年 2025-01-27 15:41:09

当您回收时,每个文档在循环时,循环也会回收和循环后无效。

只是不要回收此某个文档,并且在循环时将可用。

最简单的方法是添加break;,如果您只是在寻找与(...)条件相匹配的第一个文档:

while (wdoc != null) {       
    if(...){
        MiscDoc = wdoc;
        break;
    }

As you recycle every document in while loop your MiscDoc is also recycled and null after loop.

Just don't recycle this certain document and it will be available after while loop.

Easiest way is to add break; if you are just looking for the first document that matches if(...) condition:

while (wdoc != null) {       
    if(...){
        MiscDoc = wdoc;
        break;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文