Re: [iText-questions] Documentation error in newPage() ?

2007-01-28 Thread Bruno Lowagie
mister bean wrote:
 In the Javadoc for Document.newPage(), it says iText throws a
 DocumentException if newPage() is called on a closed document. My unit tests
 cannot reproduce this behavior. 

I'll have a look and see if I can reproduce it.

 Moreover the source code from Document.java indicates that if the document
 is closed, you simply return without throwing any exception.

In that case, the documentation is outdated.

 listener.newPage();

PdfDocument implements DocListener and can throw an exception.
Maybe it's possible to bring PdfDocument in an inconsistent state.
For instance by pausing/resuming PdfWriter, and by doing so cause
a DocumentException. I'm not sure if what I tell here makes sense,
but in such a case, I'd prefer to have a DocumentException tell me
what is happening. I'll have a look at it.
br,
Bruno

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/


[iText-questions] Documentation error in newPage() ?

2007-01-27 Thread mister bean

In the Javadoc for Document.newPage(), it says iText throws a
DocumentException if newPage() is called on a closed document. My unit tests
cannot reproduce this behavior. 

Moreover the source code from Document.java indicates that if the document
is closed, you simply return without throwing any exception. Here is the
iText code, as downloaded today:

/**
 * Signals that an new page has to be started.
 *
 * @return CODEtrue/CODE if the page was added, CODEfalse/CODE
 * if not.
 * @throws DocumentException
 * when a document isn't open yet, or has been closed
 */

public boolean newPage() throws DocumentException {
if (!open || close) {
return false;
}
DocListener listener;
for (Iterator iterator = listeners.iterator(); 
iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.newPage();
}
return true;
}

Am I missing something? If not, could we throw the exception (my preference)
or get rid of it; and either way, update the Javadoc?

Many thanks for this, as well as for a fine library and a terrific book
(which is now available in the US).

---Andrew Binstock

-- 
View this message in context: 
http://www.nabble.com/Documentation-error-in-newPage%28%29---tf3130142.html#a8672965
Sent from the iText - General mailing list archive at Nabble.com.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/