Browse Source

TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)

This form of addTree() does not parse any objects and cannot throw the
declared checked exception.  Callers are being forced to try-catch
CorruptObjectException that cannot occur when the iterator instance
has already been constructed.

Change-Id: Id338035302903bab81569d1576eab063eee0885a
tags/v4.2.0.201601211800-r
Shawn Pearce 8 years ago
parent
commit
2262a794b4
1 changed files with 5 additions and 10 deletions
  1. 5
    10
      org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java

+ 5
- 10
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java View File

@@ -574,18 +574,13 @@ public class TreeWalk implements AutoCloseable, AttributesProvider {
* @param p
* an iterator to walk over. The iterator should be new, with no
* parent, and should still be positioned before the first entry.
* The tree which the iterator operates on must have the same root
* as other trees in the walk.
*
* The tree which the iterator operates on must have the same
* root as other trees in the walk.
* @return position of this tree within the walker.
* @throws CorruptObjectException
* the iterator was unable to obtain its first entry, due to
* possible data corruption within the backing data store.
*/
public int addTree(final AbstractTreeIterator p)
throws CorruptObjectException {
final int n = trees.length;
final AbstractTreeIterator[] newTrees = new AbstractTreeIterator[n + 1];
public int addTree(AbstractTreeIterator p) {
int n = trees.length;
AbstractTreeIterator[] newTrees = new AbstractTreeIterator[n + 1];

System.arraycopy(trees, 0, newTrees, 0, n);
newTrees[n] = p;

Loading…
Cancel
Save