Browse Source

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
stable-4.1
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
a3468f87cb
  1. 1
      org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
  2. 6
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
  3. 1
      org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
  4. 3
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java

1
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,

6
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())

1
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);

3
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());
}
/**

Loading…
Cancel
Save