這是一個常見的問題,並且本發明涉及的對象(丟失或不按順序)的不正確的關閉/再循環。 E0 * TM文件將在對象處於活動狀態並在回收時進行清理時創建。
如果它們是正確的,然後檢查,看看是否有殺毒軟件運行阻止刪除。
我以前的作品之前,測試這一點,所以比較你下面的示例代碼。
try {
System.out.println("Start");
String path = "test.txt";
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
System.out.println("Get DB");
Database db = session.getCurrentDatabase();
System.out.println("View + doc");
View vw = db.getView("main");
Document doc = vw.getFirstDocument();
System.out.println("Embedded object");
EmbeddedObject att = doc.getAttachment(path);
InputStream is = att.getInputStream();
ByteArrayOutputStream fos = new ByteArrayOutputStream();
byte buffer[] = new byte[(int) att.getFileSize()];
int read;
do {
read = is.read(buffer, 0, buffer.length);
if (read > 0) {
fos.write(buffer, 0, read);
}
} while (read > -1);
fos.close();
is.close();
// recycle the domino variables
doc.recycle();
vw.recycle();
db.recycle();
att.recycle();
} catch (Exception e) {
e.printStackTrace();
}
embeddedObject.recycle(); document.recycle(); 對不起,它的.recycle();它不是..recycle(); – Sarma
嗯......當我忘記關閉InputStream時,我遇到了那些臨時文件。事實上,我向IBM提交了一份報告,因爲那時文檔從未提及關閉流的要求。現在確實如此。實際上,文檔現在包含了我向IBM建議的確切語言。所以這很神祕。如果這是一個普遍可重現的情況,那將是一個嚴重的錯誤。你使用的是什麼版本的Notes或Domino? –
感謝您的回覆,我正在使用Lotus Notes 8. – Sarma