About close method of File

  • Devin Tan
    Devin Tan
    2013-12-25

    Hi all,
    I using PDF Clown to write some OCR text to the original existing PDF file, but sometimes some PDF file will leave over a .tmp file. My code like below.
    org.pdfclown.files.File file = new org.pdfclown.files.File(pdfFile);
    try {
    ......using PrimitiveComposer to write some text
    file.save();
    } finally {
    file.close();
    }

    I read the source code, the save() method will save to a .tmp file, and the close() method will delete
    the original file and rename the .tmp file to it. it seems that the original file didn't delete successfully. Is this a bug or there is something wrong in my code?