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

Bastian Preindl commented on PDFBOX-1926:
-----------------------------------------

Fair enough, but in my opinion throwing a NullPointerException is the wrong and 
misleading behavior. It would be great if a more expressive exception could be 
thrown, telling me that I want to operate on a closed resource. Additionally, 
it would maybe make sense to provide a facility to serialize and deserialize a 
PDDocument - putting a closed notebook in the cupboard should be a valid action 
;-)

> Document.save() after Document.close() causes Null Pointer Exception
> --------------------------------------------------------------------
>
>                 Key: PDFBOX-1926
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1926
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.4
>         Environment: Linux (Ubuntu)
>            Reporter: Bastian Preindl
>
> Until version 1.8.3 it was possible to perform a document's save()-call also 
> if the document's close()-method has already been called. In my opinion this 
> made sense as I'd like to persist the document's content also if no more 
> (content changing) operations are performed on it.
> Anyway, in 1.8.4, calling save() after close() causes a NullPointerException:
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.pdfbox.pdmodel.PDDocument.getDocumentCatalog(PDDocument.java:765)
>       at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1346)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to