1

我正在使用 truezip(7.7.9 版本)更新我的 Java 代码中的存档文件。

当调用 时,我在 try catch 块中执行上述TFile.umount操作,代码会自动跳过块中的直接行try并转到finally.

如果有人提出解决方案真的会很有帮助。

try
{
    //to commit the changes in archive file
    TFile.umount(archive);
    upload(archive); //this line never executed so, I've added this method to finally block.
}
catch(Exception ex)
{
    uncommitted = true;
    logger.log(Level.INFO,"errorcommitting"+archive.getName());
}
finally
{
    if(!uncommitted)
        upload(archive);
}

我已经对代码进行了更改以使其可以使用,但是以这种方式进行操作感觉不正确。

4

0 回答 0