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

Submitted by:  Per Cederberg <cederberg>
Submitted on:  Tue 24 Mar 2009 09:24:06 PM UTC  
 
Severity: 5 - MajorItem Group: Software
Status: NoneAssigned to: Per Cederberg <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>
Project AdministratorIn charge of this item.

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 24 Mar 2009 09:24:06 PM UTCcederbergCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1