0

Why the heading error in the findbugs for the following code.

 boolean isCreated =  folder.mkdirs();

    if (!isCreated) {
        throw new IOException("Folder already exists..!!!");
    }
Aruna Karunarathna
  • 981
  • 2
  • 23
  • 55
  • Are you sure it's not coming from one of the other method calls on the folder object (presumably being a java.io.File instance). – Steve C May 13 '14 at 13:10

2 Answers2

2

According to Finds Bug Description.

Method ignores exceptional return value

Method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution.

akash
  • 22,664
  • 11
  • 59
  • 87
0

Probably because you're not checking for the SecurityException that mkdirs can throw.

FrobberOfBits
  • 17,634
  • 4
  • 52
  • 86