Optional logger calls could be added to COSDocument & PDJpeg when an error
occurs.
-----------------------------------------------------------------------------------
Key: PDFBOX-408
URL: https://issues.apache.org/jira/browse/PDFBOX-408
Project: PDFBox
Issue Type: Improvement
Affects Versions: 0.8.0-incubator
Environment: All
Reporter: [email protected]
The return code of the delete was ignored.
We really should log an error like this if it happened.
COSBase extends LoggingObject
org.apache.pdfbox.cos.COSDocument extends COSBase
In COSDocument you could add calls to the logger to report any problems
deleting a file.
public void close() throws IOException
{
if( scratchFile != null )
{
scratchFile.close();
scratchFile = null;
}
if( tmpFile != null )
{
boolean deleted=false;
try {
deleted=tmpFile.delete();
if (!deleted)
logger().severe("File was not
deleted:"+tmpFile.getName());
}
catch (IOException e) {
if (!deleted)
logger().severe("File was not deleted IOException:
"+tmpFile.getName());
throw e;
}
catch (SecurityException se) {
// If a security manager exists and its
// java.lang.SecurityManager.checkDelete method denies
delete
// access to the file.
if (!deleted)
logger().severe("File was not deleted
securityexception: "+tmpFile.getName());
throw se;
}
tmpFile = null;
}
}
package org.apache.pdfbox.pdmodel.graphics.xobject;
public abstract class PDXObject implements COSObjectable
public abstract class PDXObjectImage extends PDXObject
public class PDJpeg extends PDXObjectImage
To make logging available to PDJpeg you could extend the PDXObject class.
public abstract class PDXObject extends LoggingObject implements COSObjectable
Then in PDJpeg the logging of errors could be added for the delete method
call, just like above.
if (imgFile != null) {
imgFile.delete();
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.