@Override
public CacheFetchResult lookupInstant(FreenetURI key, boolean noFilter, boolean mustCopy, Bucket preferred) {
ClientGet get = globalRebootClient.getCompletedRequest(key);
Bucket origData = null;
String mime = null;
boolean filtered = false;
if(get != null && ((!noFilter) || (!(filtered = get.filterData())))) {
origData = new NoFreeBucket(get.getBucket());
mime = get.getMIMEType();
}
if(origData == null && globalForeverClient != null) {
CacheFetchResult result = globalForeverClient.getRequestStatusCache().getShadowBucket(key, noFilter);
if(result != null) {
mime = result.getMimeType();
origData = result.asBucket();
filtered = result.alreadyFiltered;
}
}
if(origData == null) return null;
if(!mustCopy)
return new CacheFetchResult(new ClientMetadata(mime), origData, filtered);
Bucket newData = null;
try {
if(preferred != null) newData = preferred;
else newData = core.tempBucketFactory.makeBucket(origData.size());
BucketTools.copy(origData, newData);
if(origData.size() != newData.size()) {
Logger.normal(this, "Maybe it disappeared under us?");
newData.free();
newData = null;
return null;
}
return new CacheFetchResult(new ClientMetadata(mime), newData, filtered);
} catch (IOException e) {