James Moger
2015-11-19 e41e8f8c3bc9f5edab1d271464364f95620ece8c
src/main/java/com/gitblit/tickets/BranchTicketService.java
@@ -30,9 +30,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.dircache.DirCache;
@@ -75,6 +72,8 @@
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.google.inject.Inject;
import com.google.inject.Singleton;
/**
 * Implementation of a ticket service based on an orphan branch.  All tickets
@@ -117,6 +116,7 @@
   @Override
   public BranchTicketService start() {
      log.info("{} started", getClass().getSimpleName());
      return this;
   }
@@ -297,7 +297,7 @@
         log.error("failed to read " + file, e);
      } finally {
         if (rw != null) {
            rw.release();
            rw.close();
         }
      }
      return null;
@@ -353,7 +353,7 @@
      } catch (IOException e) {
         log.error("", e);
      } finally {
         inserter.release();
         inserter.close();
      }
   }
@@ -712,7 +712,7 @@
         } finally {
            // release the treewalk
            if (treeWalk != null) {
               treeWalk.release();
               treeWalk.close();
            }
         }
      } finally {
@@ -811,7 +811,7 @@
         // finish the index
         builder.finish();
      } finally {
         inserter.release();
         inserter.close();
      }
      return newIndex;
   }
@@ -828,8 +828,12 @@
      List<DirCacheEntry> list = new ArrayList<DirCacheEntry>();
      TreeWalk tw = null;
      try {
         tw = new TreeWalk(db);
         ObjectId treeId = db.resolve(BRANCH + "^{tree}");
         if (treeId == null) {
            // branch does not exist yet, could be migrating tickets
            return list;
         }
         tw = new TreeWalk(db);
         int hIdx = tw.addTree(treeId);
         tw.setRecursive(true);
@@ -851,7 +855,7 @@
         }
      } finally {
         if (tw != null) {
            tw.release();
            tw.close();
         }
      }
      return list;
@@ -909,10 +913,10 @@
                     rc));
            }
         } finally {
            revWalk.release();
            revWalk.close();
         }
      } finally {
         odi.release();
         odi.close();
      }
      return success;
   }