Java

Java

Made by DeepSource

Database resource may not be closed on return JAVA-S0326

Bug risk
Critical

The method creates a database resource (such as a database connection or row) but does not appear to do any of the following:

  • Assign the resource to any fields
  • Pass it to other methods that might close it
  • Return it
  • Close the resource object on all possible exception paths out of the method

Failure to close database resources on all paths out of a method may result in poor performance, and could cause the application to have problems communicating with the database. Ensure that the resource is closed no matter how the method is exited.