Evaluate the implementation of GradeCalculations.isValidLetterGrade(String letterGrade)

Description

Currently the GradeCalculations.isValidLetterGrade(String letterGrade) is implemented as follows:

public boolean isValidLetterGrade(String letterGrade) {
if (letterGrade == null || letterGrade.trim().length() == 0)
return true;

return letterGradeMap.containsKey(letterGrade.toUpperCase());
}

I am concerned about the initial check:
if (letterGrade == null || letterGrade.trim().length() == 0)
return true;

... in which case we are saying that a null or zero length string is a valid grade. I looked as some of the calling functions and they inconsistently check the passed in letterGrade value for null and or empty string. Judging from this it seems that the initial check should return "false" but we need further investigate this to make sure that this is not an expected side effect.

Activity

Show:

Thomas Amsler January 26, 2011 at 3:40 PM

This needs to be prioritized ...

Details

Assignee

Reporter

Components

Affects versions

Priority

Created January 26, 2011 at 3:37 PM
Updated January 26, 2011 at 3:40 PM