diff options
author | Shawn Pearce <spearce@spearce.org> | 2015-05-28 15:39:07 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2015-05-28 15:39:08 -0400 |
commit | a3468f87cb571d7c1b71fc682631a5fc9d38bdf6 (patch) | |
tree | d05992bd133815e64a51056f22ed70bdaced80ca /org.eclipse.jgit | |
parent | 5426ba2778deae852c8250cf26b6c487beb9ea8a (diff) | |
parent | eea43de7a4b8c012f8bb0089da0da44da2e8bafa (diff) | |
download | jgit-a3468f87cb571d7c1b71fc682631a5fc9d38bdf6.tar.gz jgit-a3468f87cb571d7c1b71fc682631a5fc9d38bdf6.zip |
Merge changes I7b6d7be4,I63a74651,I39c2ea6b
* changes:
Silence unused object warning in MyersDiff
Silence resource leak warnings where caller is responsible to close
Fix potential null pointer access in IndexDiffFilter
Diffstat (limited to 'org.eclipse.jgit')
4 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java index 6216fdedb5..9810a6ab2f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java @@ -114,6 +114,7 @@ import org.eclipse.jgit.util.LongList; public class MyersDiff<S extends Sequence> { /** Singleton instance of MyersDiff. */ public static final DiffAlgorithm INSTANCE = new LowLevelDiffAlgorithm() { + @SuppressWarnings("unused") @Override public <S extends Sequence> void diffNonCommon(EditList edits, HashedSequenceComparator<S> cmp, HashedSequence<S> a, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java index eecbc224bc..45dd7ee1ac 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java @@ -565,14 +565,16 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re * based on other options. If insufficient information is available, an * exception is thrown to the caller. * - * @return a repository matching this configuration. + * @return a repository matching this configuration. The caller is + * responsible to close the repository instance when it is no longer + * needed. * @throws IllegalArgumentException * insufficient parameters were set. * @throws IOException * the repository could not be accessed to configure the rest of * the builder's parameters. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "resource" }) public R build() throws IOException { R repo = (R) new FileRepository(setup()); if (isMustExist() && !repo.getObjectDatabase().exists()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java index c7d957c4fb..0c58a0bea4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java @@ -159,6 +159,7 @@ public class RepositoryCache { openLocks[i] = new Lock(); } + @SuppressWarnings("resource") private Repository openRepository(final Key location, final boolean mustExist) throws IOException { Reference<Repository> ref = cacheMap.get(location); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java index 3ef3d97916..42725bc767 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java @@ -224,7 +224,8 @@ public class IndexDiffFilter extends TreeFilter { // Only one chance left to detect a diff: between index and working // tree. Make use of the WorkingTreeIterator#isModified() method to // avoid computing SHA1 on filesystem content if not really needed. - return wi.isModified(di.getDirCacheEntry(), true, tw.getObjectReader()); + return wi.isModified(di == null ? null : di.getDirCacheEntry(), true, + tw.getObjectReader()); } /** |