https://issues.apache.org/bugzilla/show_bug.cgi?id=48643
Summary: catalina.session.FileStore.save() and load() - close()
bugs
Product: Tomcat 7
Version: trunk
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: [email protected]
ReportedBy: [email protected]
The code for the save() method reads:
try {
fos = new FileOutputStream(file.getAbsolutePath());
oos = new ObjectOutputStream(new BufferedOutputStream(fos));
} catch (IOException e) {
if (oos != null) { <== oos can only be null here
try {
oos.close();
} catch (IOException f) {
// Ignore
}
}
throw e;
}
Presumably the catch statement should try to close fos instead?
Similarly for the load() method; at line 280/281 there is the code:
} catch (IOException e) {
if (ois != null) {
However, ois is the last object created by the try clause, so must be null.
Probably the code should check and close bis and/or fis.
At the end of the load() method, the code says:
// Close the input stream
if (ois != null) {
However, ois cannot be null at that point.
Note: these bugs were detected by the Eclipse compiler.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]