@Override public void onCancelled(ClientContext context) { cb.onFailure(new FetchException(FetchExceptionMode.CANCELLED, (String)null), null, context); }
@Override public void cancel(ClientContext context) { super.cancel(context); rcb.onFailure(new FetchException(FetchExceptionMode.CANCELLED), this, context); }
@Override public void onFailure(FetchException e, ClientGetState state, ClientContext context) { switch(e.mode) { case NOT_ENOUGH_PATH_COMPONENTS: case PERMANENT_REDIRECT: context.uskManager.updateKnownGood(usk, usk.suggestedEdition, context); } FreenetURI uri = e.newURI; if(uri != null) { // FIXME what are we doing here anyway? Document! uri = usk.turnMySSKIntoUSK(uri); e = new FetchException(e, uri); } cb.onFailure(e, state, context); }
@Override public void onFailure(ClientContext context) { FetchException e = null; if(datastoreOnly) { try { onFoundEdition(usk.suggestedEdition, usk, context, false, (short) -1, null, false, false); return; } catch (Throwable t) { e = new FetchException(FetchExceptionMode.INTERNAL_ERROR, t); } } if(e == null) e = new FetchException(FetchExceptionMode.DATA_NOT_FOUND, "No USK found"); if(logMINOR) Logger.minor(this, "Failing USK with "+e, e); if(cb == null) throw new NullPointerException("Callback is null in "+this+" for usk "+usk+" with datastoreOnly="+datastoreOnly); cb.onFailure(e, null, context); }
public void fail(FetchException e) { synchronized(this) { if(succeeded || failed) return; failed = true; } if(storage != null) context.getChkFetchScheduler(realTimeFlag).removePendingKeys(storage.keyListener, true); if(getter != null) getter.cancel(context); if(storage != null) storage.cancel(); cb.onFailure(e, this, context); }
@Override public void onFoundEdition(long l, USK newUSK, ClientContext context, boolean metadata, short codec, byte[] data, boolean newKnownGood, boolean newSlotToo) { if(l < usk.suggestedEdition && datastoreOnly) l = usk.suggestedEdition; ClientSSK key = usk.getSSK(l); try { if(l == usk.suggestedEdition) { SingleFileFetcher sf = new SingleFileFetcher(parent, cb, null, key, metaStrings, key.getURI().addMetaStrings(metaStrings), 0, ctx, false, realTimeFlag, actx, null, null, maxRetries, recursionLevel+1, dontTellClientGet, token, false, true, false, (short)0, context, false); if(tag != null) { cb.onTransition(tag, sf, context); } sf.schedule(context); } else { cb.onFailure(new FetchException(FetchExceptionMode.PERMANENT_REDIRECT, newUSK.getURI().addMetaStrings(metaStrings)), null, context); } } catch (FetchException e) { cb.onFailure(e, null, context); } }
rcb.onFailure(new FetchException(FetchExceptionMode.INVALID_METADATA, "Invalid metadata: too many path components in redirects", thisKey), this, context); } else { rcb.onFailure(new FetchException(FetchExceptionMode.TOO_MANY_PATH_COMPONENTS, result.size(), (rcb == parent), result.getMimeType(), tryURI), this, context); rcb.onFailure(new FetchException(FetchExceptionMode.TOO_BIG, result.size(), (rcb == parent), result.getMimeType()), this, context); result.asBucket().free(); } else {
protected void onFailure(FetchException e, boolean forceFatal, ClientContext context) { if(logMINOR) Logger.minor(this, "onFailure( "+e+" , "+forceFatal+")", e); if(parent.isCancelled() || cancelled) { if(logMINOR) Logger.minor(this, "Failing: cancelled"); e = new FetchException(FetchExceptionMode.CANCELLED); forceFatal = true; } if(!(e.isFatal() || forceFatal) ) { if(retry(context)) { if(logMINOR) Logger.minor(this, "Retrying"); return; } } // :( unregisterAll(context); synchronized(this) { finished = true; } if(e.isFatal() || forceFatal) parent.fatallyFailedBlock(context); else parent.failedBlock(context); rcb.onFailure(e, this, context); }
if(edition > usk.suggestedEdition) { if(logMINOR) Logger.minor(SingleFileFetcher.class, "Redirecting to edition "+edition); cb.onFailure(new FetchException(FetchExceptionMode.PERMANENT_REDIRECT, usk.copy(edition).getURI().addMetaStrings(metaStrings)), null, context); return null; } else if(edition == -1 && cb.onFailure(new FetchException(FetchExceptionMode.PERMANENT_REDIRECT, usk.copy(edition).getURI().addMetaStrings(metaStrings)), null, context); return null;
rcb.onFailure(new FetchException(FetchExceptionMode.INVALID_METADATA, "Invalid metadata: too many path components in redirects", thisKey), this, context); } else { rcb.onFailure(new FetchException(FetchExceptionMode.TOO_MANY_PATH_COMPONENTS, metadata.uncompressedDataLength(), (rcb == parent), clientMetadata.getMIMEType(), tryURI), this, context);