Fix NPE during InflaterCache return after corrupt loose object
commitdafa8fbff42be3c644061fa6c81d149097bd31fd
authorShawn O. Pearce <spearce@spearce.org>
Fri, 23 Apr 2010 18:16:25 +0000 (23 11:16 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 23 Apr 2010 18:16:25 +0000 (23 11:16 -0700)
treef02f7d114bdadb2748a4f0f8ff367d23cf949e6d
parent0f95d2d0462f8badd3cdb1fadb6dbb3fe84074b4
Fix NPE during InflaterCache return after corrupt loose object

If a corrupt loose object is read, UnpackedObjectLoader was disposing
of the Inflater, and then attempting to return the disposed Inflater
to the InflaterCache.  Since the disposed Inflater had its native
libz resource deallocated and its reference cleared out, the Inflater
threw NullPointerException and refused to reset itself before being
put back into the cache.

Instead of disposing of the Inflater when corruption is found, do
nothing, and allow it to be returned to the cache.  The instance
will get reset, and should be usable by a future caller.

Bug: 310291
Change-Id: I44f2247c08b6e04fa62f8399609341b07508c096
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java