Examples of FetchException


Examples of freenet.client.FetchException

                            parent.lastBlockMightNotBePadded()) {
                        // Ignore.
                        return;
                    } else {
                        // Usual case.
                        parent.fail(new FetchException(FetchExceptionMode.SPLITFILE_DECODE_ERROR, "Decoded block does not match expected key"));
                        return;
                    }
                }
                if(capturingBinaryBlob)
                    parent.fetcher.maybeAddToBinaryBlob(block);
            } catch (CHKEncodeException e) {
                // Impossible!
                parent.fail(new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Decoded block could not be encoded"));
                Logger.error(this, "Impossible: Decoded block could not be encoded");
                return;
            }
        }
    }
View Full Code Here

Examples of freenet.client.FetchException

                }
                if(capturingBinaryBlob)
                    parent.fetcher.maybeAddToBinaryBlob(block);
            } catch (CHKEncodeException e) {
                // Impossible!
                parent.fail(new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Decoded block could not be encoded"));
                Logger.error(this, "Impossible: Decoded block could not be encoded");
                return false;
            }
        }
        return true;
View Full Code Here

Examples of freenet.client.FetchException

                // checking, and might have non-obvious complications if we e.g. have data loss in
                // FEC decoding.
                Logger.warning(this, "Ignoring last block");
                return false;
            } else {
                parent.fail(new FetchException(FetchExceptionMode.SPLITFILE_ERROR, "Splitfile block is too short"));
                return false;
            }
        }
        SplitFileFetcherCrossSegmentStorage callback = null;
        // Clearer to do duplicate handling here, plus we only need to decode once.
View Full Code Here

Examples of freenet.client.FetchException

      }
    } catch (PersistenceDisabledException e) {
      // Impossible
      Logger.error(this, "Failed to start: "+e);
      synchronized(this) {
        this.failed = new FetchException(FetchExceptionMode.INTERNAL_ERROR, e);
        this.finished = true;
      }
    }
  }
View Full Code Here

Examples of freenet.client.FetchException

    mimeType = ContentFilter.stripMIMEType(mimeType);
    FilterMIMEType type = ContentFilter.getMIMEType(mimeType);
    if(type == null || ((!type.safeToRead) && type.readFilter == null)) {
      UnknownContentTypeException e = new UnknownContentTypeException(mimeType);
      data.free();
      onFailure(new FetchException(e.getFetchErrorCode(), data.size(), e, mimeType), null);
      return true;
    } else if(type.safeToRead) {
      tracker.removeFetcher(this);
      onSuccess(new FetchResult(new ClientMetadata(mimeType), data), null);
      return true;
View Full Code Here

Examples of freenet.client.FetchException

        } else {
            wantBinaryBlob = false;
        }
        blockFetchContext = new FetchContext(fetchContext, FetchContext.SPLITFILE_DEFAULT_BLOCK_MASK, true, null);
        if(parent.isCancelled())
            throw new FetchException(FetchExceptionMode.CANCELLED);
       
        try {
            // Completion via truncation.
            if(isFinalFetch && cb instanceof FileGetCompletionCallback &&
                    (decompressors == null || decompressors.size() == 0) &&
                    !fetchContext.filterData) {
                FileGetCompletionCallback fileCallback = ((FileGetCompletionCallback)cb);
                File targetFile = fileCallback.getCompletionFile();
                if(targetFile != null) {
                    callbackCompleteViaTruncation = fileCallback;
                    fileCompleteViaTruncation = File.createTempFile(targetFile.getName(), ".freenet-tmp", targetFile.getParentFile());
                    // Storage must actually create the RAF since it knows the length.
                } else {
                    callbackCompleteViaTruncation = null;
                    fileCompleteViaTruncation = null;
                }
            } else {
                callbackCompleteViaTruncation = null;
                fileCompleteViaTruncation = null;
            }
            // Construct the storage.
            ChecksumChecker checker = new CRCChecksumChecker();
            storage = new SplitFileFetcherStorage(metadata, this, decompressors, clientMetadata,
                    topDontCompress, topCompatibilityMode, fetchContext, realTimeFlag, getSalter(),
                    thisKey, parent.getURI(), isFinalFetch, parent.getClientDetail(checker),
                    context.random, context.tempBucketFactory,
                    persistent ? context.persistentRAFFactory : context.tempRAFFactory,
                    persistent ? context.jobRunner : context.dummyJobRunner,
                    context.ticker, context.memoryLimitedJobRunner, checker, persistent,
                    fileCompleteViaTruncation, context.getFileRandomAccessBufferFactory(persistent),
                    context.getChkFetchScheduler(realTimeFlag).fetchingKeys());
        } catch (InsufficientDiskSpaceException e) {
            throw new FetchException(FetchExceptionMode.NOT_ENOUGH_DISK_SPACE);
        } catch (IOException e) {
            Logger.error(this, "Failed to start splitfile fetcher because of disk I/O error?: "+e, e);
            throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e);
        }
        long eventualLength = Math.max(storage.decompressedLength, metadata.uncompressedDataLength());
        cb.onExpectedSize(eventualLength, context);
        if(metadata.uncompressedDataLength() > 0)
            cb.onFinalizedMetadata();
        if(eventualLength > 0 && fetchContext.maxOutputLength > 0 && eventualLength > fetchContext.maxOutputLength)
            throw new FetchException(FetchExceptionMode.TOO_BIG, eventualLength, true, clientMetadata.getMIMEType());
        getter = new SplitFileFetcherGet(this, storage);
        raf = storage.getRAF();
        if(logMINOR)
            Logger.minor(this, "Created "+(persistent?"persistent" : "transient")+" download for "+
                    thisKey+" on "+raf+" for "+this);
View Full Code Here

Examples of freenet.client.FetchException

     * throws.
     * @param e The IOException, generated when accessing the on-disk storage.
     */
    @Override
    public void failOnDiskError(IOException e) {
        fail(new FetchException(FetchExceptionMode.BUCKET_ERROR));
    }
View Full Code Here

Examples of freenet.client.FetchException

    /** Fail the whole splitfile request when we get unrecoverable data corruption, e.g. can't
     * read the keys. FIXME ROBUSTNESS in some cases this could actually be recovered by
     * restarting from the metadata or the original URI. */
    @Override
    public void failOnDiskError(ChecksumFailedException e) {
        fail(new FetchException(FetchExceptionMode.BUCKET_ERROR));
    }
View Full Code Here

Examples of freenet.client.FetchException

        cb.onFailure(e, this, context);
    }

    @Override
    public void cancel(ClientContext context) {
        fail(new FetchException(FetchExceptionMode.CANCELLED));
    }
View Full Code Here

Examples of freenet.client.FetchException

                    context.jobRunner.newSalt(), salter, resumed,
                    callbackCompleteViaTruncation != null);
        } catch (ResumeFailedException e) {
            raf.free();
            Logger.error(this, "Failed to resume storage file: "+e+" for "+raf, e);
            throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e);
        } catch (IOException e) {
            raf.free();
            Logger.error(this, "Failed to resume due to I/O error: "+e+" raf = "+raf, e);
            throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e);
        } catch (StorageFormatException e) {
            raf.free();
            Logger.error(this, "Failed to resume due to storage error: "+e+" raf = "+raf, e);
            throw new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Resume failed: "+e, e);
        } catch (FetchException e) {
            raf.free();
            throw e;
        }
        synchronized(this) {
            lastNotifiedStoreFetch = System.currentTimeMillis();
        }
        getter = new SplitFileFetcherGet(this, storage);
        try {
            if(storage.start(resumed))
                getter.schedule(context, storage.hasCheckedStore());
        } catch (KeyListenerConstructionException e) {
            Logger.error(this, "Key listener construction failed during resume: "+e, e);
            fail(new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Resume failed: "+e, e));
            return;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.