tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 48643] New: and load() - close() bugs
Date Sun, 31 Jan 2010 00:53:05 GMT

           Summary: and load() - close()
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina

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 {
        } 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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message