Thank you. It's already fixed in the SVN. Paulo
> -----Original Message----- > From: Maege [mailto:[email protected]] > Sent: Monday, July 06, 2009 2:15 PM > To: [email protected] > Subject: [iText-questions] Bug in PdfStamperImp: read > producer from PdfDictionary may cause NullpointerException > > Hello, > > I just decovered a bug in PdfStamperImp (line 216). > PdfStamperImp tries to read producer info from (oldInfo) > PdfDictionary whenever oldInfo is not null. But producer > information may in some cases not be contained in the > oldInfo. However, PdfStamperImp expects producer info to be > available if oldInfo is not null and wants to read it which > causes a NullpointerException. > > I fixed the code this way: > > int skipInfo = -1; > PRIndirectReference iInfo = > (PRIndirectReference)reader.trailer.get(PdfName.INFO); > PdfDictionary oldInfo = > (PdfDictionary)PdfReader.getPdfObject(iInfo); > String producer = null; > if (iInfo != null) > skipInfo = iInfo.getNumber(); > if (oldInfo != null) > if (oldInfo.getAsString(PdfName.PRODUCER) != null) > producer = > oldInfo.getAsString(PdfName.PRODUCER).value; > else > producer = "unknown"; > if (producer == null) { > producer = Document.getVersion(); > } > else if (producer.indexOf(Document.getProduct()) == -1) { > StringBuffer buf = new StringBuffer(producer); > buf.append("; modified using "); > buf.append(Document.getVersion()); > producer = buf.toString(); > } > > > Kind regards > > Markus Zuberbühler Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
