/** * Called when the request fails. Retrying will have already been attempted by the calling state, if * appropriate; we have tried to get the data, and given up. * @param e The reason for failure, in the form of a FetchException. * @param state The failing state. */ @Override public void onFailure(FetchException e, ClientGetState state, ClientContext context) { onFailure(e, state, context, false); }
/** * Add a block to the binary blob. */ protected void addKeyToBinaryBlob(ClientKeyBlock block, ClientContext context) { if(binaryBlobWriter == null) return; synchronized(this) { if(finished) { if(logMINOR) Logger.minor(this, "Add key to binary blob for "+this+" but already finished"); return; } } if(logMINOR) Logger.minor(this, "Adding key "+block.getClientKey().getURI()+" to "+this, new Exception("debug")); try { binaryBlobWriter.addKey(block, context); } catch (IOException e) { Logger.error(this, "Failed to write key to binary blob stream: "+e, e); onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to write key to binary blob stream: "+e), null, context); } catch (BinaryBlobAlreadyClosedException e) { Logger.error(this, "Failed to write key to binary blob stream (already closed??): "+e, e); onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to write key to binary blob stream (already closed??): "+e), null, context); } }
if (binaryBlobWriter != null && !dontFinalizeBlobWriter) binaryBlobWriter.finalizeBucket(); } catch (IOException ioe) { onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to close binary blob stream: "+ioe), null, context); return; } catch (BinaryBlobAlreadyClosedException e) { onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to close binary blob stream, already closed: "+e, e), null, context); return; onFailure(ex, state, context, true); if(raf != null) try {
if (binaryBlobWriter != null && !dontFinalizeBlobWriter) binaryBlobWriter.finalizeBucket(); } catch (IOException ioe) { onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to close binary blob stream: "+ioe), null, context); return; } catch (BinaryBlobAlreadyClosedException e) { onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to close binary blob stream, already closed: "+e, e), null, context); return; onFailure(new FetchException(FetchExceptionMode.MIME_INCOMPATIBLE_WITH_EXTENSION, "No MIME type but need specific extension \""+forceCompatibleExtension+"\""), null, context); return; checkCompatibleExtension(mimeType); } catch (FetchException e) { onFailure(e, null, context); return; onFailure(ex, state, context, true); if(finalResult != null && finalResult != returnBucket) { finalResult.free();