dev@javaserverfaces.java.net

Re: [REVIEW] Fine tuning of parsing/validation code for _05

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Tue, 15 May 2007 21:06:07 -0700

Jason Lee wrote:
> The only thing that jumps out at me are possible dangling InputStreams:
>
> DOMSource domSource
> = new DOMSource(db.parse(getInputStream(documentURL),
> documentURL.toExternalForm()));
>
> URL url = DbfFactory.class.getResource(FACES_1_2_XSD);
> URLConnection conn = url.openConnection();
> conn.setUseCaches(false);
> InputStream in = conn.getInputStream();
>
>
> [Not sure about this one]
> if (source != null) {
> return new Input(source.getByteStream());
> }
>
> Am I off-base?
>
IIRC, SAX used under the covers by DOM, closes the streams automatically.

Could be wrong though.