Menu

#116 get -stringlist throws a standard exception if no strings are present

v1.0.x
fixed
None
v1.0.9
Bug Fix
2016-10-09
2016-10-07
Erik Hänel
No

The command get -stringlist throws an exception of type basic_string::erase if it is invoked without any available string.

Analysis:
In the following lines:

if (matchParams(sCmd, "asstr"))
    sReturn.erase(sReturn.length()-3);
else
    sReturn.erase(sReturn.length()-2);

there's a check missing, which ensures that sReturn actually contains at least 2 or 3 characters, respectively.

Implementation:
A check was implemented. Implementation test were passed successfully.

Documentation:
Not needed - bug fix.

Tests:
Single case - no explicit test needed: implementation tests ware sufficient.

Discussion

  • Erik Hänel

    Erik Hänel - 2016-10-08
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2016-10-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,9 @@
     The command `get -stringlist` throws an exception of type `basic_string::erase` if it is invoked without any available string.
    +
    +**Analysis:**
    +
    +**Implementation:**
    +
    +**Documentation:**
    +
    +**Tests:**
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2016-10-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,14 @@
     The command `get -stringlist` throws an exception of type `basic_string::erase` if it is invoked without any available string.
    
     **Analysis:**
    +In the following lines:
    +~~~
    +if (matchParams(sCmd, "asstr"))
    
    +    sReturn.erase(sReturn.length()-3);
    +else
    +    sReturn.erase(sReturn.length()-2);
    +~~~
    +there's a check missing, which ensures that `sReturn` actually contains at least 2 or 3 characters, respectively.
    
     **Implementation:**
    
    • status: analyzing --> implementing
     
  • Erik Hänel

    Erik Hänel - 2016-10-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -11,7 +11,9 @@
     there's a check missing, which ensures that `sReturn` actually contains at least 2 or 3 characters, respectively.
    
     **Implementation:**
    +A check was implemented. Implementation test were passed successfully.
    
     **Documentation:**
    +Not needed - bug fix.
    
     **Tests:**
    
    • status: implementing --> testing
     
  • Erik Hänel

    Erik Hänel - 2016-10-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -17,3 +17,4 @@
     Not needed - bug fix.
    
     **Tests:**
    +Single case - no explicit test needed: implementation tests ware sufficient.
    
    • status: testing --> fixed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB