Package freenet.client

Examples of freenet.client.FetchException


  }

  @Override
  public void cancel(ClientContext context) {
    super.cancel(context);
    rcb.onFailure(new FetchException(FetchExceptionMode.CANCELLED), this, context);
  }
View Full Code Here


    rcb.onFailure(new FetchException(FetchExceptionMode.CANCELLED), this, context);
  }

  @Override
  protected void notFoundInStore(ClientContext context) {
    this.onFailure(new FetchException(FetchExceptionMode.DATA_NOT_FOUND), true, context);
  }
View Full Code Here

    this.onFailure(new FetchException(FetchExceptionMode.DATA_NOT_FOUND), true, context);
  }

  @Override
  protected void onBlockDecodeError(SendableRequestItem token, ClientContext context) {
    onFailure(new FetchException(FetchExceptionMode.BLOCK_DECODE_ERROR, "Could not decode block with the URI given, probably invalid as inserted, possible the URI is wrong"), true, context);
  }
View Full Code Here

    }

    Bucket data = null;
    String mimeType = null;
    String referer = sanitizeReferer(ctx);
    FetchException fe = null;


    FProxyFetchResult fr = null;

      FProxyFetchWaiter fetch = null;
View Full Code Here

        int mainElementsPerKey = DEFAULT_MAIN_BLOOM_ELEMENTS_PER_KEY;
        mainBloomK = (int) (mainElementsPerKey * 0.7);
        long elementsLong = origSize * mainElementsPerKey;
        // REDFLAG: SIZE LIMIT: 3.36TB limit!
        if(elementsLong > Integer.MAX_VALUE)
            throw new FetchException(FetchExceptionMode.TOO_BIG, "Cannot fetch splitfiles with more than "+(Integer.MAX_VALUE/mainElementsPerKey)+" keys! (approx 3.3TB)");
        int mainSizeBits = (int)elementsLong; // counting filter
        mainSizeBits = (mainSizeBits + 7) & ~7; // round up to bytes
        mainBloomFilterSizeBytes = mainSizeBits / 8 * 2; // counting filter
        double acceptableFalsePositives = ACCEPTABLE_BLOOM_FALSE_POSITIVES_ALL_SEGMENTS / segments;
        int perSegmentBitsPerKey = (int) Math.ceil(Math.log(acceptableFalsePositives) / Math.log(0.6185));
View Full Code Here

 
  public static FetchException translateException(LowLevelGetException e) {
      switch(e.code) {
      case LowLevelGetException.DATA_NOT_FOUND:
      case LowLevelGetException.DATA_NOT_FOUND_IN_STORE:
          return new FetchException(FetchExceptionMode.DATA_NOT_FOUND);
      case LowLevelGetException.RECENTLY_FAILED:
          return new FetchException(FetchExceptionMode.RECENTLY_FAILED);
      case LowLevelGetException.DECODE_FAILED:
          return new FetchException(FetchExceptionMode.BLOCK_DECODE_ERROR);
      case LowLevelGetException.INTERNAL_ERROR:
          return new FetchException(FetchExceptionMode.INTERNAL_ERROR);
      case LowLevelGetException.REJECTED_OVERLOAD:
          return new FetchException(FetchExceptionMode.REJECTED_OVERLOAD);
      case LowLevelGetException.ROUTE_NOT_FOUND:
          return new FetchException(FetchExceptionMode.ROUTE_NOT_FOUND);
      case LowLevelGetException.TRANSFER_FAILED:
          return new FetchException(FetchExceptionMode.TRANSFER_FAILED);
      case LowLevelGetException.VERIFY_FAILED:
          return new FetchException(FetchExceptionMode.BLOCK_DECODE_ERROR);
      case LowLevelGetException.CANCELLED:
          return new FetchException(FetchExceptionMode.CANCELLED);
      default:
          Logger.error(SimpleSingleFileFetcher.class, "Unknown LowLevelGetException code: "+e.code);
          return new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Unknown error code: "+e.code);
      }
  }
View Full Code Here

                    // Shutting down.
                    // We don't call the callback here, so we don't care.
                    shutdown = true;
                } catch (Throwable e) {
                    Logger.error(this, "Failed to decode "+this+" because of internal error: "+e, e);
                    parent.fail(new FetchException(FetchExceptionMode.INTERNAL_ERROR, e));
                } finally {
                    chunk.release();
                    synchronized(SplitFileFetcherSegmentStorage.this) {
                        tryDecode = false;
                    }
View Full Code Here

                // The downloaded blocks were correct, the encoded blocks are not.
                // That means the splitfile is broken as inserted, or there's some wierd in-memory data corruption.
                synchronized(this) {
                    finished = true;
                }
                parent.fail(new FetchException(FetchExceptionMode.SPLITFILE_DECODE_ERROR, "Encoded blocks do not match metadata"));
                return;
            }
            parent.finishedSuccess(this);
        }
        queueHeal(dataBlocks, checkBlocks, dataBlocksPresent, checkBlocksPresent);
View Full Code Here

                            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

                }
                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

TOP

Related Classes of freenet.client.FetchException

Copyright © 2018 www.massapicom. 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.