From: James Moger Date: Fri, 18 Apr 2014 02:18:27 +0000 (-0400) Subject: [findbugs] Null checks on closing a repository in ITicketService X-Git-Tag: v1.5.0~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9ee8b1b793113e74a2fffc1e2aa764279d1c686d;p=gitblit.git [findbugs] Null checks on closing a repository in ITicketService --- diff --git a/src/main/java/com/gitblit/tickets/ITicketService.java b/src/main/java/com/gitblit/tickets/ITicketService.java index 8d922b59..c2f3283e 100644 --- a/src/main/java/com/gitblit/tickets/ITicketService.java +++ b/src/main/java/com/gitblit/tickets/ITicketService.java @@ -379,7 +379,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to create label " + label + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return lb; } @@ -405,7 +407,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to update label " + label + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return false; } @@ -444,7 +448,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to rename label " + oldName + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return false; } @@ -473,7 +479,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to delete label " + label + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return false; } @@ -579,7 +587,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to create milestone " + milestone + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return ms; } @@ -611,7 +621,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to update milestone " + milestone + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return false; } @@ -659,7 +671,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to rename milestone " + oldName + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return false; } @@ -690,7 +704,9 @@ public abstract class ITicketService { } catch (IOException e) { log.error("failed to delete milestone " + milestone + " in " + repository, e); } finally { - db.close(); + if (db != null) { + db.close(); + } } return false; }