eclipse-ee4j / eclipse-ee4j/expressly
String Handling in ELArithmetic is not correct
- Dominant language
- Java
- Stars
- 15
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
```
protected final Number coerce(final Object obj) {
if (isNumber(obj)) {
return coerce((Number) obj);
}
if (obj instanceof String) {
return coerce((String) obj);
}
if (obj == null || "".equals(obj)) {
return coerce(ZERO);
}
Class objType = obj.getClass();
if (Character.class.equals(objType) || Character.TYPE == objType) {
return coerce(Short.valueOf((short) ((Character) obj).charValue()));
}
throw new IllegalArgumentException(MessageFactory.get("el.convert", obj, objType));
}
```
The "".equals(obj) part can never be reache or?
Contributor guide
Research direction
Start in ELArithmetic at the protected coerce(Object) method shown in the issue, and trace the order of its number, String, null, and empty-string checks. Verify whether the empty-string branch is reachable and what behavior the existing tests expect; done means the conversion behavior is correct and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100