FindBugs OBL_UNSATISFIED_OBLIGATION
13:31 21 Sep 2013

I'm trying to find bugs in on of our legacy code using findBugs. In one the methods, findBugs is giving OBL_UNSATISFIED_OBLIGATION error. I have verified that all streams are properly closed. Here is the code snippet:

FileWriter fw = null;
FileReader fr = null;
try {
    if (!new File(filePath).exists()) {
        requiredStrings = CommandUtils.invoke(filename);
        fw = new FileWriter(filePath);
        fw.write(requiredStrings);
    } else {               
        StringBuilder sb = new StringBuilder();
        fr = new FileReader(filePath);

        char[] buffer = new char[BLOCK_READ_SIZE];
        int bytesRead;
        while (-1 != (bytesRead = fr.read(buffer, 0, BLOCK_READ_SIZE))) {
            sb.append(buffer, 0, bytesRead);
        }
        requiredStrings = sb.toString();
    }
} finally {
    if (fw != null) {
        fw.close();
    }
    if (fr != null) {
        fr.close();
    }
}
return requiredStrings;

The error says that Obligation to clean up resurces in not discharged, Path continues at ....line.... Remaining obligations {Reader x 1, Writer x-1}

java findbugs