Considering the source code below, I would like to know if:
- is it possible for the
pages
object to be null in any case (even with corrupted files)? - is it possible for the
page
object to be null in any case (even with corrupted files)? - is it possible for the
collection
object to be null in any case (even with corrupted files)?
// pdfDocument is instance of com.aspose.pdf.Document
PageCollection pages = pdfDocument.getPages();
for (com.aspose.pdf.Page page : pages) {
com.aspose.pdf.AnnotationCollection collection = page.getAnnotations());
// some more logic here
}
The documentation I have found doesn’t mention anything nulls being returned or not
https://reference.aspose.com/pdf/java/com.aspose.pdf/document/#getPages–
https://reference.aspose.com/pdf/java/com.aspose.pdf/page/#getAnnotations–
It might be off someone asking how the code would behave with corrupted files but we might get to know it after this code was already executed.
Thanks, in advance