Cleanup RevWalk.parseCommit, parseTree to not throw ClassCastException
commit66637d07522e660354b46931a48648043b577c6b
authorShawn O. Pearce <spearce@spearce.org>
Thu, 4 Sep 2008 23:42:13 +0000 (4 16:42 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sun, 7 Sep 2008 21:24:08 +0000 (7 23:24 +0200)
treea18e6b1dd10b6b1cf4bb9dcce9487015b84df93d
parentc6fc986ec2e5f2741999a990c446af71639c9f44
Cleanup RevWalk.parseCommit, parseTree to not throw ClassCastException

Throwing ClassCastException here for non-commits is really difficult
to work with at the caller level because we may catch the wrong sort
of ClassCastException and may mask a bug deep inside of RevWalk's
parsing code.  It is cleaner to throw IncorrectObjectTypeException
and catch that.  Besides, the method javadoc says that is what gets
thrown if either method is given the wrong type.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/AbstractTreeIteratorHandler.java
org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/RevCommitHandler.java
org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/RevTreeHandler.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java