Open
Description
Describe the bug
The IOUtils.close
function:
atmosphere/modules/cpr/src/main/java/org/atmosphere/util/IOUtils.java
Lines 463 to 486 in d350bc5
throws a null pointer exception if it is called with one single parameter which is null.
Atmosphere Info
- version: all since b31804c
- atmosphere.js version NA
- extensions used None
Expected behavior
Should not throw null.
Screenshots
Systems (please complete the following information):
- OS: NA
- Browser name and version: NA
- Java version and distribution: at least Java 21 probably more
- Serveur name and version: NA
Additional context
This is an edge case of Java behavior of varargs.
An improved implementation could be:
if (closeableArray != null) {
for (Closeable closeable : closeableArray) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException ioe) {
logger.info("Can't close the object", ioe);
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels
Activity