[ 
https://issues.apache.org/jira/browse/PDFBOX-6075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18022610#comment-18022610
 ] 

Tilman Hausherr commented on PDFBOX-6075:
-----------------------------------------

As the test shows, it can be closed again without having an NPE. outputStream 
is set only in the constructor so it can't be null after that. And whatever is 
passed must comply with the close() contract which is to allow multiple 
closures.

> PDPageContentStream.close() method cannot execute repeatedly
> ------------------------------------------------------------
>
>                 Key: PDFBOX-6075
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6075
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 3.0.3 PDFBox
>            Reporter: JIANG LIGUO
>            Priority: Minor
>         Attachments: image-2025-09-24-18-08-15-654.png, 
> image-2025-09-24-18-14-47-166.png
>
>   Original Estimate: 504h
>  Remaining Estimate: 504h
>
>  
> the method PDPageContentStream.close()   exists a logic to check for 
> null/empty in version 2.0.33.
> !image-2025-09-24-18-08-15-654.png|width=456,height=285!
>  
> but in version 3.0.3,this method was migrated to parent class 
> PDPageContentStream, and the logic to check for null/empty  was removed.
> !image-2025-09-24-18-14-47-166.png|width=660,height=149!
>  
> then I failed to call PDPageContentStream.close() second, it raise NPE.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to