You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by BRUNELLIERE Anthony <an...@maif.fr> on 2024/04/25 09:34:12 UTC
Question about warning "corrupted file" from PDDocument
Hello,
I ask you this question before creating a JIRA.
The method PDDocument.save(..) (version 3.0.2) generates a warning if the output file already exists :
[...]
public void save(File file, CompressParameters compressParameters) throws IOException
{
if (file.exists())
{
LOG.warn(
"You are overwriting the existing file " + file.getName()
+ ", this will produce a corrupted file if you're also reading from it");
}
[...]
I understand the disclaimer "Don't use the input file as target as this will produce a corrupted file", but I'm in a context where an empty ouput file is created just before for specific reasons.
Should this warning be limited to non-empty files?
Thank you in advance for your feedback
Re: Question about warning "corrupted file" from PDDocument
Posted by Tilman Hausherr <TH...@t-online.de>.
done; thanks for the suggestion!
https://issues.apache.org/jira/browse/PDFBOX-5814
Tilman
On 25.04.2024 11:39, Tilman Hausherr wrote:
> Makes sense IMHO!
>
> Tilman
>
> On 25.04.2024 11:34, BRUNELLIERE Anthony wrote:
>> Hello,
>>
>> I ask you this question before creating a JIRA.
>>
>> The method PDDocument.save(..) (version 3.0.2) generates a warning if
>> the output file already exists :
>>
>> [...]
>> public void save(File file, CompressParameters compressParameters)
>> throws IOException
>> {
>> if (file.exists())
>> {
>> LOG.warn(
>> "You are overwriting the existing file " +
>> file.getName()
>> + ", this will produce a corrupted file
>> if you're also reading from it");
>> }
>> [...]
>>
>> I understand the disclaimer "Don't use the input file as target as
>> this will produce a corrupted file", but I'm in a context where an
>> empty ouput file is created just before for specific reasons.
>>
>> Should this warning be limited to non-empty files?
>>
>> Thank you in advance for your feedback
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: dev-help@pdfbox.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org
Re: Question about warning "corrupted file" from PDDocument
Posted by Tilman Hausherr <TH...@t-online.de>.
Makes sense IMHO!
Tilman
On 25.04.2024 11:34, BRUNELLIERE Anthony wrote:
> Hello,
>
> I ask you this question before creating a JIRA.
>
> The method PDDocument.save(..) (version 3.0.2) generates a warning if the output file already exists :
>
> [...]
> public void save(File file, CompressParameters compressParameters) throws IOException
> {
> if (file.exists())
> {
> LOG.warn(
> "You are overwriting the existing file " + file.getName()
> + ", this will produce a corrupted file if you're also reading from it");
> }
> [...]
>
> I understand the disclaimer "Don't use the input file as target as this will produce a corrupted file", but I'm in a context where an empty ouput file is created just before for specific reasons.
>
> Should this warning be limited to non-empty files?
>
> Thank you in advance for your feedback
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org