abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: [PATCH] Check for null input streams (was Re: Getting started with Abdera)
Date Wed, 28 Jun 2006 03:22:58 GMT
Patched!

Garrett Rooney wrote:
> On 6/27/06, James M Snell <jasnell@gmail.com> wrote:
>>
>>
>> Garrett Rooney wrote:
>> >[snip]
>> > That kind of error tends to result from passing a null stream to
>> > parse().  When you say that the path to simple.xml was "valid", do you
>> > mean you gave it a full system path, like:
>> >
>>
>> Yep. I've seen this on several occasions and it always happens on a null
>> stream.  We need to add some error checking on that
> 
> How about this?
> 
> -garrett
> 
> [[[
> Check for null input streams in the parse() method.
> 
> [ in parser/src/main/java/org/apache/abdera/parser/stax ]
> 
> * FOMParser.java
>  (parse): Throw an IllegalArgumentException if we are passed a null
>   InputStream or Reader.
> ]]]
> 
> 
> ------------------------------------------------------------------------
> 
> Index: parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
> ===================================================================
> --- parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java	(revision 417623)
> +++ parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java	(working copy)
> @@ -65,6 +65,10 @@
>      ParserOptions options)
>        throws ParseException {
>      Document<T> document = null;
> +
> +    if (in == null)
> +      throw new IllegalArgumentException("InputStream must not be null");
> +
>      try {
>        FOMFactory factory = getFomFactory(options);
>        FOMBuilder builder = new FOMBuilder(factory, in, options);
> @@ -83,6 +87,10 @@
>      ParserOptions options) 
>        throws ParseException {
>      Document<T> document = null;
> +
> +    if (in == null)
> +      throw new IllegalArgumentException("Reader must not be null");
> +
>      try {
>        FOMFactory factory = getFomFactory(options);
>        XMLStreamReader xmlreader = 

Mime
View raw message