]> source.dussan.org Git - gitblit.git/commitdiff
[findbugs] Null checks on closing a repository in ITicketService
authorJames Moger <james.moger@gitblit.com>
Fri, 18 Apr 2014 02:18:27 +0000 (22:18 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 18 Apr 2014 03:08:07 +0000 (23:08 -0400)
src/main/java/com/gitblit/tickets/ITicketService.java

index 8d922b596b97d3a8b2d61591f064ed5c9433bfdd..c2f3283ed9978168b0bdc644bf57d9890a543bca 100644 (file)
@@ -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;
        }