bugGrammatica - Bugs: bug #25986, NPE in ParseException if the...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25986: NPE in ParseException if the details field is null

Submitter:  Per Cederberg <cederberg>
Submitted:  Tue 24 Mar 2009 09:24:06 PM UTC
   
 
Severity:  5 - Major Item Group:  Software
Status:  None Assigned to:  cederberg
Open/Closed:  Open

Tue 24 Mar 2009 09:24:06 PM UTC, original submission:  

See details in email below:

2009/3/24 William Lahti

> If you receive a ParseException and try to inspect it's Details property, it
> may crash if the exception has a null 'details' field, as get_Details tries
> to make a copy of the 'details' field without checking if it's null.
> Here's the exception I received:
> System.ArgumentNullException: Collection cannot be null.
> Parameter name: c
>    at System.Collections.ArrayList..ctor(ICollection c)
>    at PerCederberg.Grammatica.Runtime.ParseException.get_Details()
>    ...
> Here's the offending property:
>
>        public ArrayList Details {
>             get {
>                 return new ArrayList(details);
>             }
>         }
> It's found at line 208 in
> src/csharp/PerCederberg.Grammatica.Runtime/ParseException.cs
> The fix is easy:
>        public ArrayList Details {
>             get {
>                 if (details == null)
>                        return new ArrayList (); // or just null, but an
> empty list makes more sense imho
>                 return new ArrayList(details);
>             }
>         }
> Sorry I couldn't provide a patch, but I don't have a proper diff tool on
> this Windows box and it's a really minor change (though hard to get around
> without recompiling Grammatica).

Per Cederberg <cederberg>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cederberg (Submitted the item)
  • -email is unavailable- added by cederberg
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-03-24 cederberg Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code