| Summary: | Empty string for Dish object allowed | ||
|---|---|---|---|
| Product: | Group20 | Reporter: | awkakavou2-c |
| Component: | Dish | Assignee: | Anders <agmller2-c> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | agmller2-c |
| Priority: | Low | ||
| Version: | unspecified | ||
| Hardware: | PC | ||
| OS: | Windows | ||
Hi, I have added an if-else statement to check if the string (dish name) has a length less than one. If that is the case then an error will be thrown. See code below:
if(s.length() < 1)
throw new IllegalArgumentException("Empty name");
else
this.name = s;
I mark this bug as fixed.
|
Hi, i noticed that it is possible to add a dish with an empty name, I don't think this should be allowed, an exception should be created. public Dish(String s, double d, int i){ this.name = s;