On Sun, 2011-01-23 at 00:36 +0000, Dr Andrew John Hughes wrote:
> >   public PrintStream (OutputStream out, boolean auto_flush, String encoding)
> >     throws UnsupportedEncodingException
> >   {
> >     super (out);
> >
> > +    if (out == null || encoding == null)
> > +      throw new NullPointerException();
> > +
> >     new String(new byte[]{0}, encoding);    // check if encoding is 
> > supported
> >     this.encoding = encoding;
> >     this.auto_flush = auto_flush;

> What is the current behaviour?  Does it eventually throw an NPE but
> just performs a lot of additional computation first?  Or does it throw
> some other error?  Or return a bad value?

For encoding, it throws InvalidArgumentException and for out, it doesn't
throw anything.

> The NPEs should have some message as to what went wrong e.g. "The
> specified output stream was null.".

I'll fix that up. Thanks!


Reply via email to