commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Ring <...@jdns.org>
Subject [cli] HelpFormatter.pad(String, int, Writer) in cli2
Date Fri, 10 Feb 2006 15:21:12 GMT
Hi all,

I was thinking that

protected static void pad(final String text,
	final int width,
	final Writer writer) throws IOException

would read better as

protected static void pad(final String text,
	final int width,
	final PrintWriter writer)

for the following reason:

pad() has protected access in HelpWriter. All non-JUnit callers pass a 
PrintWriter to pad() anyway, which does not throw IOException in its write() 
method. So, the upshot is that pad() no longer has to throw IOException.

In fact, I think there would be no need for IOExceptions to be thrown by 
HelpWriter at all. If callers want to know if an error occurs inside 
HelpWriter, they can call getPrintWriter().checkErrors(). 

What do people think?

Thanks!

Regards,
James

-- 
James Ring

Mime
View raw message