Menu

#752 is_CHARTYPE() functions cannot handle empty strings

v1.1.x
fixed
v1.1.4
Bug Fix
2023-02-13
2022-10-20
Erik Hänel
No

The functions for detecting character types (like is_alpha()) cannot handle empty strings. Check and resolve this for all is_CHARTYPE() functions.

Analysis:

The issue in these cases in strings/stringfunctions.hpp is always the change to the new StringVector class, which is default constructed and therefore contains no element. If the argument to the string function is only a string with zero characters, then no further element is constructed in the StringVector class instance. Can probably be resolved by checking fpr StringVector::empty() and using StringVector::push_back(false).

Implementation:

  • Implementation: Fixed exactly as described above. All functions return 0 for empty strings.
  • Revision: [r1265]
  • Implementation test: Performed one basic test for each string function with an empty string.

Documentation:

  • [x] ChangesLog updated
  • [x] Code changes commented
  • Documentation articles:
    • [ ] corresponding documentation articles updated
    • [ ] new documentation articles created
    • [x] not needed
  • Language files:
    • [ ] corresponding language files updated
    • [x] not needed

Tests:

Detected problems were resolved within [r1326].

Related

Commit: [r1265]
Commit: [r1326]

Discussion

  • Erik Hänel

    Erik Hänel - 2022-10-20
    • labels: --> strings, function, internal
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2022-10-20
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,23 @@
     The functions for detecting character types (like `is_alpha()`)  cannot handle empty strings. Check and resolve this for all `is_CHARTYPE()` functions.
    +
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +
    +###Documentation:
    +* [ ] ChangesLog updated
    +* [ ] Code changes commented
    +* **Documentation articles:**
    
    +    * [ ] corresponding documentation articles updated
    +    * [ ] new documentation articles created
    +    * [ ] not needed
    +* **Language files:**
    +    * [ ] corresponding language files updated
    +    * [ ] not needed
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2022-10-20
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     The functions for detecting character types (like `is_alpha()`)  cannot handle empty strings. Check and resolve this for all `is_CHARTYPE()` functions.
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +The issue in these cases in `strings/stringfunctions.hpp` is always the change to the new `StringVector` class, which is default constructed and therefore contains no element. If the argument to the string function is only a string with zero characters, then no further element is constructed in the `StringVector` class instance. Can probably be resolved by checking fpr `StringVector::empty()` and using `StringVector::push_back(false)`.
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
    • assigned_to: Erik Hänel --> Raphael Zehner
     
  • Raphael Zehner

    Raphael Zehner - 2022-11-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,20 +4,20 @@
     The issue in these cases in `strings/stringfunctions.hpp` is always the change to the new `StringVector` class, which is default constructed and therefore contains no element. If the argument to the string function is only a string with zero characters, then no further element is constructed in the `StringVector` class instance. Can probably be resolved by checking fpr `StringVector::empty()` and using `StringVector::push_back(false)`.
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +* Implementation: Fixed exactly as described above. All functions return 0 for empty strings.
    +* Revision: [r1265]
    +* Implementation test: Performed one basic test for each string function with an empty string.
    
     ###Documentation:
    -* [ ] ChangesLog updated
    -* [ ] Code changes commented
    +* [x] ChangesLog updated
    +* [x] Code changes commented
    
     * **Documentation articles:**
         * [ ] corresponding documentation articles updated
         * [ ] new documentation articles created
    -    * [ ] not needed
    +    * [x] not needed
     * **Language files:**
         * [ ] corresponding language files updated
    -    * [ ] not needed
    +    * [x] not needed
    
     ###Tests:
     (*Describe, which tests you performed and their outcome*)
    
    • status: implementing --> testing
    • assigned_to: Raphael Zehner --> Erik Hänel
     

    Related

    Commit: [r1265]

  • Erik Hänel

    Erik Hänel - 2023-02-13
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -20,4 +20,4 @@
    
         * [x] not needed
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +Detected problems were resolved within [r1326].
    
    • status: testing --> fixed
     

    Related

    Commit: [r1326]

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB