#1129 FindBugs fails using Closeables.closeQuietly(stream)

2.0.3
closed-works-for-me
5
2013-10-16
2012-11-05
Jan Riehn
No

The following code fails with OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE on line 133:

124: try {
125: if (stream == null) {
126: LOGGER.error(String.format("File [%s] not found. Using default properties.", PROPERTIES_FILENAME));
127: } else {
128: props.load(stream);
129: }
130: } catch (IOException e) {
131: LOGGER.error(String.format("Error reading [%s]. Using default properties.", PROPERTIES_FILENAME), e);
132: } finally {
133: Closeables.closeQuietly(stream);
134: }
135: return props;

Using IOUtils.closeQuietly(stream) this snippet works properly. I'm using findbugs 2.0.1 with findbugs-maven-plugin 2.5.2.

Best regards,

Jan

Discussion

  • William Pugh

    William Pugh - 2012-11-13
    • labels: 954086 --> false positive
    • assigned_to: nobody --> wpugh
    • status: open --> pending-works-for-me
     
  • William Pugh

    William Pugh - 2013-10-16
    • status: pending-works-for-me --> closed-works-for-me
    • Group: --> 2.0.3
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks