Fix UnsupportedOperationException while fixing thin pack

If a thin pack has a large delta we need to be able to open
its cached copy from the loose object directory through the
CachedObjectDatabase handle.  Unfortunately that did not support the
openObject2 method, which the LargePackedDeltaObject used directly
to bypass looking at the pack files.

Bug: 324868
Change-Id: I1d5886a6c3254c6dea2852d50b8614c31a93e615
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2010-09-17 09:11:26 -07:00
parent a8e2932d04
commit 2ee6d95e5b
1 changed files with 7 additions and 6 deletions

View File

@ -187,15 +187,15 @@ ObjectLoader openObject1(WindowCursor curs, AnyObjectId objectId)
@Override
boolean hasObject2(String objectId) {
// This method should never be invoked.
throw new UnsupportedOperationException();
return unpackedObjects.contains(ObjectId.fromString(objectId));
}
@Override
ObjectLoader openObject2(WindowCursor curs, String objectName,
AnyObjectId objectId) throws IOException {
// This method should never be invoked.
throw new UnsupportedOperationException();
if (unpackedObjects.contains(objectId))
return wrapped.openObject2(curs, objectName, objectId);
return null;
}
@Override
@ -208,8 +208,9 @@ long getObjectSize1(WindowCursor curs, AnyObjectId objectId) throws IOException
@Override
long getObjectSize2(WindowCursor curs, String objectName, AnyObjectId objectId)
throws IOException {
// This method should never be invoked.
throw new UnsupportedOperationException();
if (unpackedObjects.contains(objectId))
return wrapped.getObjectSize2(curs, objectName, objectId);
return -1;
}
@Override